http://stackoverflow.com/comment/42344756
type: QuestionComment
has text: You should not do that. It is possible to do this, but when you will deploy your app in zip (or any other method) file, then it will not be possible for you to add image in it.
comment on: http://stackoverflow.com/q/26895661
type: Comment
score: 1

arrays
tags question: http://stackoverflow.com/q/26910437
tags question: http://stackoverflow.com/q/26974313
tags question: http://stackoverflow.com/q/26843986
tags question: http://stackoverflow.com/q/26987024
tags question: http://stackoverflow.com/q/26899936
tags question: http://stackoverflow.com/q/26979602
tags question: http://stackoverflow.com/q/26974448
tags question: http://stackoverflow.com/q/26990649
tags question: http://stackoverflow.com/q/26941145
tags question: http://stackoverflow.com/q/26948543
tags question: http://stackoverflow.com/q/26895468
tags question: http://stackoverflow.com/q/26921959
tags question: http://stackoverflow.com/q/26956545
tags question: http://stackoverflow.com/q/26850110
tags question: http://stackoverflow.com/q/26967716
tags question: http://stackoverflow.com/q/26960089
tags question: http://stackoverflow.com/q/26964615
tags question: http://stackoverflow.com/q/26857587
tags question: http://stackoverflow.com/q/26972559
type: Tag
tags question: http://stackoverflow.com/q/26948689
tags question: http://stackoverflow.com/q/26853413
tags question: http://stackoverflow.com/q/26949564
tags question: http://stackoverflow.com/q/26874631
tags question: http://stackoverflow.com/q/26876752
tags question: http://stackoverflow.com/q/26840640
tags question: http://stackoverflow.com/q/26860190
tags question: http://stackoverflow.com/q/26950282
tags question: http://stackoverflow.com/q/26871174
tags question: http://stackoverflow.com/q/26982737
tags question: http://stackoverflow.com/q/26984676
tags question: http://stackoverflow.com/q/26922306
tags question: http://stackoverflow.com/q/26861058
tags question: http://stackoverflow.com/q/26983064
tags question: http://stackoverflow.com/q/26918856
tags question: http://stackoverflow.com/q/26857776
tags question: http://stackoverflow.com/q/26960883
tags question: http://stackoverflow.com/q/26920114
tags question: http://stackoverflow.com/q/26901278
tags question: http://stackoverflow.com/q/26891271
tags question: http://stackoverflow.com/q/26856664
tags question: http://stackoverflow.com/q/26941589
tags question: http://stackoverflow.com/q/26834485
tags question: http://stackoverflow.com/q/26880584
tags question: http://stackoverflow.com/q/26855456
tags question: http://stackoverflow.com/q/26920142
tags question: http://stackoverflow.com/q/26950873
tags question: http://stackoverflow.com/q/26871069
tags question: http://stackoverflow.com/q/26942967
tags question: http://stackoverflow.com/q/26885375
tags question: http://stackoverflow.com/q/26864449
tags question: http://stackoverflow.com/q/26866152
tags question: http://stackoverflow.com/q/26959286
tags question: http://stackoverflow.com/q/26982892
tags question: http://stackoverflow.com/q/26906745
tags question: http://stackoverflow.com/q/26940575
tags question: http://stackoverflow.com/q/26897502
tags question: http://stackoverflow.com/q/26925575
tags question: http://stackoverflow.com/q/26989278
tags question: http://stackoverflow.com/q/26962531
tags question: http://stackoverflow.com/q/26925453
tags question: http://stackoverflow.com/q/26833468
tags question: http://stackoverflow.com/q/26907701
tags question: http://stackoverflow.com/q/26971175
tags question: http://stackoverflow.com/q/26990024
tags question: http://stackoverflow.com/q/26930446
tags question: http://stackoverflow.com/q/26839518
tags question: http://stackoverflow.com/q/26947814
tags question: http://stackoverflow.com/q/26909968
tags question: http://stackoverflow.com/q/26868153
tags question: http://stackoverflow.com/q/26941350
tags question: http://stackoverflow.com/q/26938214
tags question: http://stackoverflow.com/q/26951936
tags question: http://stackoverflow.com/q/26853875
tags question: http://stackoverflow.com/q/26937187
tags question: http://stackoverflow.com/q/26963967
tags question: http://stackoverflow.com/q/26935508
tags question: http://stackoverflow.com/q/26894584
tags question: http://stackoverflow.com/q/26874487
tags question: http://stackoverflow.com/q/26868421

http://stackoverflow.com/comment/42490649
has text: No, I would so something like `long now = System.currentTimeMillis();` And then just compare that value to the `lastModified()` value. if that's more than 10 days, then delete.
comment on: http://stackoverflow.com/q/26977784
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/42309654
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26854098
has text: 'Client Certs Enforced' is used to force clients to use a client certificate when interacting with Weblogic. In this case, Weblogic is acting as the client interacting with a third-party server.

http://stackoverflow.com/comment/42428237
comment on: http://stackoverflow.com/q/26942330
type: Comment
score: 1
has text: initial capacity equal to the pairs.size()
type: QuestionComment

jhipster
tag name: jhipster
type: Tag
tags question: http://stackoverflow.com/q/26873121
tags question: http://stackoverflow.com/q/26921093

http://stackoverflow.com/q/26951385
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42443710
tagged with: java
has comment: http://stackoverflow.com/comment/42443696
possible better answer: http://stackoverflow.com/a/26951405
has answer: http://stackoverflow.com/a/26951414
has answer: http://stackoverflow.com/a/26951405
accepted answer: http://stackoverflow.com/a/26951410
tagged with: arrays
has answer: http://stackoverflow.com/a/26951422
has body: In Java, you import HashMap; and import ArrayList;, etc. So why is import Arrays; plural?
has comment: http://stackoverflow.com/comment/42443999
favorite count: 0
has comment: http://stackoverflow.com/comment/42443839
has comment: http://stackoverflow.com/comment/42443671
answer count: 5
has answer: http://stackoverflow.com/a/26951430
type: AnsweredQuestion
has title: In Java, why is the class "Arrays" plural?
has comment: http://stackoverflow.com/comment/42443730
score: 6
has answer: http://stackoverflow.com/a/26951410
upvote count: 7
has comment: http://stackoverflow.com/comment/42444020

http://stackoverflow.com/comment/42269823
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26853643
has text: .toUpperCase() is added so the case of user input is ignored.

http://stackoverflow.com/a/28787519
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/128195686
type: Answer
answers question: http://stackoverflow.com/q/26934011
downvote count: 2
has body: I'm betting the eager fetches you think were working, were actually working incorrectly. When you eager fetch more than one "bag" (an unorder collection allowing duplicates), the sql used to perform the eager fetch (left outer join) will return multiple results for the joined associations as explained by this SO answer. So while hibernate does not throw the org.hibernate.loader.MultipleBagFetchException when you have more than one List eagerly fetched it would not return accurate results for the reason given above. However, when you give the query the entity graph hint, hibernate will (rightly) complain. Hibernate developer, Emmanuel Bernard, addresses the reasons for this exception to be thrown: eager fetching is not the problem per se, using multiple joins in one SQL query is. It's not limited to the static fetching strategy; it has never been supported (property), because it's conceptually not possible. Emmanuel goes on to say in a different JIRA comment that, most uses of "non-indexed" List or raw Collection are erroneous and should semantically be Sets. So bottom line, in order to get the multiple eager fetching to work as you desire: use a Set rather than a List persist the List index using JPA 2's @OrderColumn annotation, if all else fails, fallback to Hibernate specific fetch annotations (FetchMode.SELECT or FetchMode.SUBSELECT) EDIT related: https://stackoverflow.com/a/17567590/225217 https://stackoverflow.com/a/24676806/225217
score: 16
has comment: http://stackoverflow.com/comment/94068111
has comment: http://stackoverflow.com/comment/128195633
accepted answer of: http://stackoverflow.com/q/26934011
has comment: http://stackoverflow.com/comment/117702462
upvote count: 18

http://stackoverflow.com/a/26948711
has body: mysqli_query() is returning false because of failure. Use $query="SELECT * FROM studentinfo WHERE stName=" . $un . " AND stP= " . $pw; Moreover, this is not a good way because if your query fails, it will return boolean false which will again generate error for mysqli_num_rows() You may look into this for further information and this for better ways to query your database.
answers question: http://stackoverflow.com/q/26948591
score: 0
type: Answer

http://stackoverflow.com/comment/42506045
has text: That does not work . It does not change when I connect to my vpn client.
comment on: http://stackoverflow.com/a/26986191
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42499175
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26964183
type: Comment
has text: Get rid of the void, eh? I'll try that.

http://stackoverflow.com/comment/42360652
comment on: http://stackoverflow.com/a/26903864
score: 0
type: AnswerComment
type: Comment
has text: @lolung You shouldn't change row height from the renderer. Edited the answer to show how to "pack" the table to set the heights.

http://stackoverflow.com/q/26922710
tagged with: websphere-8
score: 0
has comment: http://stackoverflow.com/comment/42392959
tagged with: jms
has title: java.lang.NoSuchFieldError: com/ibm/ws/ssl/core/Constants.ALL_PROTOCOLS
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42392916
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42404669
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/42428619
has body: I am getting java.lang.NoSuchFieldError: com/ibm/ws/ssl/core/Constants.ALL_PROTOCOLS while trying to create a jms Connection from the ConnectionFactory. Googled a lot but did not find a proper solution. Are some jars missing? I have configured the JMS resources in Websphere Application Server 8. I have already added - com.ibm.ws.admin.client_8.0.0.jar com.ibm.ws.messagingClient.jar com.ibm.ws.runtime.jar com.ibm.ws.sib.client_ExpeditorDRE_8.0.0.jar com.ibm.ws.sib.client.thin.jms_8.0.0.jar com.ibm.xml.thinclient_8.0.0.jar PFB my code and stack trace: package com.jms.test; import java.util.Hashtable; import javax.jms.Connection; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.MessageConsumer; import javax.jms.Queue; import javax.jms.QueueConnectionFactory; import javax.jms.Session; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class Demo { public static void main(String[] args) throws NamingException { System.out.println("Start....."); Hashtable environment = new Hashtable(); environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); environment.put(Context.PROVIDER_URL, "iiop://localhost:2810"); //String pUrl = System.getProperty(Context.PROVIDER_URL); //System.out.println("*******"+pUrl+"********"); InitialContext initContext = new InitialContext(environment); System.out.println("Init Done"); QueueConnectionFactory qConFac = (QueueConnectionFactory)initContext.lookup("jms/queueConnectionFactory"); System.out.println("Connection Factory is - "+qConFac.toString()); Queue queue = (Queue) initContext.lookup("jms/inQueue"); System.out.println("Queue is - "+queue.toString()); initContext.close(); Connection connection = null; Session session = null; MessageConsumer consumer = null; Message message = null; try { connection = qConFac.createConnection(); /*session = connection.createSession(false, Session.AUT…

java
tags question: http://stackoverflow.com/q/26833693
tags question: http://stackoverflow.com/q/26969080
tags question: http://stackoverflow.com/q/26943085
tags question: http://stackoverflow.com/q/26897368
tags question: http://stackoverflow.com/q/26945429
tags question: http://stackoverflow.com/q/26923375
tags question: http://stackoverflow.com/q/26952414
tags question: http://stackoverflow.com/q/26847014
tags question: http://stackoverflow.com/q/26909595
tags question: http://stackoverflow.com/q/26948591
tags question: http://stackoverflow.com/q/26974251
tags question: http://stackoverflow.com/q/26939628
tags question: http://stackoverflow.com/q/26880584
tags question: http://stackoverflow.com/q/26872087
tags question: http://stackoverflow.com/q/26975530
tags question: http://stackoverflow.com/q/26876744
tags question: http://stackoverflow.com/q/26889258
tags question: http://stackoverflow.com/q/26963635
tags question: http://stackoverflow.com/q/26900282
tags question: http://stackoverflow.com/q/26847309
tags question: http://stackoverflow.com/q/26879503
tags question: http://stackoverflow.com/q/26936932
tags question: http://stackoverflow.com/q/26858419
tags question: http://stackoverflow.com/q/26945034
tags question: http://stackoverflow.com/q/26892023
tags question: http://stackoverflow.com/q/26956258
tags question: http://stackoverflow.com/q/26862289
tags question: http://stackoverflow.com/q/26841762
tags question: http://stackoverflow.com/q/26865757
tags question: http://stackoverflow.com/q/26943681
tags question: http://stackoverflow.com/q/26957369
tags question: http://stackoverflow.com/q/26859926
tags question: http://stackoverflow.com/q/26929259
tags question: http://stackoverflow.com/q/26957315
tags question: http://stackoverflow.com/q/26940410
tags question: http://stackoverflow.com/q/26920142
tags question: http://stackoverflow.com/q/26903213
tags question: http://stackoverflow.com/q/26898304
tags question: http://stackoverflow.com/q/26976370
tags question: http://stackoverflow.com/q/26841699
tags question: http://stackoverflow.com/q/26930651
tags question: http://stackoverflow.com/q/26922275
tags question: http://stackoverflow.com/q/26837850
tags question: http://stackoverflow.com/q/26991291
tags question: http://stackoverflow.com/q/26950873
tags question: http://stackoverflow.com/q/26876585
tags question: http://stackoverflow.com/q/26850635
tags question: http://stackoverflow.com/q/26894590
tags question: http://stackoverflow.com/q/26894670
tags question: http://stackoverflow.com/q/26987951
tags question: http://stackoverflow.com/q/26870890
tags question: http://stackoverflow.com/q/26887182
tags question: http://stackoverflow.com/q/26835266
tags question: http://stackoverflow.com/q/26939216
tags question: http://stackoverflow.com/q/26871466
tags question: http://stackoverflow.com/q/26868964
tags question: http://stackoverflow.com/q/26963887
tags question: http://stackoverflow.com/q/26982578
tags question: http://stackoverflow.com/q/26892452
tags question: http://stackoverflow.com/q/26864638
tags question: http://stackoverflow.com/q/26871069
tags question: http://stackoverflow.com/q/26966159
tags question: http://stackoverflow.com/q/26953750
tags question: http://stackoverflow.com/q/26977037
tags question: http://stackoverflow.com/q/26859014
tags question: http://stackoverflow.com/q/26989784
tags question: http://stackoverflow.com/q/26927113
tags question: http://stackoverflow.com/q/26942842
tags question: http://stackoverflow.com/q/26907410
tags question: http://stackoverflow.com/q/26864092
tags question: http://stackoverflow.com/q/26851469
tags question: http://stackoverflow.com/q/26841395
tags question: http://stackoverflow.com/q/26959735
tags question: http://stackoverflow.com/q/26986908
tags question: http://stackoverflow.com/q/26927480
tags question: http://stackoverflow.com/q/26953956
tags question: http://stackoverflow.com/q/26838753
tags question: http://stackoverflow.com/q/26853139
tags question: http://stackoverflow.com/q/26885375
tags question: http://stackoverflow.com/q/26878657

http://stackoverflow.com/q/26979476
score: 8
favorite count: 0
has body: By default isn't it supposed to be under the actionbar? So what am I doing wrong? @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; } res/menu/main.xml <item android:id="@+id/action_settings" android:orderInCategory="100" android:title="@string/action_settings" app:showAsAction="never"/>
has answer: http://stackoverflow.com/a/27347498
tagged with: android
tagged with: android-actionbar
has comment: http://stackoverflow.com/comment/43149548
downvote count: 1
has answer: http://stackoverflow.com/a/27347470
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27347463
type: Question
upvote count: 9
possible better answer: http://stackoverflow.com/a/27347498
linked to: http://stackoverflow.com/q/27116325
has answer: http://stackoverflow.com/a/27364324
has answer: http://stackoverflow.com/a/27347463
has comment: http://stackoverflow.com/comment/43149629
has title: Why is my overflow dropdown menu on top of the actionbar?
answer count: 4

http://stackoverflow.com/comment/65177530
type: Comment
has text: @PepaZapletal have you found anything realted to it ?
type: AnswerComment
comment on: http://stackoverflow.com/a/26916256
score: 0

http://stackoverflow.com/comment/42504208
comment on: http://stackoverflow.com/q/26985356
type: Comment
type: QuestionComment
has text: have you looked at `DrawerListener` http://developer.android.com/reference/android/support/v4/widget/DrawerLayout.DrawerListener.html
score: 1

http://stackoverflow.com/q/26869659
accepted answer: http://stackoverflow.com/a/26869784
tagged with: series
has comment: http://stackoverflow.com/comment/42298431
has comment: http://stackoverflow.com/comment/42300691
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42300207
upvote count: 1
has answer: http://stackoverflow.com/a/26869784
type: AnsweredQuestion
has body: I have been trying to set a bunch of data (numbers) in a variable, then tried to set this variable into an array so that I don't to change those variables every time I run the programme (the user inputs data, and this data is stored into one variable. My array takes the variable as a set of data). I have been asked to do it and the output console doesn't seem to give me what I need. Here is my code: import java.util.*; public class CalculTempsSelonDonneesDemandees { public static void main(String args[]) { double t0,h,n=1,b; double t; Scanner sc = new Scanner(System.in); System.out.println("Initial time : "); t0=sc.nextDouble(); System.out.println("Variation : "); h=sc.nextDouble(); System.out.println("Nomber of terms : "); b=sc.nextDouble(); while(b!=n-1) { t=(t0+(n-1)*h); n++; double tblT[] = {t}; System.out.print(t+" "); } } } Basically, the user enters an intitial time, a variation of time then how many terms the user wants in his series. It displays the times from that initial time and it stops when the number of terms is different than n (it's like an arithmetic series). When I run it, it displays t, the times. But how do I know the values of t are set in the array? Thank you very much for your help!
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42298316
type: Question
has title: How to set one variable of data in an array
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42298269

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/26941740
tags question: http://stackoverflow.com/q/26991708
tags question: http://stackoverflow.com/q/26873592
tags question: http://stackoverflow.com/q/26876749
tags question: http://stackoverflow.com/q/26934878
tags question: http://stackoverflow.com/q/26941621
tags question: http://stackoverflow.com/q/26969188
tag name: jfreechart

http://stackoverflow.com/a/26863628
answers question: http://stackoverflow.com/q/26863223
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42287045
type: Answer
downvote count: 0
has body: Ok I see your problem. You are running it on the UI thread. Create an AsyncTask and run it there. When the tash is complete use the runOnUIThread method to display the contacts.
score: 1
accepted answer of: http://stackoverflow.com/q/26863223

http://stackoverflow.com/comment/42375974
comment on: http://stackoverflow.com/a/26912127
score: 0
type: AnswerComment
type: Comment
has text: added a clarification

http://stackoverflow.com/q/26970016
answer count: 1
has title: GXT : Find cell's value in a grid by coordinates
type: AnsweredQuestion
tagged with: java
tagged with: gxt
has body: I have the coordinates of the cell (row, column indexes) of a grid. How can I retrieve the cell's value? I don't want to retrieve the whole row, just that one cell with (x,y) coordinates. I'm using gwt 2.6.1, gxt 3.x
has answer: http://stackoverflow.com/a/26975984
tagged with: grid
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/26975984
score: 0

http://stackoverflow.com/q/26835229
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
has body: I'm following this tutorial to build an Android app with an App Engine backend. When I right click the Android project and select Generate App Engine Backend, I get the following error: 'Generating App Engine Backend' has encountered a problem. Nothing is displayed in the console. No AppEngine project is created and there are no errors in the Android project. I'm using Eclipse 4.2 Juno, Windows 7 x64, App Engine SDK 1.9.15, GPE 3.8.0 and Java 1.8.0_25. I've searched for this problem and it seems like it was happening for Windows users some time ago but it was apparently fixed. How can I solve this issue? Thanks in advance.
type: Question
downvote count: 0
has title: 'Generating App Engine Backend' error in Eclipse
favorite count: 0
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android

http://stackoverflow.com/a/26975229
has comment: http://stackoverflow.com/comment/42486026
has comment: http://stackoverflow.com/comment/42666490
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42486179
upvote count: 3
type: Answer
accepted answer of: http://stackoverflow.com/q/26974916
answers question: http://stackoverflow.com/q/26974916
has comment: http://stackoverflow.com/comment/42486128
has body: Yes, what you ask is possible using two different ClassLoaders. You need to compile your classes (Parent, Child1 and Child2), but they should not be in the same classpath location as the class you're invoking them from (call that class Main). Instead, put them somewhere on your disk in a directory or put them in a jar file. From that location, you can create multiple classloaders, and you can use the method loadClass to load classes with it; and you can use reflection to invoke methods, like the method run on it. import java.lang.reflect.*; import java.net.URL; public class Main { public static void main(String[] args) throws Exception { URL childAndParentClassesLocation = new URL("c:/Somewhere/On/Your/Disk"); ClassLoader cl1 = new URLClassLoader(new URL[] { childAndParentClassesLocation }, Main.class.getClassLoader()); ClassLoader cl2 = new URLClassLoader(new URL[] { childAndParentClassesLocation }, Main.class.getClassLoader()); Class child1 = cl1.loadClass("packagename.Child1"); Class child2 = cl2.loadClass("packagename.Child2"); Method child1Run = child1.getMethod("run"); Method child2Run = child2.getMethod("run"); child1Run.invoke(null); // Invoke run method on Child1 child2Run.invoke(null); // Invoke run method on Child2 } } P.s. this is bad design for a general purpose application, but you didn't say you were making a general-purpose application. So I don't see any reason to dumb down SO by dissuading interesting questions that help explain how the JVM works.
score: 3
downvote count: 0

visualvm
tags question: http://stackoverflow.com/q/26840134
type: Tag
tags question: http://stackoverflow.com/q/26834651
tag name: visualvm
tags question: http://stackoverflow.com/q/26832378

http://stackoverflow.com/comment/42312335
type: QuestionComment
comment on: http://stackoverflow.com/q/26876405
score: 1
type: Comment
has text: Choose a dedicated folder on the deployed server and put them there. This can be any directory your app has write access to, ex. `/home/some-user/app-name/dir`.

http://stackoverflow.com/comment/69600625
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/41200608
type: Comment
has text: rand: random number generator

http://stackoverflow.com/q/26872923
tagged with: c#
duplicate of: http://stackoverflow.com/q/3465465
has comment: http://stackoverflow.com/comment/42304210
has title: Why in Java throwing and catching exceptions is mandatory and in C# is not?
score: 0
has comment: http://stackoverflow.com/comment/42304360
answer count: 1
has comment: http://stackoverflow.com/comment/42304146
has comment: http://stackoverflow.com/comment/42303937
has answer: http://stackoverflow.com/a/26873119
tagged with: exception
has comment: http://stackoverflow.com/comment/42304086
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42304370
tagged with: java
linked to: http://stackoverflow.com/q/3465465
has body: I wrote two corresponding codes in C# and Java: class Class { public static void f() { throw new Exception("error"); } } class Program { static void Main(string[] args) { Klasa.f(); } } class Class { public static void f() throws Exception { throw new Exception("error"); } } class Program { public static void main(String[] args) { try { Klasa.f(); } catch (Exception e) { e.printStackTrace(); } } } In Java we are obligate to throw exception outside the method (if it's not handled in it) and catch an exception while using this kind of methods. On the other hand, C# doesn't forced us to do so. Why? Which approach is better? Can we push C# to works as Java here?
has comment: http://stackoverflow.com/comment/42304327
type: Question
tagged with: try-catch

http://stackoverflow.com/a/26862029
has comment: http://stackoverflow.com/comment/42303844
accepted answer of: http://stackoverflow.com/q/26861945
answers question: http://stackoverflow.com/q/26861945
type: AcceptedAnswer
downvote count: 0
has body: Don't override paint, you've broken the paint chain which will affect the ability of the panel to paint it's children. Override paintComponent AND call super.paintComponent before performing any custom painting Don't dispose of a Graphics context that you didn't create, this could prevent other components from been painted. Don't add components within the paint methods, these methods can be called within quick succession and randomly. Instead, add the components within the constructor
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/42293509
score: 3

http://stackoverflow.com/comment/42281614
score: 0
has text: Where does the exception you show get printed? Did you try debugging?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26860472

http://stackoverflow.com/comment/91541067
comment on: http://stackoverflow.com/a/27222613
type: AnswerComment
has text: May i ask how did you change oid type to bytea?
score: 0
type: Comment

http://stackoverflow.com/comment/42367256
comment on: http://stackoverflow.com/a/26900653
type: AnswerComment
type: Comment
score: 0
has text: Thanks for answering, StoneBird. I tried your solution but with @Pr39y's answer of making the isViewed an array equal to numberOfPages.size() and it only makes the last save button show and not all previous ones after the last one is shown.

http://stackoverflow.com/comment/43389479
type: Comment
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/27473412
has text: Thanks for your answer! I understand network file systems behave unpredictable. For me the Javadoc sounds pretty strict though. So either the Javadoc is correct and it is guaranteed that the check and file creation is atomic (at least for local file systems) or it is not and the Javadoc is wrong and should be reformulated (e.g. _on a best effort basis_…). Adding a rather unspecific note should not invalidate the guarantees made before…

http://stackoverflow.com/comment/42235715
comment on: http://stackoverflow.com/a/26834862
type: Comment
has text: Ok will do but i orginally had my code to have all classes do this : this.rate = rate; this.years = years. I know that in the above it must be this.rate2 = rate; and this.rate3 = rate; correct? or am i missing something? But still with all these variables assignments i have flipped, put back, destroyed, re created, made more but my compound and loan stay at 0.0
score: 0
type: AnswerComment

http://stackoverflow.com/a/26978746
has body: It is hard to say without knowing more details about your solution. A Karnaugh map may help you.
has comment: http://stackoverflow.com/comment/42491943
has comment: http://stackoverflow.com/comment/42492037
answers question: http://stackoverflow.com/q/26978601
score: -1
has comment: http://stackoverflow.com/comment/42492043
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/42492086

http://stackoverflow.com/comment/42279283
comment on: http://stackoverflow.com/a/26859067
type: AnswerComment
score: 0
type: Comment
has text: @user1407668 Arrays.asList expects one or more objects as input. When you pass it an array of primitives, there is only one object - the array itself.

http://stackoverflow.com/a/26857818
score: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42277215
answers question: http://stackoverflow.com/q/26857669
has body: Call super.onBackPressed(); do not remove @override. @Override public void onBackPressed() { super.onBackPressed(); AppBrain.getAds().maybeShowInterstitial(this); finish(); } As mentioned on the link you have provided.
type: Answer
upvote count: 1

http://stackoverflow.com/a/26914656
type: Answer
accepted answer of: http://stackoverflow.com/q/26914623
score: 7
upvote count: 7
has body: You should declare them first. public static void main(String[] args)throws Exception { DataOutputStream out = null; DataInputStream in = null; try{ out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("dec.dat"))); in = new DataInputStream(new BufferedInputStream(new FileInputStream("enc.dat"))); String enc=in.readUTF(); System.out.println(enc); }catch(EOFException e){ } }
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26914623

http://stackoverflow.com/a/26964821
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26964811
upvote count: 2
has body: You need to call rootView.findViewById since android does not yet to know where to search. For more explanation: Probably (not to judge ofc) you are familiar to call findViewById in the method onCreate of an Activity, but before that you did call setContentView. After setting the content by setContentView android knows where to search for the id when you call findViewById. That is for the case when you are using activity. On the other hand, with fragments it is a different case. You won't be setting the content by setContentView, instead you have to prepare a view and return it on onCreateView and let the android set the content as it wishes. Be careful, on lines you are calling findViewById above there, you haven't return the view yet, so android does not know where to search as you call findViewById. So you have to make your searches not on not-set-yet-content, but on the rootView you are just about to return. So above the code is the solution to this well described problem.
type: Answer

http://stackoverflow.com/a/26927408
upvote count: 9
has body: Set:add is not supposed to give you an error when you try to add a value already in the Set. It will just return false and not add the value to the Set. Check the JavaDoc: boolean add(E e) Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that (e==null ? e2==null : e.equals(e2)). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.
downvote count: 0
answers question: http://stackoverflow.com/q/26927381
type: Answer
score: 9

http://stackoverflow.com/comment/42374470
has text: @peter.petrov Are you sure that there are no temporary spikes in the disk space/inodes used? I see that the file is in directory `processeddir` so I suppose this might be the case. Perhaps you can check the number of files/used space in directory when catching the exception.
comment on: http://stackoverflow.com/q/26912219
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26888703
accepted answer: http://stackoverflow.com/a/26889380
linked to: http://stackoverflow.com/q/26307760
duplicate of: http://stackoverflow.com/q/19536513
possible better answer: http://stackoverflow.com/a/26909113
has answer: http://stackoverflow.com/a/26909113
has title: does my batch really execute as expected if autocommit is set to true?
downvote count: 0
has body: I am making a request SQL to commit some updates. The updates are done and good, but I would like to know if the batch is executed properly , ie are the statements commited in one go or do the statement excute one after the other ? This is because the autocommit is set implicitly to true, and I wonder if, for the batch to execute as a real "batch", I have to set it to false. this is a question in relation with this one: do I need a connection.commit() after executeBatch()? The code is: private void pdate(JdbcTemplate jdbcTemplate, List&lt;Long&gt; saisineIdsToUpdate,Connection connection) throws SQLException { String sqlUpdate = "UPDATE SAISINES SAI WHERE SAI.IDSAISINE = ?"; //request simplified PreparedStatement psUpdate = connection.prepareStatement(sqlUpdate); for (Long saisineId : saisineIdsToUpdate) { psUpdate.setLong(1, saisineId ); psUpdate.addBatch(); } psUpdate.executeBatch(); psUpdate.close(); }
favorite count: 0
tagged with: jdbc
linked to: http://stackoverflow.com/q/26888272
type: AnsweredQuestion
tagged with: transactions
tagged with: java
tagged with: prepared-statement
type: Question
has answer: http://stackoverflow.com/a/26889380
answer count: 2
score: 5
linked to: http://stackoverflow.com/q/19536513
upvote count: 5

http://stackoverflow.com/a/26967483
type: Answer
downvote count: 0
has body: Scala's Array[T] is exactly represented as Java's T[], there's no overhead. They generate the same bytecode. You additionally have the operations provided by ArrayOps, but it is an implicit conversion, which does not affect the pure Array[T] representation.
score: 7
answers question: http://stackoverflow.com/q/26967047
accepted answer of: http://stackoverflow.com/q/26967047
upvote count: 7
type: AcceptedAnswer

http://stackoverflow.com/comment/42482173
has text: Technically, because of type erasure, you need Class<X> parameters for casting to X and maybe instantiation of X objects. Type erasure means no overhead, just the compiler might sometimes add a class cast check for a known actual type value for a generic type. Even that is compensated with the need for manual type checks when not using generics. It is a favor to us all using generics. The software engineering disadvantage: it is implemented as class parameters only (1), with names, by convention a single capital (2), which when passed to other classes becomes a bit muddy. Java 8 showing that.
comment on: http://stackoverflow.com/q/26973067
type: QuestionComment
type: Comment
score: 1

spring-mvc
tags question: http://stackoverflow.com/q/26879376
tags question: http://stackoverflow.com/q/26861848
tags question: http://stackoverflow.com/q/26916102
tags question: http://stackoverflow.com/q/26939483
tags question: http://stackoverflow.com/q/26910930
tags question: http://stackoverflow.com/q/26939585
tags question: http://stackoverflow.com/q/26907296
tags question: http://stackoverflow.com/q/26923907
tags question: http://stackoverflow.com/q/26929048
tags question: http://stackoverflow.com/q/26926193
tags question: http://stackoverflow.com/q/26834662
tags question: http://stackoverflow.com/q/26990865
tags question: http://stackoverflow.com/q/26844497
tags question: http://stackoverflow.com/q/26978044
tags question: http://stackoverflow.com/q/26971454
tags question: http://stackoverflow.com/q/26893657
tags question: http://stackoverflow.com/q/26972988
tags question: http://stackoverflow.com/q/26914644
tags question: http://stackoverflow.com/q/26927717
tags question: http://stackoverflow.com/q/26920040
tags question: http://stackoverflow.com/q/26979216
tags question: http://stackoverflow.com/q/26906789
tags question: http://stackoverflow.com/q/26931346
tags question: http://stackoverflow.com/q/26885301
tags question: http://stackoverflow.com/q/26892429
tags question: http://stackoverflow.com/q/26964688
tags question: http://stackoverflow.com/q/26939050
tags question: http://stackoverflow.com/q/26869641
tags question: http://stackoverflow.com/q/26860498
tags question: http://stackoverflow.com/q/26906885
tags question: http://stackoverflow.com/q/26857086
tags question: http://stackoverflow.com/q/26845808
tags question: http://stackoverflow.com/q/26976401
tags question: http://stackoverflow.com/q/26987343
tags question: http://stackoverflow.com/q/26973349
tags question: http://stackoverflow.com/q/26967752
tags question: http://stackoverflow.com/q/26915792
tags question: http://stackoverflow.com/q/26869951
tags question: http://stackoverflow.com/q/26936721
tags question: http://stackoverflow.com/q/26912744
tags question: http://stackoverflow.com/q/26889057
tag name: spring-mvc
tags question: http://stackoverflow.com/q/26843764
tags question: http://stackoverflow.com/q/26933374
tags question: http://stackoverflow.com/q/26897008
tags question: http://stackoverflow.com/q/26886824
tags question: http://stackoverflow.com/q/26958469
tags question: http://stackoverflow.com/q/26979120
tags question: http://stackoverflow.com/q/26978734
tags question: http://stackoverflow.com/q/26953729
tags question: http://stackoverflow.com/q/26975655
tags question: http://stackoverflow.com/q/26911184
tags question: http://stackoverflow.com/q/26961600
tags question: http://stackoverflow.com/q/26946218
tags question: http://stackoverflow.com/q/26932187
tags question: http://stackoverflow.com/q/26890727
tags question: http://stackoverflow.com/q/26958354
tags question: http://stackoverflow.com/q/26850059
tags question: http://stackoverflow.com/q/26849005
tags question: http://stackoverflow.com/q/26902895
tags question: http://stackoverflow.com/q/26990694
type: Tag
tags question: http://stackoverflow.com/q/26981227
tags question: http://stackoverflow.com/q/26945571
tags question: http://stackoverflow.com/q/26840399
tags question: http://stackoverflow.com/q/26851488
tags question: http://stackoverflow.com/q/26990120
tags question: http://stackoverflow.com/q/26968877
tags question: http://stackoverflow.com/q/26904781
tags question: http://stackoverflow.com/q/26863231
tags question: http://stackoverflow.com/q/26864957
tags question: http://stackoverflow.com/q/26954682
tags question: http://stackoverflow.com/q/26987277
tags question: http://stackoverflow.com/q/26890398
tags question: http://stackoverflow.com/q/26840016
tags question: http://stackoverflow.com/q/26892452
tags question: http://stackoverflow.com/q/26874395
tags question: http://stackoverflow.com/q/26848496
tags question: http://stackoverflow.com/q/26864045
tags question: http://stackoverflow.com/q/26913087

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

http://stackoverflow.com/q/26913572
upvote count: 1
has answer: http://stackoverflow.com/a/26913726
favorite count: 0
has body: public static void main(String[] args) { Scanner user_input = new Scanner(System.in); int i; int n; String a; System.out.println("Enter the Class:"); a = user_input.next(); System.out.println("Enter the number of Students:"); n = user_input.nextInt(); for (i= 1; i &lt;= n; i++) { String g = a + i; System.out.println(g); } } This is my program. It gets user input for the Class and prints the Roll Number for the students. For example: If the class is 10A and the number of students is 10, it prints a series like 10A1 , 10A2, 10A3 ... 10A10 How do I get the program to store these as elements in an array? For example: array[0] = 10A1; array[1] = 10A2; array[2] = 10A3; etc.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26913747
has answer: http://stackoverflow.com/a/26913718
answer count: 4
has title: How do I add user input to an Array in java?
tagged with: java
has answer: http://stackoverflow.com/a/26913927
downvote count: 1
type: Question
tagged with: arrays
score: 0

http://stackoverflow.com/a/37286869
answers question: http://stackoverflow.com/q/26856917
type: Answer
has body: Confusion matrices are just complicated enough that it is worth looking into an open source solution. One that easily be integrated into code without adding tons of unnecessary extras is here. Other data science / nlp packages also have implementations as part of their distribution and even if using the entire library is too much the source files can give guidance as to how to do it. The benefit of using one of these is that they also give you some metrics for free as well as being a placeholder matrix, such as Cohen's Kappa measure and the more basic precision / recall / and F-measure scores.
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/26961190
has comment: http://stackoverflow.com/comment/42460727
type: AnsweredQuestion
tagged with: java
tagged with: fade
type: Question
has body: I am making a game and want to have a single image 'fade' from left to right with the left part of the image having an alpha of 1.0 and the right having an alpha of 0.0. (note: I do not want it to be changing what it looks like over time, like fading in or out, but just fading from left to right and staying constant). An attempt to draw what I want the end result to look like is below: lll lll ll ll l l l l l lll lll ll ll l l l l l lll lll ll ll l l l l l lll lll ll ll l l l l l lll lll ll ll l l l l l lll lll ll ll l l l l l Where the densities of the 'l's represent the alpha I am currently using Buffered Images of TYPE_INT_RGB, and would like to keep that the same if possible. Is there any built in java classes that can help me do this, or at least a (relatively easy) way to do this myself that I just can't figure out? EDIT: I don't want to have an opaque frame of any sort. I want to draw one BufferedImage (with alpha gradient) onto another BufferedImage.
tagged with: alpha
favorite count: 0
has title: Can I have image alpha fade from left to right in java?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26962173
has comment: http://stackoverflow.com/comment/42460783
upvote count: 1
linked to: http://stackoverflow.com/q/6766190
tagged with: bufferedimage
downvote count: 1
accepted answer: http://stackoverflow.com/a/26962173

http://stackoverflow.com/comment/42511511
comment on: http://stackoverflow.com/q/26989933
score: 0
type: Comment
type: QuestionComment
has text: Is it installed at the correct place? Some applications have the weird behaviour on OSX that it looks for apples older Java installation, or for Oracles - but not both.

http://stackoverflow.com/comment/42286556
type: Comment
has text: There is no any issue with his delete query.
score: 0
comment on: http://stackoverflow.com/a/26863452
type: AnswerComment

http://stackoverflow.com/q/26872164
has body: We are running a tomcat server with connection pooling and have recently been getting this error randomly. It happens when we go to run a stored procedure in a package randomly. I have tried to do some research into the problem myself, which lead to the source of this Java class which is where I assume the error is being dumped from: http://ora-jdbc-source.googlecode.com/svn/trunk/OracleJDBC/src/oracle/jdbc/driver/T2CCallableStatement.java My question is: What is accessor type number 9? It's not defined in the example class I provided, but whoever wrote that class obviously had to have a list of accessors and their corresponding numbers, of which I would like to see if possible, but have been unable to find. I also have found other accessor type numbers in the error logs, for example: 6 has shown up also. Update: I found a page detailing the datatypes and their code values, but datatype 6 and 9 apparently don't exist, making this error even weirder: https://docs.oracle.com/cd/E11882_01/appdev.112/e10646/oci03typ.htm#LNOCI030
possible better answer: http://stackoverflow.com/a/31660763
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/31660763
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26997278
has title: Internal Error: Unknown or unimplemented accessor type: 9
tagged with: oracle11g
type: Question
answer count: 2
downvote count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/26997278
favorite count: 0
tagged with: oracle-database
tagged with: multithreading

hibernate
tags question: http://stackoverflow.com/q/26886904
tags question: http://stackoverflow.com/q/26859992
tags question: http://stackoverflow.com/q/26978332
tags question: http://stackoverflow.com/q/26969991
tags question: http://stackoverflow.com/q/26866466
tags question: http://stackoverflow.com/q/26970644
tags question: http://stackoverflow.com/q/26854213
tags question: http://stackoverflow.com/q/26983509
tags question: http://stackoverflow.com/q/26975806
tags question: http://stackoverflow.com/q/26878396
tags question: http://stackoverflow.com/q/26922787
tags question: http://stackoverflow.com/q/26904611
tags question: http://stackoverflow.com/q/26874395
tags question: http://stackoverflow.com/q/26918098
tags question: http://stackoverflow.com/q/26981379
tags question: http://stackoverflow.com/q/26968721
tags question: http://stackoverflow.com/q/26859137
tags question: http://stackoverflow.com/q/26848496
tags question: http://stackoverflow.com/q/26880021
tags question: http://stackoverflow.com/q/26870346
tags question: http://stackoverflow.com/q/26914438
tags question: http://stackoverflow.com/q/26838327
tags question: http://stackoverflow.com/q/26962589
tags question: http://stackoverflow.com/q/26948403
tags question: http://stackoverflow.com/q/26977173
tags question: http://stackoverflow.com/q/26891009
tags question: http://stackoverflow.com/q/26967517
tags question: http://stackoverflow.com/q/26841382
tags question: http://stackoverflow.com/q/26878870
tags question: http://stackoverflow.com/q/26960325
tags question: http://stackoverflow.com/q/26933458
tags question: http://stackoverflow.com/q/26989906
tags question: http://stackoverflow.com/q/26842986
tags question: http://stackoverflow.com/q/26870238
tags question: http://stackoverflow.com/q/26911883
tags question: http://stackoverflow.com/q/26931194
tags question: http://stackoverflow.com/q/26986518
tags question: http://stackoverflow.com/q/26938048
tags question: http://stackoverflow.com/q/26880126
tags question: http://stackoverflow.com/q/26957419
tags question: http://stackoverflow.com/q/26847008
tags question: http://stackoverflow.com/q/26926503
tags question: http://stackoverflow.com/q/26926042
tags question: http://stackoverflow.com/q/26882965
tags question: http://stackoverflow.com/q/26988607
tags question: http://stackoverflow.com/q/26840090
tags question: http://stackoverflow.com/q/26851096
tags question: http://stackoverflow.com/q/26991397
tags question: http://stackoverflow.com/q/26866069
tags question: http://stackoverflow.com/q/26836345
tags question: http://stackoverflow.com/q/26864627
tags question: http://stackoverflow.com/q/26837949
tags question: http://stackoverflow.com/q/26865908
tags question: http://stackoverflow.com/q/26990090
tags question: http://stackoverflow.com/q/26880633
tags question: http://stackoverflow.com/q/26880163
tags question: http://stackoverflow.com/q/26882717
tags question: http://stackoverflow.com/q/26836197
tags question: http://stackoverflow.com/q/26951322
tags question: http://stackoverflow.com/q/26897556
tag name: hibernate
tags question: http://stackoverflow.com/q/26903213
tags question: http://stackoverflow.com/q/26876585
tags question: http://stackoverflow.com/q/26907410
tags question: http://stackoverflow.com/q/26927480
tags question: http://stackoverflow.com/q/26881739
tags question: http://stackoverflow.com/q/26849057
tags question: http://stackoverflow.com/q/26934220
tags question: http://stackoverflow.com/q/26842258
tags question: http://stackoverflow.com/q/26868661
tags question: http://stackoverflow.com/q/26916239
tags question: http://stackoverflow.com/q/26889015
tags question: http://stackoverflow.com/q/26847634
tags question: http://stackoverflow.com/q/26939003
tags question: http://stackoverflow.com/q/26903186
tags question: http://stackoverflow.com/q/26906324
tags question: http://stackoverflow.com/q/26971483
tags question: http://stackoverflow.com/q/26966748
tags question: http://stackoverflow.com/q/26984496
tags question: http://stackoverflow.com/q/26915409

http://stackoverflow.com/a/26942900
has comment: http://stackoverflow.com/comment/42429094
answers question: http://stackoverflow.com/q/26942892
has body: I'm not 100% sure of your question, but gc is a Graphics object that is obtained from the BufferedImage. If you call gc.setColor(...) it will by itself do nothing to the BufferedImage, but if you then use the gc object to say draw a line, the line will be drawn on the BufferedImage, and in the color that gc was set to.
has comment: http://stackoverflow.com/comment/42429388
score: 0
has comment: http://stackoverflow.com/comment/42429074
has comment: http://stackoverflow.com/comment/42429399
has comment: http://stackoverflow.com/comment/42429340
type: Answer

http://stackoverflow.com/comment/42401437
comment on: http://stackoverflow.com/q/26924952
has text: @BasilBourque thank you for marking as dupe. now it is possible?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26842584
has comment: http://stackoverflow.com/comment/42347153
tagged with: dependency-injection
tagged with: serviceloader
score: 0
has body: I'm working on a plugin for a 3rd party software that is quite undocumented. For the plugin I'm using a external lib (.jar) managed by maven and is later on executed on a tomcat server. Everything was working great till I updated to the latest release of the library, which now is using java.util.serviceLoader in order to load a concrete implementation of a interface. When build, my project has this package structure on a tomcat server: mypluginPackage.jar | ---META-INF ---lib | --- theExternalLibUsingServiceLoader.jar | ---META-INF | ---services | --- full.path.to.TheFactoryInterface ---external.lib.path | --- TheFactoryInterface.class --- TheConreteClass.class --- mypluginCore.jar | ---META-INF --- my.plugin.path | --- MyClassUsingTheExternalLib.class As you can see, the external library has the correct services entry which is necessary for the serviceLoader to find the concrete of a interface within META-INF. The content of the full.path.to.TheFactoryInterface file is full.path.to.TheConcreteClass, which seems legit. My plugin (package as well as the core) however do not have any of those META-INF information. What happens now is that every time my plugin is using a method that will trigger the serviceLoader of the external library, the serviceLoader is unable to find the concrete implementation. What I already tried is adding the exact same services/full.path.to.TheFactoryInterface to all my META-INF directories, which is not working (I guess I would need to change the content of the full.path.to.TheFactoryInterface file but I'm not sure - because of the undocumented plugin structure for the 3rd party software - what the right (relative) path would look like). Can anybody give me a shot what I'm doing wrong here and how to fix it so the concrete class is found by serviceLoader? What META-INF folder should the services folder with it's content be placed in and should I change the paths? Is that the error at all or am I missing something compleatly different? I und…
answer count: 1
has comment: http://stackoverflow.com/comment/42329811
has title: How to make Java serviceLoader of a external library work
has answer: http://stackoverflow.com/a/26904304
tagged with: maven
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42334754
type: Question
accepted answer: http://stackoverflow.com/a/26904304

autowired
tags question: http://stackoverflow.com/q/26858611
tags question: http://stackoverflow.com/q/26987268
tags question: http://stackoverflow.com/q/26928425
tags question: http://stackoverflow.com/q/26889970
type: Tag
tag name: autowired

http://stackoverflow.com/comment/42391128
type: AnswerComment
comment on: http://stackoverflow.com/a/26921526
type: Comment
has text: Yes it is Java. But that code isnt something Im looking for. I need to know why the counter++; in a method isnt working the main method. I have it initialized to 0 in the main method also.
score: 0

http://stackoverflow.com/comment/42469013
comment on: http://stackoverflow.com/q/26965788
score: 0
type: Comment
type: QuestionComment
has text: Is `k` a class member? It sounds like you need `k` to be threadsafe, so you should use `AtomicInteger`. See [Jon Skeet's answer here]( http://stackoverflow.com/questions/9278764/are-primitive-datatypes-thread-safe-in-java)

http://stackoverflow.com/q/26850028
has answer: http://stackoverflow.com/a/26853989
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/18941539
linked to: http://stackoverflow.com/q/3177733
has answer: http://stackoverflow.com/a/26850814
upvote count: 2
accepted answer: http://stackoverflow.com/a/26850814
answer count: 3
tagged with: sql
has title: Executing a SQL command and outputting results in a JSP page
tagged with: jsp
tagged with: oracle12c
favorite count: 0
tagged with: jdbc
has body: I am trying to connect to a database, execute a select statement, and then output the results of that statement in a JSP page. I have been able to connect to the DB, and (I think) execute the command, but either my ResultSet has nothing in it, or I am not displaying the results properly. I have looked at some examples of how this is done, and my code is pretty much identical. When I run the code the resulting web page only has these empty lines where the output data should be. It does however, have three rows of empty lines, which is the number of tuples the query should return. My code is: String query = "SELECT L.O_ID, L.INV_ID, L.OL_QUANTITY, L.OL_PRICE " + "FROM ORDERS O, ORDER_LINE L, ORDERSOURCE S " + "WHERE S.OS_DESC = 'Web Site' " + "AND O.OS_ID = S.OS_ID " + "AND L.O_ID = O.O_ID"; System.out.println(query); ResultSet results = statement.executeQuery(query); %> Order ID Inventory ID Quantity Price <%while(results.next()) { %> <% results.getString("O_ID"); %> <% results.getString("INV_ID"); %> <% results.getString("OL_QUANTITY"); %> <% results.getString("OL_PRICE"); %> <% } %> Also, when I tried to run the query with a ; at the end, it would not run. But when I removed it it ran. Is there some reason you don't need to terminate queries with a ; when using JDBC?
possible better answer: http://stackoverflow.com/a/26853989
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26857879
downvote count: 0

http://stackoverflow.com/comment/42273110
score: 1
comment on: http://stackoverflow.com/q/26855439
has text: Break the loop as soon as you find the element exists - may simplify your code a bit...
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26974429
upvote count: 1
downvote count: 0
type: Answer
has body: A SessionFactory is thread-safe and you have a singleton Sessionfactory for a given DataSource. The Sessions can either be created for the life time of a single request or even extended to span over multiple user requests. The Session has always have to be bound to a single Thread at any given time. Even when you use an extended persistence context, it's only one request/thread to access the Session at a point-in-time. So the Session should not be accessed concurrently. That's why you don't need to synchronize your entities, at least not from Hibernate point of view. Each Session loads it's own copy of an entity and the concurrency is usually ensured with optimistic locking because it's desirable to have application-level repeatable reads. So entities should not be synchronized. The concurrency control happens inside the database, not in your application logic. Each client request will always issue DML statements in the scope of a physical database transaction, and database transactions always acquire locks when rows get changes (even for READ_COMMITTED). All in all, the Session is not tread-safe along with all its attached Entities. The Session factory is thread-safe because you get only one singleton instance per DataSource and you use it to create new Sessions.
answers question: http://stackoverflow.com/q/26969991
score: 1

http://stackoverflow.com/a/26844950
answers question: http://stackoverflow.com/q/26844864
has comment: http://stackoverflow.com/comment/42257159
score: 0
has comment: http://stackoverflow.com/comment/42256705
has body: http://developer.android.com/reference/android/widget/AlphabetIndexer.html I guess this is what you're looking for
type: Answer

http://stackoverflow.com/comment/42472321
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26967816
has text: it seems that what I'm getting returned doesn't have a 'toArray' function available.

http://stackoverflow.com/a/26989483
has body: This is a follow-up to this answer in an attempt to save few lines with the @XmlElementWrapper. Since the Outter class seems to have no meaning on its own and it serves only as a container for the Inner class, it may be avoided: Please try the following: @XmlAccessorType(XmlAccessType.NONE) public class Doc1 { @XmlElementWrapper(name = "Outter") @XmlElement(type = Inner1.class, name = "Inner") public List getInner() { return super.getInner(); } @Override public void setInner(List innards) { super.setInner(innards); } public static class Inner1 extends Inner<ProblemType1> { @Override @XmlElement(type = ProblemType1.class, name = "ProblemType") public List<ProblemType> getProblemTypes() { return super.getProblemTypes(); } @Override public void setProblemTypes(List<ProblemType> problemTypes) { super.setProblemTypes(problemTypes); } } } However mind that this now a single list, not a list-of-lists. So this must be still possible with this construct: <ProblemType .../> <ProblemType .../> But this is not: <ProblemType .../> <ProblemType .../>
has comment: http://stackoverflow.com/comment/42510855
answers question: http://stackoverflow.com/q/26952965
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42510807

http://stackoverflow.com/a/26875885
has comment: http://stackoverflow.com/comment/42309436
upvote count: 1
has comment: http://stackoverflow.com/comment/42309417
has body: You will have to create deep copy of your array. You can do it manually or use System.arraycopy() to suit your needs.
type: Answer
answers question: http://stackoverflow.com/q/26875846
downvote count: 0
score: 1

http://stackoverflow.com/comment/42469898
has text: Hi, when I am using uniVocity-parser code as under -I am getting compiler error public class CsvParserExamples { CsvParserSettings settings = new CsvParserSettings(); settings.getFormat().setLineSeparator("\n"); CsvParser parser = new CsvParser(settings); List<String[]> allRows =parser.parseAll(getReader("mycsv.csv")); }} Syntax error on token "getFormat", Identifier expected after this token,The method getReader(String) is undefined for the type CsvParserExamples- Watchpoint:CsvParserExamples [access and modification] - allRows
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26947204
score: 0

http://stackoverflow.com/comment/42284857
type: QuestionComment
has text: Thanks everyone. I'm just wondering if these mistakes are okay to make after 1 month of coding? I feel a little upset that I wasn't able to do that.
score: 0
comment on: http://stackoverflow.com/q/26862120
type: Comment

http://stackoverflow.com/a/26919386
downvote count: 0
answers question: http://stackoverflow.com/q/26917002
type: Answer
accepted answer of: http://stackoverflow.com/q/26917002
has body: Wow....so, I was putting the plugin in a custom package. That was messing everything up! The simple change from: com.isabellaproducts.serialhelper to com.phonegap.plugins.serialhlper It now looks like this. Javascript: var SerialHelper = { getName: function(){ return "this is the name" }, getSerial: function(success, failure) { cordova.exec( success, // success callback function failure, // error callback function 'SerialHelper', 'getFableSerial', [] ); } } module.exports = SerialHelper; Java: package com.phonegap.plugins.serialhelper; import org.apache.cordova.CallbackContext; import org.apache.cordova.CordovaPlugin; import org.json.JSONObject; import org.json.JSONArray; import org.json.JSONException; import org.apache.cordova.*; public class SerialHelper extends CordovaPlugin { @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { if ("getFableSerial".equals(action)) { String serial = "15345344132354"; callbackContext.success(serial); //callbackContext.sendPluginResult(new PluginResult(Status.OK, serial)); return true; } else{ callbackContext.error("method not found"); return false; } } } plugin.xml: <?xml version="1.0" encoding="UTF-8"?> SerialHelper Serial Helper gets the Fable gives serial number access MIT serial, helper, fable <clobbers target="com.phonegap.plugins.serialhelper" /> <source-file src="src/android/com/phonegap/plugins/serialhelper/SerialHelper.java" target-dir="src/com/phonegap/plugins/serialhelper" />
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/q/26880953
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42318854
upvote count: 0
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/42318428
tagged with: persistence
has body: I want a hash function which is fast, collision resistant and can give unique output. The primary requirement is - it should be persist-able i.e It's progress(hashing progress) could be saved on a file and then later resumed. You can also provide your own implementation with Python. Implementations in "other languages" is/are also accepted if it is possible to use that with Python without getting hands dirty going internal. Thanks in advance :)
has comment: http://stackoverflow.com/comment/42319309
has comment: http://stackoverflow.com/comment/42326738
favorite count: 0
has comment: http://stackoverflow.com/comment/42319185
tagged with: hash
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42326698
tagged with: python
has answer: http://stackoverflow.com/a/26881016
tagged with: c++
has title: Is there any hash function which have following properties
has comment: http://stackoverflow.com/comment/42319080
tagged with: java

http://stackoverflow.com/a/26870739
type: Answer
answers question: http://stackoverflow.com/q/26866325
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42317882
has body: You're contradicting yourself with "no parallel processing is required" you're actually defining your problem as being embarrassingly parallel, this means that no synchronisation between the nodes is required. After the part what you've already done (installing java, copy the file) you only would need to start the program. And with 10 nodes you might be faster doing this with a shell or python script which just would visit each node, but with an increasing number of nodes it gets more and more complicated, that's why you have Hadoop/YARN or MPI to deal with this issue for you. For instance in MPI would have a master node and N slaves. The master would read the file and sent it line by line to the slaves. After it has done it, it could receive and concatenate the answers from the slaves, which would be, the same as what you want to write inside the output.txt. If you look at it as a Map/Reduce job, you're again wrong, since this would be the mapping part. The file would be split as input between your nodes by Hadoop or Spark and you would check each input like for what ever you want to check it for. Afterwards you would emit the interesting lines, or some other data. You can skip in most systems the Reduce part, which is what you want to do, and would just have the result from mapping concatenated again.

http://stackoverflow.com/a/26894018
score: 0
has body: Just get a working EM via @Autowired and set it where needed. Also check that your tests are marked as @Transactional.
type: Answer
answers question: http://stackoverflow.com/q/26891166
has comment: http://stackoverflow.com/comment/42360119
has comment: http://stackoverflow.com/comment/42687252
has comment: http://stackoverflow.com/comment/42367432

http://stackoverflow.com/comment/42478100
type: Comment
comment on: http://stackoverflow.com/a/26971156
has text: Thanks. But how can I generate the current date and time, and then format it as "yyyy-MM-dd HH:mm:ss"?
score: 0
type: AnswerComment

http://stackoverflow.com/q/26873117
downvote count: 0
type: UnansweredQuestion
tagged with: netbeans-8
score: 1
favorite count: 0
tagged with: netbeans
answer count: 0
type: Question
has title: Remote debug console application in NetBeans that needs input
upvote count: 1
tagged with: java
has body: I am trying to debug a project, that i run remotely on a raspberry pi. The problem is, that the project is a console application that also needs console inputs to work. But how can i send console inputs to the application ? I tried typing something in the usual output window, because i read that you can use it like the console, but either this does not work with NetBEans 8 or it does not work with remode debugging. Is there any other way ? I can open a SSH terminal, but how do i switch it to use the input/putput of the running debug session ?

http://stackoverflow.com/a/26973245
has comment: http://stackoverflow.com/comment/42769600
has comment: http://stackoverflow.com/comment/42771312
has comment: http://stackoverflow.com/comment/42653099
has comment: http://stackoverflow.com/comment/42647305
has body: The issue is with Word rather than docx4j. Microsoft Word doesn't support embedded data when it comes to importing XHTML. If you save your html string in a separate HTML file and try to open it in Word, you will see that it brings in the file with its formatting present, but the images are broken. A better solution would be for your code to import the XHTML "natively" (rather than as an AltChunk: @JasonPlutext provides a link for doing that in his comment), and then bring the images in using custom code: i.e. extract and decode the Base64 content so you have binary data, and then pull that into Word using the docx4j API (BinaryPartAbstractImage.createImagePart() or similar).
has comment: http://stackoverflow.com/comment/42806946
downvote count: 0
has comment: http://stackoverflow.com/comment/42771290
has comment: http://stackoverflow.com/comment/42934270
type: Answer
answers question: http://stackoverflow.com/q/26971528
upvote count: 2
has comment: http://stackoverflow.com/comment/42807481
score: 2

http://stackoverflow.com/comment/42447760
has text: Thanks for the elaborate answer. The typo in the snippet made it look like a stupid question
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26920944

http://stackoverflow.com/q/26835717
answer count: 5
score: -4
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42237289
tagged with: java
downvote count: 5
has answer: http://stackoverflow.com/a/26835782
type: Question
accepted answer: http://stackoverflow.com/a/26835824
has title: Converting an array of single digits to an integer
has answer: http://stackoverflow.com/a/26835772
has comment: http://stackoverflow.com/comment/42237321
has answer: http://stackoverflow.com/a/26835748
has answer: http://stackoverflow.com/a/26835824
has comment: http://stackoverflow.com/comment/42237296
has comment: http://stackoverflow.com/comment/42237486
has answer: http://stackoverflow.com/a/26835894
has comment: http://stackoverflow.com/comment/42237710
has body: For example: I have an array {1,5,3,6,3} I want to find a way to convert that to the int type. So int x = 15363 instead of int[] d = {1,5,3,6,3} Suggestions?
possible better answer: http://stackoverflow.com/a/26835782
favorite count: 0
has comment: http://stackoverflow.com/comment/42237305

http://stackoverflow.com/comment/42237281
score: 0
type: Comment
type: QuestionComment
has text: If a perfect square is defined as `y := x * x` where `y` and `x` are both integers, then, to compute the first 1000 perfect squares, you compute `x * x` for `x in [0, 999]`. The iteration over `x` is expressed by the loop. So all you have to add is `i * i` somewhere in your loop. The question is what you will do with the computed numbers? Keep in mind that, if you print them as you compute them, the execution time (that you compute) will be much larger, since i/o access is very slow. Don't measure the time of the i/o access if you want to measure solely the computation time.
comment on: http://stackoverflow.com/q/26835108

http://stackoverflow.com/q/26922727
accepted answer: http://stackoverflow.com/a/26922826
type: Question
has answer: http://stackoverflow.com/a/26922956
possible better answer: http://stackoverflow.com/a/26922741
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26922741
answer count: 3
has title: cannot parse hibernate.cfg.xml
downvote count: 0
has answer: http://stackoverflow.com/a/26922826
favorite count: 0
has body: I am new to hibernate .. and I am facing some basic problems : My xml is <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration xmlns="http://www.hibernate.org/xsd/hibernate-configuration" xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/database user user123 1 org.hibernate.dialect.MySQLDialect thread org.hibernate.cache.NoCacheProvider true create <mapping class="hibernateDTO.StudentDetails"/> </hibernate-configuration> I have written 2 classes one which is entity class and other with a main method to store / read operations. I am using hibernate 4 and once I run my class I get exception Nov 13, 2014 10:58:58 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.7.Final} Nov 13, 2014 10:58:58 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Nov 13, 2014 10:58:58 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Nov 13, 2014 10:58:58 PM org.hibernate.cfg.Configuration configure INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml Nov 13, 2014 10:58:58 PM org.hibernate.cfg.Configuration getConfigurationInputStream INFO: HHH000040: Configuration resource: /hibernate.cfg.xml Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: /hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2165) at org.hibernate.cfg.Configuration.configure(Configuration.java:2077) at org.hibernate.cfg.Configuration.configure(Configuration.java:2056) at hibernateTest.Hirbernate.main(Hirbernate.java:20) Caused by: org.dom4j.DocumentException: Error on line 5 of document : The processing instruction target matching "[xX][mM][lL]" is not allowed. Nested exception: The processing instruction target matching "[xX][mM][lL]" is not allowed. …
tagged with: http://stackoverflow.com/tag/xml
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/26963766
has body: I'm trying to get it to output the users fortune, but it will only output the number the user entered infinitely. What am I doing wrong? How can I fix the infinite loop? public static void main(String[] args) { Scanner broncos = new Scanner ( System.in ); int x, y, a; System.out.println("Would you like me to tell your fortune? Type 1 for yes and any other number for no: "); x = broncos.nextInt(); while (x==1) { System.out.println("Enter a number from 1-8: "); y = broncos.nextInt(); while ( y &gt; 0 &amp;&amp; y &lt; 9) System.out.println( y ); System.out.print ( "That's not a valid number. Try again. "); y = broncos.nextInt(); } System.out.println ("Enter a number from 1-8: "); a = broncos.nextInt(); switch (a) { case 8 : System.out.println ("You will win the lottery" ); break; case 7 : System.out.println ("You are going to do great things"); break; case 6 : System.out.println ("Don't get out of the house today"); break; case 5 : System.out.println ("You'll get a raise at work"); break; case 4 : System.out.println ("Lucky day today"); break; case 3 : System.out.println ("Not so lucky day today"); break; case 2 : System.out.println ("Your favorite sports team will win" ); break; case 1 : System.out.println ("Your car is going to break down" ); break; default: System.out.println ( "You didn't enter 1-8!" ); } broncos.close(); }
type: UnansweredQuestion
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26963777
has title: Why is my switch statement not working and stuck in an infinite loop?
tagged with: switch-statement
type: Question
tagged with: infinite-loop
answer count: 1

http://stackoverflow.com/q/26959545
tagged with: hashmap
has answer: http://stackoverflow.com/a/26959657
downvote count: 0
linked to: http://stackoverflow.com/q/2265503
answer count: 7
score: 4
has title: Why does changing the hashcode of an object used as a key in a HashMap make a lookup return null?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26959657
has comment: http://stackoverflow.com/comment/42457913
tagged with: equals
has answer: http://stackoverflow.com/a/26959584
has answer: http://stackoverflow.com/a/26959569
has answer: http://stackoverflow.com/a/26959594
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26959572
linked to: http://stackoverflow.com/q/27581
tagged with: hashcode
tagged with: java
has answer: http://stackoverflow.com/a/26959572
has body: Consider the following scenario: Object o1 = new Object(); Object o2 = new Object(); HashMap&lt;Object, Object&gt; map = new HashMap&lt;Object, Object&gt;(); map.put(o1, o2); boolean test1 = map.get(o1) == o2; // This evaluates to true // Now lets say we alter the state of o1: o1.setSomeInternalState(Object newState); boolean test2 = map.get(o1) == o2; // This evaluates to false, because now map.get(o1) returns null Assume that the class for o1 has overridden equals() and hashCode(). I've encountered this issue during debugging because I had explicitly overridden equals and hashCode on one particular object I'm using in some business logic. I can fully appreciate why the hashcode of the object changes when I alter its state, but why should the map.get(o1) return null because of it? There is only one object, so shouldn't the key's hashcode match?
has answer: http://stackoverflow.com/a/26984432
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/77994499

http://stackoverflow.com/q/26936776
has comment: http://stackoverflow.com/comment/42417824
has comment: http://stackoverflow.com/comment/42417950
tagged with: java
possible better answer: http://stackoverflow.com/a/26936830
downvote count: 3
type: Question
has comment: http://stackoverflow.com/comment/42417885
has title: Java Not greater than certain value
has comment: http://stackoverflow.com/comment/42418441
has body: I just have a simple question. In Java, we know that the remainder of (y%x) can't be greater than x itself. Thus, we could hypothetically set all numbers less than a certain value of x, say 100. Yet what would be the opposite of this? What if we wanted to set all numbers above a certain value, say 20, to have a range [20,100]? I was thinking that we could subtract 20 from both sides to have the range [0,80], and then take the modulus of 80, and then add 20 to it. Am I right in believing this? Thanks.
score: -3
answer count: 2
has comment: http://stackoverflow.com/comment/42417835
has comment: http://stackoverflow.com/comment/42417744
upvote count: 0
has answer: http://stackoverflow.com/a/26936898
favorite count: 0
tagged with: range
has answer: http://stackoverflow.com/a/26936830
tagged with: modulus
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26936898

http://stackoverflow.com/a/27073265
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42667234
has comment: http://stackoverflow.com/comment/42668380
has body: What you have to realize is that not all images contain that EXIF information. For any number of reasons, the metadata can be scrubbed from an image. I was going through a similar issue earlier today, and this was my solution: public HashMap&lt;String, String&gt; getMetadata(File photoFile){ Metadata metadata; ExifSubIFDDirectory exifSubIFDDirectory; HashMap&lt;String, String&gt; tagMap = new HashMap&lt;&gt;(); try { metadata = ImageMetadataReader.readMetadata(photoFile); exifSubIFDDirectory = metadata.getDirectory(ExifSubIFDDirectory.class); ExifSubIFDDescriptor exifSubIFDDescriptor = new ExifSubIFDDescriptor(exifSubIFDDirectory); if (exifSubIFDDirectory != null) { tagMap.put("lens", exifSubIFDDirectory.getDescription(ExifSubIFDDirectory.TAG_LENS_MODEL).toString()); tagMap.put("captureDate", exifSubIFDDirectory.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL).toString()); tagMap.put("shutter", exifSubIFDDescriptor.getExposureTimeDescription()); tagMap.put("aperture", exifSubIFDDescriptor.getFNumberDescription()); tagMap.put("focalLength", exifSubIFDDescriptor.getFocalLengthDescription()); tagMap.put("iso", exifSubIFDDescriptor.getIsoEquivalentDescription()); tagMap.put("meterMode", exifSubIFDDescriptor.getMeteringModeDescription()); //null is a possible return value from the method calls above. Replace them //with default no value string for (String key : tagMap.keySet()){ if (tagMap.get(key) == null) tagMap.put(key, "No Value Recorded"); } } else { Date currentDate = new Date(); tagMap.put("captureDate", currentDate.toString()); tagMap.put("shutter", "No Value Recorded"); tagMap.put("aperture", "No Value Recorded"); tagMap.put("focalLength", "No Value Recorded"); tagMap.put("iso", "No Value Recorded"); tagMap.put("meterMode","No Value Recorded"); tagMap.put("lens", "No Value Recorded"); } } catch (ImageProcessingException|IOException|NullPointerException e) { //unhandled exception, put out logging statement log.error("Error processing metadata for file " + photo…
has comment: http://stackoverflow.com/comment/42664037
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26979309

iframe
tags question: http://stackoverflow.com/q/26954937
tag name: iframe
type: Tag

http://stackoverflow.com/comment/42300039
comment on: http://stackoverflow.com/q/26861085
has text: You may want to learn about the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#Durations) standard which defines unambiguous string representation of a duration: `P[n]Y[n]M[n]DT[n]H[n]M[n]S`. Both Joda-Time and java.time libraries can parse and generate these strings.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/42334236
score: 0
comment on: http://stackoverflow.com/q/26882311
type: Comment
type: QuestionComment
has text: Here is a link how you can configure repositories http://grails.org/doc/2.2.4/guide/conf.html#dependencyRepositories

http://stackoverflow.com/a/26973462
answers question: http://stackoverflow.com/q/26973218
type: Answer
score: 2
downvote count: 0
has body: override hashCode &amp; equal method in your class that will help you for comparing java object. please refer below links link1 link2 link3
upvote count: 2

http://stackoverflow.com/q/26905864
has body: I want to insert a String via a Java Program into Oracle DB in a table having column type as CLOB. I am using the following code PreparedStatement stmt=conn.prepareStatement("insert into Json_Test values(?,?)"); stmt.setInt(1,counter); stmt.setClob(2,new StringReader(s)); But while executing i am getting an Exception: java.lang.Exception: 1 - oracle.jdbc.driver.OraclePreparedStatementWrapper.setClob(ILjava/io/Reader;
score: 0
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42362605
tagged with: prepared-statement
has answer: http://stackoverflow.com/a/26931090
has comment: http://stackoverflow.com/comment/42362773
has comment: http://stackoverflow.com/comment/42367813
type: UnansweredQuestion
has title: Exception while using .setClob()
has comment: http://stackoverflow.com/comment/42367827
has comment: http://stackoverflow.com/comment/42363065
favorite count: 0
tagged with: clob
type: Question
linked to: http://stackoverflow.com/q/22123932
tagged with: jdbc

http://stackoverflow.com/comment/42418385
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26936271
type: Comment
has text: It probably does not hang, it probably downloads schemas which are included via absolute URLs. Try to plug out of the network ans see what happens.

http://stackoverflow.com/comment/42515359
type: AnswerComment
type: Comment
has text: I think you should combine the solutions by both Selim Ok and Serge Ballesta to make it work
comment on: http://stackoverflow.com/a/26990583
score: 0

http://stackoverflow.com/comment/42245317
score: 2
has text: Do you mean that you want a String representation of your timestamp without milisec, or do you want to alter the timestamp (time value) to remove milisec?
comment on: http://stackoverflow.com/q/26839669
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26923666
has answer: http://stackoverflow.com/a/26923966
has comment: http://stackoverflow.com/comment/42394399
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42394550
tagged with: java
accepted answer: http://stackoverflow.com/a/26924075
has body: Should I check if the calling object is null? for instance: public class Some { private int number; private String name; public Some() { number = 0; name = "no name"; } public String get() { return name; //Should I check if the calling object is null? } }
has comment: http://stackoverflow.com/comment/42394445
type: Question
has answer: http://stackoverflow.com/a/26923738
has comment: http://stackoverflow.com/comment/42394394
has title: Should accessor method checks for if the calling object is null in java?
has answer: http://stackoverflow.com/a/26923736
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26924075
possible better answer: http://stackoverflow.com/a/26923736
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26923797
upvote count: 1

http://stackoverflow.com/q/26986687
downvote count: 0
score: 1
has title: sqlite constraint exception primary key must be unique
tagged with: android
accepted answer: http://stackoverflow.com/a/26988857
tagged with: sqlite
has body: I have 3 tables Table 1 : Member - To store every information about the member, Attribute : MemberUsername(PK), MemberPassword Table 2 : MsGroup - To store every registered group Attribute : GroupId(PK), GroupName, GroupDescription Table 3 : MsGroupDetail - To store list of every username in every group Attribute : GroupId(PK,FK), MemberUsername(PK,FK) My Query for Creating that 3 tables : db.execSQL("CREATE TABLE IF NOT EXISTS " + MS_MEMBER + " (" + MEMBER_USERNAME + " TEXT PRIMARY KEY NOT NULL, " + MEMBER_PASSWORD + " TEXT NOT NULL, " + MEMBER_EMAIL + " TEXT NOT NULL" + ");"); db.execSQL("CREATE TABLE IF NOT EXISTS " + MS_GROUP + " (" + GROUP_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + GROUP_NAME + " TEXT NOT NULL, " + GROUP_DESCRIPTION + " TEXT NOT NULL);"); db.execSQL("CREATE TABLE IF NOT EXISTS " + MS_GROUP_DETAIL + " (" + GROUP_ID + " INTEGER PRIMARY KEY, " + MEMBER_USERNAME + " TEXT, FOREIGN KEY (" + MEMBER_USERNAME + ") REFERENCES " + MS_MEMBER + "(" + MEMBER_USERNAME + "), FOREIGN KEY (" + GROUP_ID + ") REFERENCES " + MS_GROUP + "(" + GROUP_ID + "));"); I have successfully make some code to create member, create group, but the problem is I failed to create a query to invite/add a new member to a group (Failed to insert to MsGroupDetail) This is the syntax for adding GroupMember public void addGroupMember(String groupId, String username) { // TODO Auto-generated method stub ContentValues cv2 = new ContentValues(); cv2.put(GROUP_ID, groupId); cv2.put(MEMBER_USERNAME, username); ourDatabase.insert(MS_GROUP_DETAIL, null, cv2); } And this is the syntax to see the list of my Groups public String[] fetchGroupName(String username) { int i = 0; String Query = "SELECT " + GROUP_NAME + " From " + MS_GROUP + " a INNER JOIN " + MS_GROUP_DETAIL + " b ON a." + GROUP_ID + "=b." + GROUP_ID + " WHERE " + MEMBER_USERNAME + "=?"; Cursor c = ourDatabase.rawQuery(Query, new String[] { username }); String groupName[] = new String[c.getCount()]; int iGroupName = c.getColumnIndex…
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26988857
type: Question
answer count: 1
tagged with: database

http://stackoverflow.com/comment/42427850
has text: idk before i had if (heights[i]>average) { blah blah blach}
comment on: http://stackoverflow.com/a/26942082
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/31056066
type: Answer
has body: Getting rid of the line currentFrameIndex = 0 in the method wrapAnimation() ended up working. It turns out the problem was in another class where update() was being called. The animation timer was starting too early in some cases causing it to skip frames.
accepted answer of: http://stackoverflow.com/q/26836299
answers question: http://stackoverflow.com/q/26836299
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/26941796
has comment: http://stackoverflow.com/comment/42427896
upvote count: 1
has comment: http://stackoverflow.com/comment/42774768
accepted answer of: http://stackoverflow.com/q/26941632
score: 1
answers question: http://stackoverflow.com/q/26941632
has comment: http://stackoverflow.com/comment/42881016
has comment: http://stackoverflow.com/comment/42776544
type: AcceptedAnswer
downvote count: 0
has body: If we assume the input would strictly follow the format you provided, then this is simply a parsing problem. Here is how you get the three big blocks (vertices, edges and st). String input=" (1,2,3,4,5),((1,2),(1,3),(2,3),(2,4),(3,2),(3,5),(4,3),(5,2)),1,5"; String nodes=input.substring(0, input.indexOf("((")-1).trim(); String edges=input.substring(input.indexOf("((")+1, input.indexOf("))")+1).trim(); String st=input.substring(input.indexOf("))")+3).trim(); You can then parse every block alone and get its values. One thing: the list of edges is enough for defining the graph (you really do not need the first block). EDIT: You can simply initialize a boolean array visited[] with size equal to the number of vertices. Initially, all vertices are not visited.
type: Answer

http://stackoverflow.com/comment/42434594
has text: @Patrick - then I recommend you study the Mockito docs that relate to the `Answer` class. This is quite a rich area of the Mockito API, and Mockito has many built-in methods for creating `Answer` objects for various commonly used operations.
comment on: http://stackoverflow.com/a/26946017
type: Comment
type: AnswerComment
score: 2

http://stackoverflow.com/comment/42243203
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26839309
score: 0
has text: You may put your class into rt.jar and substitute String.class. But this is a very bad idea.

http://stackoverflow.com/a/34545405
score: 0
has body: I cannot comment to chamnassi's solution due to low reputation: chamnassi's answer works great In addition, the following check should be added: verify that the certificate is from Apple. The quick &amp; dirty solution is to verify the URL originates from "apple.com": // verify the URL: needs to have ".apple.com/" inside! String path = publicKeyUrl; path = path.substring(path.indexOf("://") + 3); // cut protocol, e.g. "https://" from front path = path.substring(0, path.indexOf("/")); // cut the URL-path part, so we only have something list "whatever.apple.com"! if (!path.toLowerCase().endsWith(".apple.com")) { // invalid certificate: not from Apple site! --&gt; throw error }
type: Answer
answers question: http://stackoverflow.com/q/26900116

http://stackoverflow.com/a/26976473
has comment: http://stackoverflow.com/comment/42556704
score: 3
answers question: http://stackoverflow.com/q/26973933
has comment: http://stackoverflow.com/comment/42747242
has body: I also tried solution proposed by Sergey and it seems to work - timer is cancelled. Tested on JBoss EAP 6.2. Here is the code I used for testing: @Stateless public class TimeoutTest implements TimeoutTestLocal { @Resource TimerService timerService; @Resource SessionContext sessionContext; @Timeout @TransactionAttribute(TransactionAttributeType.NEVER) public void tmout(javax.ejb.Timer timer) { try { System.out.println("timout invoked"); //instead of internal call let's invoke doNothing as //this timeout callback is client of TimeoutTest EJB //in this way doNothing will be run inside transaction TimeoutTestLocal local = sessionContext.getBusinessObject(TimeoutTestLocal.class); local.doNothing(); } catch (Exception e) { timer.cancel(); System.out.println("Timer cancelled"); } } @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void doNothing() { throw new EJBException("RE Exception"); } @Override public void schedule() { timerService.createTimer(5000, 10000, "test"); } }
has comment: http://stackoverflow.com/comment/42552445
accepted answer of: http://stackoverflow.com/q/26973933
has comment: http://stackoverflow.com/comment/42532546
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42753065
upvote count: 3
has comment: http://stackoverflow.com/comment/42754418
type: Answer
has comment: http://stackoverflow.com/comment/42510600
downvote count: 0
has comment: http://stackoverflow.com/comment/42550503

http://stackoverflow.com/comment/42468090
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26965033
has text: Not all `docs` entries have the `main` string in the `headline` object. E.g., the fifth one, about the "Green bean casserole" does not have it. Use `optString()` instead of `getString()`.

http://stackoverflow.com/comment/42482514
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26972988
has text: Could you show what was your xml based config ? It could be easier to determine was is not in current java config.
score: 0

http://stackoverflow.com/q/26882458
has answer: http://stackoverflow.com/a/26882495
type: AnsweredQuestion
has title: Casting variables in constructor before calling super?
tagged with: super
tagged with: java
has comment: http://stackoverflow.com/comment/42320577
type: Question
has answer: http://stackoverflow.com/a/26882539
tagged with: casting
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/26882495
has body: I am creating a game, and I wish to display the number of lives on the screen. I don't know how to add a number to the screen, but I do know the GLabel class which lets you write a String on the screen. So I thought this would be a good idea: public class Lives extends GLabel { double xPoistion, yPosition; int lives; String s_lives; public Lives(int lives, double xPosition, double yPosition){ super(lives, xPosition, yPosition); this.lives = lives; } } However the constructor of the GLabel class only works with a String for the place where lives is in the super. I can't seem to find a solution to fix this. Is it even possible? I tried this: super(lives.toString(s_lives), xPosition, yPosition); result was: Lives.java:14: cannot reference s_lives before supertype constructor has been called super(lives.toString(s_lives), xPosition, yPosition);
possible better answer: http://stackoverflow.com/a/26882539
tagged with: constructor
has comment: http://stackoverflow.com/comment/42320616

http://stackoverflow.com/a/26902058
accepted answer of: http://stackoverflow.com/q/26901712
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42358601
has comment: http://stackoverflow.com/comment/42357457
has comment: http://stackoverflow.com/comment/42356645
type: Answer
score: 0
has body: Your problem is almost certainly the issue: this.a = ((WebView)findViewById(2131230720)); The number "2131230720" is a static reference int to resources, in this case a layout view in your Activity. That number comes from R.java which is created when you "build" your project. Each time you perform a build, it will assign an integer to layout objects, strings, etc. that you define in XML in your res folder. Using the integer value might work for a while (or is present in source code), but then you change your layouts (or other R objects like strings) or rebuild on a different machine, Android library, etc. and it doesn't work anymore; That line should look like this: this.a = ((WebView)findViewById(R.id.my_webview_layout_id)); where "my_webview_layout_id" is from your layout XML file. You should find the "id" of the XML defined object in an XML file in res/layout Use that @+id reference. That will keep track of changes to that static reference. Then when you build or rebuild your Android app, it will create the R.java file with all of the appropriate references.
has comment: http://stackoverflow.com/comment/42356987
answers question: http://stackoverflow.com/q/26901712

http://stackoverflow.com/q/26953077
tagged with: java
tagged with: gregorian-calendar
tagged with: date
score: 0
has answer: http://stackoverflow.com/a/26953455
accepted answer: http://stackoverflow.com/a/26953455
answer count: 1
has comment: http://stackoverflow.com/comment/42449373
has body: How to write a function which returns number of days between two dates in Gregorian Callendar? What type should I convert my dates and how? public int substractDate(GregorianCalendar beginningDate, GregorianCalendar endingDate){ return dif; }
linked to: http://stackoverflow.com/q/12930134
type: AnsweredQuestion
has title: How to substract two dates in GregorianCallendar?
type: Question

http://stackoverflow.com/q/26863944
upvote count: 1
answer count: 1
has title: Passing an array from a Delphi DLL to JNA
has answer: http://stackoverflow.com/a/26867017
tagged with: dll
linked to: http://stackoverflow.com/q/10158582
has comment: http://stackoverflow.com/comment/42288279
has body: I'm using the Java JNA library to call a Delphi DLL that I have created. The Delphi function I'm using returns a type that is an array of PAnsiChar. The problem I'm getting is that when I try and call that function in Java, it's giving me a java.lang.Error: Invalid memory access. My Delphi code is here: function doTest(inputStatement: PAnsiChar): TDynamicAnsiCharArray; stdcall; begin SetLength(result, 3); result[0] := 'Line 1'; result[1] := 'Line 2'; result[2] := 'Line 3'; end; My Java code is here: public interface CLib extends StdCallLibrary { CLib INSTANCE = (CLib) Native.loadLibrary("DatabaseLibrary", CLib.class); public String[] doTest(String input); } public Main() { String[] dllOut = CLib.INSTANCE.doTest("Test?"); for(int i = 0; i &lt; dllOut.length; i++){ System.out.println(dllOut[i]); } } The full Java error is here: Exception in thread "main" java.lang.Error: Invalid memory access at com.sun.jna.Native.invokePointer(Native Method) at com.sun.jna.Function.invokePointer(Function.java:470) at com.sun.jna.Function.invoke(Function.java:430) at com.sun.jna.Function.invoke(Function.java:315) at com.sun.jna.Library$Handler.invoke(Library.java:212) at com.sun.proxy.$Proxy0.doTest(Unknown Source) at Main.&lt;init&gt;(Main.java:17) at Main.main(Main.java:25) Line 17 is the line with the String[] definition. I have this feeling that it's not going to work at all this way, but I'm hopeful there is actually a way.
tagged with: delphi
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42291970
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42292678
has comment: http://stackoverflow.com/comment/42288267
accepted answer: http://stackoverflow.com/a/26867017
has comment: http://stackoverflow.com/comment/42288566
has comment: http://stackoverflow.com/comment/42288109
tagged with: jna
type: Question
has comment: http://stackoverflow.com/comment/42291485
linked to: http://stackoverflow.com/q/14057226
linked to: http://stackoverflow.com/q/9349530
tagged with: java

http://stackoverflow.com/q/26916525
type: Question
has answer: http://stackoverflow.com/a/26916572
answer count: 1
downvote count: 0
has title: Maven: Project build error 'modelVersion' is missing
favorite count: 0
has body: I'm trying to create a new Maven project but I get this error from the pom.xml... Can anybody help me solving the problem, please? I'm a completely newbie with Maven &amp; Eclipse IDE Thank you so much.
upvote count: 6
accepted answer: http://stackoverflow.com/a/26916572
score: 6
tagged with: maven
type: AnsweredQuestion
tagged with: java
tagged with: eclipse

http://stackoverflow.com/q/26910159
type: Question
upvote count: 3
tagged with: java
tagged with: javafx
tagged with: swing
answer count: 1
has title: JavaFX thread always runnable
has body: Why does JavaFX Application thread always RUNNABLE? The following screen from YourKit profiler (VisualVM shows similar picture though): Yellow parts mean waiting state, light green - runnable and dark green when thread actually does work (visible in stacktrace) Swing's EDT waits for events and waiting otherwise, but what actually does JavaFX thread under the hood? Whether its 100% runnable state may cause performance leaks?
type: UnansweredQuestion
score: 3
tagged with: profiling
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26917972

http://stackoverflow.com/q/26841380
type: AnsweredQuestion
has body: I'm writing a bingo application for android. bingo game has alerts and notifications that supposed to go from the server to the client on real time. the client also needs to notify the server in real time whenever he yells bingo or any other events. now.. my question is, what's the recommended method for two ways communication between server and android client? should I use websockets? regular sockets? long polling ? anything else ? if I use sockets as the method of choice, what happens when the cellular phone is changing wan networks ? do i need to detect such a thing and reconnect the socket? any information regarding the issue would be greatly appreciated.
type: Question
tagged with: sockets
tagged with: android
has answer: http://stackoverflow.com/a/26841602
has title: recommended method for two way communication between android app and server
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26841602
tagged with: java

http://stackoverflow.com/a/26929195
upvote count: 1
has body: You can just do fallow in your class definition: public YourClass{ .... private Boolean isValid=false; .... }
answers question: http://stackoverflow.com/q/26929048
has comment: http://stackoverflow.com/comment/42405890
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/42405617

http://stackoverflow.com/comment/42544396
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26990865
score: 0
has text: @M.Deinum thanks for your help! the @ value does not work(show me null),however Maciej Walkowiak has solved my problems.Very appreciate for your help and taught me somethings.

http://stackoverflow.com/comment/42270485
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26853901
has text: google for "Java pass by value".
type: Comment

http://stackoverflow.com/a/26961028
answers question: http://stackoverflow.com/q/26961006
score: 3
has body: There are a lot of ways to solve this. The most simple, I think is to do the following: number = number + offset * multiple; where multiple = input.equals("e") ? 1 : -1; The ternary operator used here means that if the input is 'e', we increment, otherwise, decrement by the offset. We could also write multiple = input.equals("e") ? 1 : input.equals("d") ? -1 : 0; for input validation
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42460290
type: Answer
accepted answer of: http://stackoverflow.com/q/26961006
upvote count: 3

http://stackoverflow.com/q/26974875
tagged with: java
has comment: http://stackoverflow.com/comment/42511637
has title: How to load existing http sessions from an existing server to another server?
has body: I would like to know if Servlet specifications provides a way to load http sessions into my web application. The idea is simple : every time a new http client is connected, a new session is created... and I will send this session and its values into a database (for the time being this step is easy to do). If this "master server" dies, another machine will take its IP address, so http clients will now send their requests to this new machine (lets call it "slave server"). Here I would like my slave server retrieve sessions from the old server... but I don't know which method from Servlet specifications can "add" session ! Is there a way to do it ? PS: it's for an university project, so I cannot use already existing modules like Tomcat's mod_jk for this homemade load-balancer. EDIT: I think that a lot of people think I am crazy to not use already existing tools. It's an university project, and I have to make it with my bare hands in order to show to my professors the low level mecanisms that I have used. I already know it would be crazy to use what I am doing in production, when this project will be finished, it will be thrown in the trash. For the moment, I didn't find a "standard way" to make it with the Servlet specifications, but I can maybe do it with Manager and Session from Tomcat native classes... How can I get the instances for those interfaces ?
tagged with: servlets
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26975215
has answer: http://stackoverflow.com/a/26977438
has comment: http://stackoverflow.com/comment/42491033
tagged with: load-balancing
has comment: http://stackoverflow.com/comment/42498328
has comment: http://stackoverflow.com/comment/42496480
has comment: http://stackoverflow.com/comment/42518356
has comment: http://stackoverflow.com/comment/42492431
score: 0
tagged with: reverse-proxy
has comment: http://stackoverflow.com/comment/42498153
has comment: http://stackoverflow.com/comment/42494189
has comment: http://stackoverflow.com/comment/42491141
has comment: http://stackoverflow.com/comment/42484838
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42496275
has comment: http://stackoverflow.com/comment/42492046
has comment: http://stackoverflow.com/comment/42491822
has comment: http://stackoverflow.com/comment/42492008
tagged with: session

http://stackoverflow.com/a/26885928
answers question: http://stackoverflow.com/q/26883550
score: 0
type: Answer
has body: You want to execute the adb client, and you can't find it in Android system. What is executed in Android is the adb server, in listening for adb clients launched from external OS.

http://stackoverflow.com/q/26963520
tagged with: java
type: Question
has title: Trouble determining the range of years in a linked list
has answer: http://stackoverflow.com/a/26963935
score: 0
has comment: http://stackoverflow.com/comment/42465219
answer count: 1
tagged with: singly-linked-list
has comment: http://stackoverflow.com/comment/42465495
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42465195
has comment: http://stackoverflow.com/comment/42464925
has comment: http://stackoverflow.com/comment/42465476
has body: Hello guys i am having trouble implementing this particular problem. Every time i add a subscription to the list check if i need to update the "minYear" and "maxYear". Later use "minYear" and "maxYear" to check if the requested subscription period is valid. Basically I'm trying to determine the range of years of the linked list of subscriptions. Class SubscriptionYear: First reads the year and cellular data of a particular country. This read from a file. It takes in the year and stats data for that year. Below is my code for SubscriptionYear: public class SubscriptionYear { private int year; private double subscriptions; SubscriptionYear next; //stores the year and it's statistical data. public SubscriptionYear(int year,double subscriptions) { setYear(year); setSubscription(subscriptions); this.next = null; } //sets the year public void setYear(int Year) { this.year= Year; } //sets the cellular data. public void setSubscription(double value) { this.subscriptions = value; } public int getYear() { return year; } //returns the stat data public double getSubscription() { return subscriptions; } public String toString() { return "Number of Subscriptions: "+subscriptions; } //sets the node public void setNode(SubscriptionYear next) { this.next = next; } public SubscriptionYear getNext() { return this.next; } } class Country: This reads the Country Name and acts as a container for the Object node SubscripitpnYear that stores the year and stats data. It has variable field minYear and maxYear to check when a subscription is added to the list if it needs to be updated. use the minYear and maxYear to check if a subscription requested is valid. This is where i am having trouble implementing when i add a SusbcriptionYear to the list how do i check if i need to update minYear and maxYear? And use minYear and maxYear to check if a subscription is valid? my class country: public class Country { //variable fields. private String countryNames; private SubscriptionYear subscriptions; …

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/26901811
tags question: http://stackoverflow.com/q/26946284
tags question: http://stackoverflow.com/q/26835878
tags question: http://stackoverflow.com/q/26910547
tags question: http://stackoverflow.com/q/26960236
tags question: http://stackoverflow.com/q/26949896
tags question: http://stackoverflow.com/q/26922727
tags question: http://stackoverflow.com/q/26980773
tags question: http://stackoverflow.com/q/26843340
tags question: http://stackoverflow.com/q/26972807
tags question: http://stackoverflow.com/q/26952965
tags question: http://stackoverflow.com/q/26958179
type: Tag
tags question: http://stackoverflow.com/q/26924318
tags question: http://stackoverflow.com/q/26841573
tags question: http://stackoverflow.com/q/26960290
tags question: http://stackoverflow.com/q/26921969
tags question: http://stackoverflow.com/q/26916193
tags question: http://stackoverflow.com/q/26862691
tags question: http://stackoverflow.com/q/26984591
tags question: http://stackoverflow.com/q/26869996
tags question: http://stackoverflow.com/q/26975394
tags question: http://stackoverflow.com/q/26862513
tags question: http://stackoverflow.com/q/26863417
tags question: http://stackoverflow.com/q/26876190
tags question: http://stackoverflow.com/q/26867158
tags question: http://stackoverflow.com/q/26984753
tags question: http://stackoverflow.com/q/26944315
tags question: http://stackoverflow.com/q/26899619
tags question: http://stackoverflow.com/q/26987714
tags question: http://stackoverflow.com/q/26832936
tags question: http://stackoverflow.com/q/26891941
tags question: http://stackoverflow.com/q/26947183
tags question: http://stackoverflow.com/q/26876037
tags question: http://stackoverflow.com/q/26913173
tags question: http://stackoverflow.com/q/26868858
tags question: http://stackoverflow.com/q/26857460
tags question: http://stackoverflow.com/q/26956000
tags question: http://stackoverflow.com/q/26874592
tags question: http://stackoverflow.com/q/26855216
tags question: http://stackoverflow.com/q/26838810
tags question: http://stackoverflow.com/q/26946144
tags question: http://stackoverflow.com/q/26837401
tags question: http://stackoverflow.com/q/26929170
tags question: http://stackoverflow.com/q/26944318
tags question: http://stackoverflow.com/q/26877646
tags question: http://stackoverflow.com/q/26906953
tags question: http://stackoverflow.com/q/26986864
tags question: http://stackoverflow.com/q/26945571
tags question: http://stackoverflow.com/q/26897686
tags question: http://stackoverflow.com/q/26857086
tags question: http://stackoverflow.com/q/26887022
tags question: http://stackoverflow.com/q/26854322
tags question: http://stackoverflow.com/q/26949217
tags question: http://stackoverflow.com/q/26884640
tags question: http://stackoverflow.com/q/26877777
tags question: http://stackoverflow.com/q/26905690
tags question: http://stackoverflow.com/q/26918237
tags question: http://stackoverflow.com/q/26930380
tags question: http://stackoverflow.com/q/26989359
tags question: http://stackoverflow.com/q/26970644
tag name: xml
tags question: http://stackoverflow.com/q/26889443
tags question: http://stackoverflow.com/q/26977876
tags question: http://stackoverflow.com/q/26919058
tags question: http://stackoverflow.com/q/26961510
tags question: http://stackoverflow.com/q/26859707
tags question: http://stackoverflow.com/q/26837640
tags question: http://stackoverflow.com/q/26838327
tags question: http://stackoverflow.com/q/26872979
tags question: http://stackoverflow.com/q/26988235
tags question: http://stackoverflow.com/q/26897910
tags question: http://stackoverflow.com/q/26910437
tags question: http://stackoverflow.com/q/26920420
tags question: http://stackoverflow.com/q/26866776
tags question: http://stackoverflow.com/q/26863241
tags question: http://stackoverflow.com/q/26935258
tags question: http://stackoverflow.com/q/26832845
tags question: http://stackoverflow.com/q/26891508
tags question: http://stackoverflow.com/q/26910536

http://stackoverflow.com/comment/42533657
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26980817
has text: Note the `pDiff = pDiff.abs();`. If you want `q` to be larger than `p` then you need to add `q.compareTo(p)` check somewhere.

http://stackoverflow.com/q/26895543
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42346930
has answer: http://stackoverflow.com/a/26895748
has answer: http://stackoverflow.com/a/26895677
has answer: http://stackoverflow.com/a/26895726
has title: ArrayList of Files
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42345003
possible better answer: http://stackoverflow.com/a/26895677
favorite count: 0
has answer: http://stackoverflow.com/a/26895670
accepted answer: http://stackoverflow.com/a/26895726
upvote count: 1
answer count: 4
has comment: http://stackoverflow.com/comment/42344558
has comment: http://stackoverflow.com/comment/42346966
type: AnsweredQuestion
has body: I am having trouble creating an ArrayList of files... I am trying to have a collection of text files which I can then process. I do not know the amount of files that may be added to this collection. This is what I am trying... public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Menu"); System.out.println("Add - Adds a file"); while (sc.next().equalsIgnoreCase("Add")) { getDocs(); } } public static void getDocs() { Scanner sc = new Scanner(System.in); ArrayList&lt;File&gt; allFiles = new ArrayList&lt;&gt;(); allFiles.add(new File(sc.nextLine())); System.out.println(allFiles.toString()); } The println will only show the most recent file added to the ArrayList, and it also doesn't show the text in the file,so I assume my arrayList is not functioning as I want... the output I expected would be... Menu Add- adds a file add C://somepath//file1 This is the text in file 1 add C://somepath//file2 This is the text in file 1 This is the text in file 2 though, all that is really important is that all of these files are in a collection, and I can pull and read those files later in the program. Thanks for taking a look
has comment: http://stackoverflow.com/comment/42344654
has comment: http://stackoverflow.com/comment/42348418

http://stackoverflow.com/comment/42248262
comment on: http://stackoverflow.com/a/26842255
score: 0
type: AnswerComment
type: Comment
has text: I have used this in my program but I have read, on Stack Overflow an elsewhere, that using 'instanceof' is frowned upon. I was just fishing for any potential alternatives but thanks for offering some help!

http://stackoverflow.com/a/26861281
type: Answer
has body: You are not defining the number of elements that you want to push into array. Also you are not even making those elements to an array. You should do something like: int i =0; people = new Person[1000];// you need to define how many elements you need here or go for list while (phones.moveToNext()) { people[i++] = new Person("Hi" , " programmer"); people[i++] = new Person("Hello", " world") }
answers question: http://stackoverflow.com/q/26861149
score: 0

http://stackoverflow.com/comment/120010768
score: 0
type: Comment
type: QuestionComment
has text: Does this answer your question? [How to capture trayicon.displayMessage() mouse click on the tooltip baloon](https://stackoverflow.com/questions/8459878/how-to-capture-trayicon-displaymessage-mouse-click-on-the-tooltip-baloon)
comment on: http://stackoverflow.com/q/26894844

http://stackoverflow.com/a/26867119
upvote count: 53
accepted answer of: http://stackoverflow.com/q/26867055
answers question: http://stackoverflow.com/q/26867055
has comment: http://stackoverflow.com/comment/70802270
has body: You have the choice to use the following 4 methods. I have provided examples of the two methods useful in this case. I have consolidated this information from the commentators below. helper.setTo(InternetAddress.parse("email1@test.com,email2@test.com")) helper.setTo(new String[]{"email1@test.com", "email2@test.com"}); From the Javadoc:
has comment: http://stackoverflow.com/comment/83627180
has comment: http://stackoverflow.com/comment/83703877
has comment: http://stackoverflow.com/comment/83704101
has comment: http://stackoverflow.com/comment/83721889
has comment: http://stackoverflow.com/comment/79754325
has comment: http://stackoverflow.com/comment/126562223
has comment: http://stackoverflow.com/comment/70802618
downvote count: 3
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/83668588
has comment: http://stackoverflow.com/comment/98961427
score: 50
type: Answer
has comment: http://stackoverflow.com/comment/83627510
has comment: http://stackoverflow.com/comment/70802440
has comment: http://stackoverflow.com/comment/70803598
has comment: http://stackoverflow.com/comment/83668428

http://stackoverflow.com/q/26945728
upvote count: 1
has answer: http://stackoverflow.com/a/26945791
has answer: http://stackoverflow.com/a/26945806
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/42433897
has body: I am writing an Android client for consuming a SOAP based web service. I am using an AsyncTask for performing the networking (that is calling the webservice) operation. I am in the middle of writing the client. Now as I try to implement the AsyncTask's doInBackground method, I get the following two errors at protected String doInBackground(String[] params)... if I write the @Override annotation with it: The method doInBackground(String[]) of type MainActivity.MyTask must override or implement a supertype method. 1 Quick fix: Remove '@Override' annotation and the following error at private class MyTask extends AsyncTask... : The type MainActivity.MyTask must implement the inherited abstract method AsyncTask.doInBackground(String[]...). 2 Quick fixes: Add unimplemented methods (this auto-generates the doInBackground method again with the @Override annotation). Make type 'MyTask' abstract. if I don't write the @Override annotation, I get only the second error. ... @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); String [] params = {URL, METHOD_NAME, NAMESPACE}; } private class MyTask extends AsyncTask&lt;String[], Void, String&gt; { //@Override write it or not write it? :s **************** protected String doInBackground(String[] params) { // TODO Auto-generated method stub return null; } } ... What might be the reason behind this? What should I do?
tagged with: android
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/4211099
downvote count: 0
score: 1
tagged with: java
tagged with: annotations
possible better answer: http://stackoverflow.com/a/26945771
type: Question
has answer: http://stackoverflow.com/a/26945771
has title: AsyncTask methods: I get error whether I write "@Override" annotation or not
tagged with: overriding
accepted answer: http://stackoverflow.com/a/26945791
answer count: 3

http://stackoverflow.com/q/26954455
tagged with: java
has body: public class assignmentno7 { public static void main(String[] args) { long i,c1=1,n; for(n=1;n&lt;20;n++) { for(i=1;i&lt;(n+1);i++) if(n%i==0) c1+=i; if(c1==1) System.out.println(n+"is prime"); else if(c1==n) System.out.println(n+"is perfect"); else System.out.println(n+"its a regular number"); } } } I want to write a program that test number whether its prime or perfect I have no errors is my program but im not getting the right solutions this is my output : ----jGRASP exec: java assignmentno7 1its a regular number 2its a regular number 3its a regular number 4its a regular number 5its a regular number 6its a regular number 7its a regular number 8its a regular number 9its a regular number 10its a regular number 11its a regular number 12its a regular number 13its a regular number 14its a regular number 15its a regular number 16its a regular number 17its a regular number 18its a regular number 19its a regular number ----jGRASP: operation complete. any suggestions ?
has answer: http://stackoverflow.com/a/26954509
type: Question
has answer: http://stackoverflow.com/a/26954531
has title: write a program to test numbers whether its prime or perfect
score: 0
has answer: http://stackoverflow.com/a/26954480
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26954541

http://stackoverflow.com/comment/42463889
type: QuestionComment
comment on: http://stackoverflow.com/q/26962884
score: 0
has text: You'll need to sort the array before you proceed. I realise you can't use `.sort` but you should write your own sort method.
type: Comment

http://stackoverflow.com/comment/42339565
has text: You can’t use `normalized()` for this task. `normalized()` will return an offset-based `ZoneID` *if and only if* the `ZoneID` on which you call it has a fixed offset as well, otherwise the `ZoneID` is returned unchanged. Or in other words, the underlying `ZoneRules` and hence the overall result regarding this question don’t change when using a `normalized()` `ZoneID`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26886942

http://stackoverflow.com/q/26857545
tagged with: daemon
tagged with: auto-update
answer count: 0
has comment: http://stackoverflow.com/comment/42318789
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42307468
tagged with: server
tagged with: java
has comment: http://stackoverflow.com/comment/42276752
type: Question
has body: I am running my server application as a service on a mac computer using launchd. I am looking for a solution to update the server so the users won't notice the server is stopped. The server provides RESTful services to users who are expecting zero down time. The server application is written in Java.
score: 0
has title: Updating DAEMON service in Mac OS X
tagged with: service

http://stackoverflow.com/q/26862117
tagged with: architecture
tagged with: domain-driven-design
tagged with: design-patterns
has title: DDD - how to write good, robust code using a basic example
tagged with: java
has answer: http://stackoverflow.com/a/26870158
type: Question
has answer: http://stackoverflow.com/a/26878024
has body: For a new application, I'm using layers : RestRessource -> ApplicationService -> Domain I have a basic use case where the user can create an"bduget". If no other budget exists for the current year, the status is 'INITIAL'. AFter that a new budget can be created and its status will be 'CORRECTIVE' coupled to another attribute 'index' : CORRECTIVE#1, CORRECTIVE#2, ... Now some coding. The ApplicationService has a methode called "createBudget" @Autowired private BudgetRepository budgetRepo; @Autowired private BudgetService budgetService; public Budget createBudget(int year) { Budget newBudget; if (budgetService.existsBudgetInitialFor(year)) { newBudget = new Budget(year, "INITIAL"); } else { newBudget = new Budget(year, "CORRECTIVE", budgetService.nextIndex()); } budgetRepo.insert(newBudget); return newBudget; } BudgetService is using BudgetRepository to make a database count. existsBudgetInitialFor returns a boolean if count > 0 :) And now the questions : For this example, I find budgetServcie useless. Is it better to move existsBudgetInitialFor inside BudgetRepository ? Do you think the "if ... else ..." statement is at the good place : is it AppService layer responsibility or for you, it is a domain rule and to enforce this, do you move this code inside BudgetService ? To encapsulate the budgetService.nextIndex call, is it better to sue a factory for creating Budget ? (in place of the constructor). And do you think it is the right time to compute the nextIndex. The application layer is subjet to unit test or perhaps only to integration test ? Why do you ask that for ? When I tried to unit test this methode I needed to mock at least BudgetService, BudgetRepository, I was thinking : is it a sign of code smell ? Another solution to ease unit test is to extract budgetService.existsBudgetInitialFor(year) as a private method, mock it to returns TRUE / FALSE as I wish etc. I didn't think when writing this code that the creation is the responsibility of the entity. I found …
has comment: http://stackoverflow.com/comment/42455907
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26874680
type: UnansweredQuestion

http://stackoverflow.com/comment/42364954
comment on: http://stackoverflow.com/q/26907333
score: 0
has text: We want to disable TLS 1.0 because of Known vulnerabilities in this protocol like BEAST attach etc.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26936019
score: 0
has comment: http://stackoverflow.com/comment/42417302
has body: If you have another computer, try pinging the server. Also try telnet 8080. I am guessing the second command would fail. If that's the case, your firewall (on the server) is blocking the incoming port 8080. Open it and you should be good to go.
accepted answer of: http://stackoverflow.com/q/26935752
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26935752
type: Answer

http://stackoverflow.com/a/26841321
accepted answer of: http://stackoverflow.com/q/26841030
score: 0
has comment: http://stackoverflow.com/comment/42247016
answers question: http://stackoverflow.com/q/26841030
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42246974
type: Answer
has body: Below code will work for you but its not good enough Object[] objArray = averageMap.values().toArray(); double[] dblArray = new double[objArray.length]; for (int i = 0; i &lt; objArray.length; i++) { dblArray[i] = Double.parseDouble(objArray[i].toString()); } averageMap.values().toArray(); method returns object[] so you have to cast it to Double or pars it to double[] but its not good practice to parse it to double.instead of double use Double class.it is wrapper class so autoboxing done automatically so no need to worry

http://stackoverflow.com/q/26905349
downvote count: 0
has comment: http://stackoverflow.com/comment/42363120
tagged with: class
linked to: http://stackoverflow.com/q/5654926
has body: sigh OK guys... There is going to be a painstaking amount of code here, but i'm going to do it anyway. So basically, I have a custom made (well it's actually just a HEAVILY customized version of a JFrame) and am having major issues. I have a background. (Fair enough, that's fine) THEN I have a Terminal frame that pops up and spits stuff out. This Terminal frame is based off another class named CustomFrame. I also have ANOTHER class called Notification, which is ALSO a frame class like Terminal ALSO based off Custom Frame. In the beginning, background loads fine. Terminal loads fine. Calls method to show Notification window. And thats where the problem rises. The notification window won't show. I have tried frame.setVisible(); frame.setSize(); frame.setLocation(); I have tried, EVERYTHING. And if I don't show Terminal at all, it seems to spit it's code onto Notification instead, almost like there can only be ONE instance of the CustomFrame open AT ALL TIMES. I hope you understand my problems... So here is the code! Game.java public class Game implements KeyListener { int BACK_WIDTH = java.awt.Toolkit.getDefaultToolkit().getScreenSize().width; int BACK_HEIGHT = java.awt.Toolkit.getDefaultToolkit().getScreenSize().height; JFrame back_frame = new JFrame(); JPanel window = new JPanel(); JLabel title = new JLabel(Variables.TITLE); Terminal login = new Terminal(); public static void main(String[] args) { new Game(); } public Game() { try { back_frame.setSize(BACK_WIDTH, BACK_HEIGHT); back_frame.setLocation(0, 0); back_frame.getContentPane().setBackground(Color.BLACK); back_frame.setUndecorated(true); back_frame.setVisible(true); back_frame.add(window); window.setBackground(Color.BLACK); window.setLayout(null); window.add(title); title.setBounds((BACK_WIDTH / 2) - (550 / 2), (BACK_HEIGHT / 2) - (50 / 2), 550, 50); title.setForeground(Color.WHITE); back_frame.addKeyListener(this); login.addKeyListener(this); login.setLocationRelativeTo(null); login.setVariables(Types.LOGINTE…
has comment: http://stackoverflow.com/comment/42363378
has comment: http://stackoverflow.com/comment/42361966
answer count: 1
linked to: http://stackoverflow.com/q/11827326
tagged with: frame
linked to: http://stackoverflow.com/q/6309407
has comment: http://stackoverflow.com/comment/42361681
has answer: http://stackoverflow.com/a/26916705
favorite count: 0
accepted answer: http://stackoverflow.com/a/26916705
has title: Java Massive Multiple Frame Instances Issue
upvote count: 1
tagged with: swing
type: AnsweredQuestion
tagged with: instance
has comment: http://stackoverflow.com/comment/42363012
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42361914
type: Question
has comment: http://stackoverflow.com/comment/42363044
has comment: http://stackoverflow.com/comment/42362182
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/42364799
has comment: http://stackoverflow.com/comment/42363148

http://stackoverflow.com/q/26839962
type: UnansweredQuestion
answer count: 0
upvote count: 3
tagged with: jax-ws
tagged with: streamwriter
has title: jax-ws endpoint gets blocked writting on socket since Java 8 upgrade
tagged with: java-8
type: Question
tagged with: chunked-encoding
score: 3
tagged with: java
has body: We use JAX-WS implementation with JAXB for webservices, we have recently upgraded to jdk 8, since then we are having an issue when our endpoint is sending the responses. After digging into it, I realized that the endpoint thread gets blocked when writing on the socket. Here is thread stack trace from server side when the execution is blocked, as you can see it gets blocked when writing. The client side gets also blocked reading until reaches a timeout. Daemon Thread [jaxws-engine-WSEndpointSever::WSEnpointServer-3-thread-1] (Suspended) owns: Object (id=8288) owns: Request$WriteStream (id=8289) SocketDispatcher.write0(FileDescriptor, long, int) line: not available [native method] [local variables unavailable] SocketDispatcher.write(FileDescriptor, long, int) line: 51 IOUtil.writeFromNativeBuffer(FileDescriptor, ByteBuffer, long, NativeDispatcher) line: 93 IOUtil.write(FileDescriptor, ByteBuffer, long, NativeDispatcher) line: 65 SocketChannelImpl.write(ByteBuffer) line: 470 Request$WriteStream.write(byte[], int, int) line: 391 ChunkedOutputStream.writeChunk() line: 125 [local variables unavailable] ChunkedOutputStream.flush() line: 159 [local variables unavailable] PlaceholderOutputStream.flush() line: 449 [local variables unavailable] ServerConnectionImpl$1(FilterOutputStream).flush() line: 140 [local variables unavailable] UTF8OutputStreamWriter.flush() line: 138 XMLStreamWriterImpl.flush() line: 397 XMLStreamWriterFactory$HasEncodingWriter(XMLStreamWriterFilter).flush() line: 56 SAAJMessage.writeTo(XMLStreamWriter) line: 365 MessageWrapper.writeTo(XMLStreamWriter) line: 206 StreamSOAP11Codec(StreamSOAPCodec).encode(Packet, OutputStream) line: 129 SOAPBindingCodec.encode(Packet, OutputStream) line: 227 ServerAdapter(HttpAdapter).encodePacket(Packet, WSHTTPConnection, Codec) line: 474 HttpAdapter.access$100(HttpAdapter, Packet, WSHTTPConnection, Codec) line: 90 HttpAdapter$HttpToolkit.handle(WSHTTPConnection) line: 716 ServerAdapter(HttpAdapter).handle(WSHTTPConnecti…
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26863064
has body: Could you please specify the type of data for GRPID ? If its an integer value, you don't need the single quote. It would be useful if you could put up the create statement for this table.
type: Answer
answers question: http://stackoverflow.com/q/26862778
score: 0

http://stackoverflow.com/q/26869873
has answer: http://stackoverflow.com/a/26869958
answer count: 3
tagged with: mainclass
downvote count: 0
score: 1
tagged with: polymorphism
has body: So I have to create a program where I use polymorphism and inheritance to create arrows that point left and arrow and I did that. however, when I created my main class and try to invoke the methods, say for example "LeftArrow.drawHere" to draw the arrow i get errors saying I cannot make a static reference to the non static field "drawHere() from the class LeftArrow". I was wondering then if I can't do that how can I design my main method so it draws the arrows? here is my code, note that there are several classes but I will post all of them here. import java.util.Scanner; public class LeftArrow extends ShapeBasic { private int tail, width; private static int inside; public LeftArrow() { super(); tail = 0; width = 0; } public LeftArrow(int noff, int ntail, int nwidth) { super(noff); tail = ntail; setWidth(nwidth); } public void setTail(int ntail) { tail = ntail; } public int getTail() { return tail; } public void setWidth(int nwidth) { if (nwidth % 2 == 1) { width = nwidth; } else { System.out.println(" Width must be odd"); System.out.println("Enter a new width"); Scanner key = new Scanner(System.in); int wid = key.nextInt(); setWidth(wid); } } public int getWidth() { return width; } public void drawHere() { drawTriangle(); drawTail(); drawBTriangle(); //System.out.println(); } public void drawTriangle() { inside = 1; int split = (width/2); skipSpaces(getOffset()); System.out.println('*'); for(int count = 0; count &lt; split; count ++) { skipSpaces(getOffset() - (inside + 1)); System.out.print('*'); skipSpaces(inside); System.out.print('*'); inside = inside + 2; System.out.println(); } } public void drawTail() { skipSpaces(getOffset() - getInside() - 1); System.out.print('*'); skipSpaces(getInside()); for (int count = 0; count &lt; tail ; count++) { System.out.print('*'); } } public void drawBTriangle() { int inside = getInside(); int split = (width/2); System.out.println(); for(int count = 0; count &lt; split; count ++) { skipSpaces(getOffset() - (inside - 1)); Syst…
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42306736
has answer: http://stackoverflow.com/a/26869947
upvote count: 1
tagged with: java
type: Question
has title: How to fix java error?
has answer: http://stackoverflow.com/a/26869967
tagged with: inheritance

http://stackoverflow.com/q/26929276
possible better answer: http://stackoverflow.com/a/26929542
answer count: 3
has answer: http://stackoverflow.com/a/26929542
downvote count: 0
has answer: http://stackoverflow.com/a/40456582
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/40456582
tagged with: java
tagged with: javafx
tagged with: treeview
has body: I have a TreeView that is inside a GridPane. A certain function requires the user to select a TreeItem and click on button on the screen. After the function associated with the button is completed, I want the focus to go back to the TreeItem that was previously selected in the TreeView. At the end of the button action, I have: TreeItem&lt;String&gt; selectedItem = [TreeItem that was last selected] How can I give focus back to the TreeView with selectedItem highlighted? Neither the TreeView or TreeItem have a setSelected method I can use.
type: Question
has answer: http://stackoverflow.com/a/60906849
score: 5
upvote count: 5
has title: Set selected TreeItem in TreeView

http://stackoverflow.com/q/26859576
possible better answer: http://stackoverflow.com/a/26859657
score: 0
answer count: 3
has title: How to run maven tests in particular sequence?
has answer: http://stackoverflow.com/a/26859687
tagged with: pom.xml
accepted answer: http://stackoverflow.com/a/26867401
tagged with: testng
tagged with: maven
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2669576
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/26867401
has body: I've created Maven project which has structure like following: src/main/java src/main/resources src/test/java src/test/resources I've kept my TestNG tests in src/test/java folder. Suppose in this folder, I've three classes: YahooTest GoogleTest TwitterTest and each of one have few TestNG test methods. When I hit mvn clean test on command prompt, I observed tests running in following order: test from GoogleTest test from TwitterTest test from YahooTest test from GoogleTest test from TwitterTest test from YahooTest test from GoogleTest test from TwitterTest test from YahooTest Means first classes are ordered in alphabetical order i.e. GoogleTest, TwitterTest, YahooTest and then one test from each class is executed and again one test from each class is executed. This continues until all test methods execution finishes. But I want to customize the test execution. How can I achieve following: Arrange test execution of test classes in the order I want rather than in alphabetical order Instead of executing one test method from each test class and then one test method from each test class ..., execute all test cases from same class and then move to another test class
has answer: http://stackoverflow.com/a/26859657

http://stackoverflow.com/comment/71900587
type: Comment
comment on: http://stackoverflow.com/a/26944869
has text: With Java 8, in the "toBooleanArray(...)" method, you could replace the "for" loop with "bits.stream().forEach(bit -> bools[bit] = true);". It's a bit more succinct for the same work. (Not a really big deal, though.)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42308691
type: QuestionComment
has text: For reference, in case anyone else comes along this, this is fixed in version 1.7.7 of the Dropbox Java Core SDK: https://www.dropbox.com/developers/core/sdks/java
score: 3
comment on: http://stackoverflow.com/q/26874629
type: Comment

http://stackoverflow.com/a/26887342
has comment: http://stackoverflow.com/comment/42331344
upvote count: 5
type: Answer
has body: Is this a problem on the preview window or at runtime ? RecyclerView needs a LayoutManager to be rendered. In you Java code, add the following : mRecyclerView.setLayoutManager(new LinearLayoutManager(context));
has comment: http://stackoverflow.com/comment/49931574
downvote count: 0
has comment: http://stackoverflow.com/comment/42331607
answers question: http://stackoverflow.com/q/26886487
has comment: http://stackoverflow.com/comment/43850968
score: 5
has comment: http://stackoverflow.com/comment/42331281

http://stackoverflow.com/comment/42286915
comment on: http://stackoverflow.com/a/26863430
type: Comment
has text: no worries, I have seen that enough times to know it should be lowercase! edited my question code and the browser is still not playing ball
score: 0
type: AnswerComment

http://stackoverflow.com/q/26834621
accepted answer: http://stackoverflow.com/a/26834718
has body: How I can use this sharedPrefs.getString into my Runnable ? private Runnable updateCounterThread = new Runnable() { public void run() { timeInMilliseconds = SystemClock.uptimeMillis() - startTime; updatedTime = timeSwapBuff + timeInMilliseconds; String tauxhoraire = sharedPrefs.getString("taux_horaire", "NULL"); double taux=Double.parseDouble(tauxhoraire) * 100; int centimes = (int) (updatedTime / 1000 * (taux / 60 / 60)) ; int euros = centimes / 100; centimes = centimes % 100; counterVal.setText("" + euros + "," + String.format("%02d", centimes) + " €"); customHandler.postDelayed(this, 0); } }; Since when I do like that it's an error "sharedPrefs cannot be resolved" but I can't import it in the loop. When I add it into the loop SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); I have this error "The method getDefaultSharedPreferences(Context) in the type PreferenceManager is not applicable for the arguments (new Runnable(){})" So I tried to add it into my first loop @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); String tauxhoraire = sharedPrefs.getString("taux_horaire", "NULL"); But resulting by the first error "sharedPrefs cannot be resolved" Thanks
tagged with: android
has answer: http://stackoverflow.com/a/26834718
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to use a sharedPrefs.getString into a Runnable
score: 0
answer count: 1

http://stackoverflow.com/comment/42278046
type: QuestionComment
comment on: http://stackoverflow.com/q/26858335
score: 1
has text: actually `assertEquals(sprouts, transactions.get(0));` is fine, so that I believe is not an issue
type: Comment

http://stackoverflow.com/a/26834178
type: Answer
accepted answer of: http://stackoverflow.com/q/26834078
answers question: http://stackoverflow.com/q/26834078
has body: The second example is wrong. Swing components must be created and used from the event dispatch thread. See https://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html. Quote from the javadoc: Calls to an application's main method, or methods in Applet, are not invoked on the event dispatching thread. As such, care must be taken to transfer control to the event dispatching thread when constructing and showing an application or applet. (emphasis mine)
upvote count: 5
has comment: http://stackoverflow.com/comment/42234915
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42234873
score: 5

http://stackoverflow.com/a/28136329
answers question: http://stackoverflow.com/q/26896896
type: Answer
has body: public void async_post(){ //do a twiiter search with a http post String url = "http://search.twitter.com/search.json"; Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("q", "androidquery"); aq.ajax(url, params, JSONObject.class, new AjaxCallback&lt;JSONObject&gt;() { @Override public void callback(String url, JSONObject json, AjaxStatus status) { showResult(json); } }); }
score: 0
has comment: http://stackoverflow.com/comment/44668624

http://stackoverflow.com/q/26906983
tagged with: eclipse
type: Question
tagged with: eclipse-rcp
score: 0
answer count: 1
tagged with: eclipse-plugin
has answer: http://stackoverflow.com/a/26910137
has title: createForm() of FormToolKit creates scroll bars
has comment: http://stackoverflow.com/comment/42365638
has body: I am trying to create a multipage editor looking similar to the manifest editor using the wizard for multipage editors provided by eclipse. The first page is created as follows: void createPage0() { Composite composite = new Composite(getContainer(), SWT.DEFAULT); composite.setLayout(new FillLayout()); FormToolkit toolkit = new FormToolkit(composite.getDisplay()); Form form = toolkit.createForm(composite); form.setText("Test Viewer"); toolkit.decorateFormHeading(form); int index = addPage(composite); setPageText(index, "editor1"); } When ran with eclipse, the created form has two scroll activ scroll bar, although there is obviously nothing to scroll. I tried cleaning and refreshing the project. Nothing changed. Help?
tagged with: editor
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26910137

http://stackoverflow.com/q/26868165
has answer: http://stackoverflow.com/a/27184832
tagged with: highlighting
type: Question
has title: highlighting button in java with timer
answer count: 1
score: 0
has body: I wanted to highlight the panel,for a specific time (just like in karaoke apps). each panel will have a specific time for highlighting.How to highlight a panel for an example a 3*3 panel like tic tac toe.I searched a lot on stackoverflow and google,but dead end. and can i take help of java .please help me out. I found on how to highlight a word like kareoke, but I didnt know how to replace the word as button panel This is the code for highlight word: public class processingTest { private int[] timings = {2000, 1000, 4000, 2000, 3000};//char timings private String[] words = {"H", "e", "l", "l", "o"};//each indiviaul word private String sentence = "Hello";//entire string for writing to JSCrollPane private DefaultHighlighter.DefaultHighlightPainter highlightPainter = new DefaultHighlighter.DefaultHighlightPainter(Color.GREEN); private int count = 0; private boolean fisrTime = true; private JFrame frame; private JTextPane jtp; JButton startButton; public processingTest() { initComponents(); } private void initComponents() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); jtp = new JTextPane(); jtp.setText(sentence); startButton = new JButton("Start"); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { startKaraoke(); } }); frame.add(jtp, BorderLayout.CENTER); frame.add(startButton, BorderLayout.SOUTH); frame.pack(); frame.setVisible(true); } private void startKaraoke() { if (fisrTime) { startButton.setEnabled(false); fisrTime = false; } new Thread(new Runnable() { @Override public void run() { Timer t = createAndStartTimer(timings[count], count); while (t.isRunning()) {//wait for timer to be done try { Thread.sleep(1); } catch (InterruptedException ex) { ex.printStackTrace(); } } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { count++; if (count == timings.length) { JOptionPane.showMessageDialog(frame, "Done"); startButton.setEnabled…
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/q/26915440
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26916045
tagged with: types
favorite count: 0
type: AnsweredQuestion
has title: Checking if an object is an instance of a specific datatype given by a user
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42380027
downvote count: 3
type: Question
has body: I am struggling with checking if an object is an instance of a specific datatype, which is given by user input. For example: Object a = new Object(); String userDataType = JOptionPane.showInputDialog("What kind of datatype do you want to check?"); if(Object a instanceof userDataType)) doStuff(); I tried reflections but I still don't manage to get behind this... Thank you in advance!
has answer: http://stackoverflow.com/a/26916052
has comment: http://stackoverflow.com/comment/42380374
has answer: http://stackoverflow.com/a/26916893
has answer: http://stackoverflow.com/a/26916045
possible better answer: http://stackoverflow.com/a/26916052
tagged with: class

http://stackoverflow.com/comment/42482870
type: AnswerComment
comment on: http://stackoverflow.com/a/26973687
type: Comment
has text: Could you say it the 404 is caused by the controller not being hitted of the view not being found ? (putting spring log at debug level can help to find that)
score: 0

http://stackoverflow.com/comment/42313185
comment on: http://stackoverflow.com/q/26877777
score: 0
type: Comment
type: QuestionComment
has text: This sounds really difficult. I would not use reflection, it won't be able to access private fields and private objects reliably. Maybe something like Kryo and parse the output, but that's pretty hairy.

http://stackoverflow.com/q/26899596
has comment: http://stackoverflow.com/comment/42351943
answer count: 2
downvote count: 3
upvote count: 1
tagged with: external
has comment: http://stackoverflow.com/comment/42352315
favorite count: 0
has title: External Reading of a File
duplicate of: http://stackoverflow.com/q/5716095
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42351960
has answer: http://stackoverflow.com/a/26899681
has comment: http://stackoverflow.com/comment/42351985
has answer: http://stackoverflow.com/a/26899663
has body: I am currently working on an assignment and I am stumped on what to do next. I am not asking for you to do it for me I just need help on what to do next. I get an error on the line " number = inFile.nextInt();" and it says java.util.InputMismatchException: null (in java.util.Scanner) Description: You are to read an external file of random integer values until the end of file is found. As you read the file you should determine how many numbers are less than the value 500 and how many numbers are greater than or equal to 500. The output I need is: The number of numbers less than 500 is 192 The number of numbers greater than or equal to 500 is 208 The total number of numbers is 400 import java.io.*; import java.util.*; public class Prog209a { public static void main (String args[]) { Scanner inFile = new Scanner( "C:\\Users\\Air\\Documents\\java\\p209a.dat"); int number; //number int Lesser = 0; //count of numbers less than 500 int Greater = 0;//count of numbers greater than 500 or equal to 500 int Count = 0; while(inFile.hasNext()== true) { //input number = inFile.nextInt(); //decision making if (number &lt; 500) Lesser++; else Greater++; Count ++; } } }
tagged with: file
linked to: http://stackoverflow.com/q/5716095
type: Question
score: -2
tagged with: java

http://stackoverflow.com/a/26883102
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26871568
accepted answer of: http://stackoverflow.com/q/26871568
upvote count: 3
has body: JAXB discovers properties in a object by looking for properties that follow JavaBeans convention and public fields. The following example shows several properties than can be read (get) and written (set). Note that a JavaBeans property does not require that the underlying field has the same name. Other combinations are also possible. A read-only property, for example, has a getter method but no setter. A write-only property has a setter method only. A special case for boolean properties allows the accessor method to be defined using is instead of get. If JAXB discovers a clash (e.g. a public field named name and a getter named getName), it will fail. public class Example { public String first; // visible -&gt; maps to &lt;first&gt; private String second; private String third; private boolean fourth; public String getSecond() { // visible -&gt; maps to &lt;second&gt; return second; } public void setSecond(String s) second = s; } public String getSecondBis() { // visible -&gt; maps to &lt;secondBis&gt; return third; } public void setSecondBis(String s) third = s; } public boolean isFourth() { // visible -&gt; maps to &lt;fourth&gt; return fourth; } public vois setFourth(boolean b) fourth = b; } public String getFirst() { // invalid!!! getFirst clashes with public first return first; } public void setFirst(String s) first = s; } }

http://stackoverflow.com/comment/42417678
comment on: http://stackoverflow.com/a/26936693
has text: Just to make it super clear: both of your classes are in the same package if they are defined within the same .java file - hence protected works as expected in your scenario.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/26842165
favorite count: 0
tagged with: instanceof
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: The project has 4 classes. A Person, an Employee that extends Person and an Academic that extends Employee. I also have a Store, which is a user-made alternative to an Array. One of the functions of Store is ‘elementAt()’, which returns to us an object in Store. The problem I have is that elementAt() always returns as type Person. This is a huge problem because, in my Controller class, before I let the user perform an action only applicable to an Academic I NEED to check whether the user has actually chosen an employee or not. public Person elementAt(int index) { // Returns element at position index return list[index]; } There is one big problem; according to the project specification I cannot alter the Person, Employee, Academic or Store class any further. Meaning, I have to determine the type of the Store index somewhere, somehow within my controller class. I wanted to run this by people with more experience so thank you for having a look.
has answer: http://stackoverflow.com/a/26842421
possible better answer: http://stackoverflow.com/a/26842255
type: Question
has answer: http://stackoverflow.com/a/26842255
has title: instanceOf in a Controller class ok? (Cannot edit any other class)
tagged with: oop
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/42250322
downvote count: 0
accepted answer: http://stackoverflow.com/a/26842421

http://stackoverflow.com/a/27195123
accepted answer of: http://stackoverflow.com/q/26938205
downvote count: 0
type: AcceptedAnswer
has body: I've managed to make all work. Using the workarounds in my edit part of the question and some points of this article. Here's what I have to do: configurations { provided } sourceSets { main { compileClasspath += configurations.provided compileClasspath += configurations.compile compileClasspath += configurations.runtime java { srcDir 'src/main/application' } } } This made possible to use provided in the dependencies of all my projects and it does not mess with the eclipse project.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26938205

http://stackoverflow.com/comment/42259217
comment on: http://stackoverflow.com/q/26847582
type: Comment
has text: I initialized purchaseCount so that I can have the row value automatically. But it seems that it caused the error.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42493407
comment on: http://stackoverflow.com/a/26958515
has text: Thanks for you reply, James_D! I edited the question, adding my code for the controller. Now, I get an error message that says: package tableView does not exist.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42480936
comment on: http://stackoverflow.com/q/26972584
has text: @NoIdeaForName your suggestion I am also aware of thank you, but again in this case we also assume the parameters associated with the constructor are known. I could really do with an example of a case where it is assumed the parameters and their types are not known and null values are passed (as in the question). Thanks anyway
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26839673
score: 0
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/26840420
tagged with: graph
has answer: http://stackoverflow.com/a/26840563
has title: JAVA: Constructing a graph with DrawingPanel.java (provided); difficulty parsing input and correctly passing variables?
possible better answer: http://stackoverflow.com/a/26840563
type: AnsweredQuestion
has body: Here is where the DrawingPanel class is located, for compilation purposes, if necessary. DrawingPanel.java I am writing a program where I am supposed to graph a data set, which is stored in the following file, called "names.txt", using the class DrawingPanel. This java file allows you to create a panel of a given size, and draw shapes and lines in this panel. The problems I am encountering with my program are unrelated to the specifications and understandings of the class methods. The data set that I am supposed to graph using this java file is configured in the following way: [name] [gender] [ranking] [ranking] [ranking] [ranking]....etc for a total of 14 rankings. Example: Jane F 56 400 336 102 17 33 187 292 275 969 73 53 24 2 The user is supposed to input the name and gender they would like to see graphed. The data is then graphed, rankings representing the y axis and time representing the x axis. I have encountered a number of problems, such as correctly parsing and comparing the user input with the file. My main problem is drawing the lines that compose the graph. The lines of these graphs are drawn with the method: g.drawLine(x1, y1, x2, y2) with g representing a Graphics object. Two points are necessary as two endpoints are necessary to create a line. From the way that my program is currently configured, I have a while loop: while (file.hasNextLine() &amp;&amp; (fileContains = false)) { String inputLine = file.nextLine().toUpperCase(); if ((inputLine.contains(name) &amp;&amp; (inputLine.contains(gender)))){ String toBeRemoved = name.toUpperCase() + " " + gender.toUpperCase(); inputLine = inputLine.replace(toBeRemoved, " "); Scanner numberSplit = new Scanner(inputLine); rank = Integer.parseInt(numberSplit.next()); rank2 = Integer.parseInt(numberSplit.next()); fileContains = true; drawGraph(name, gender, rank, rank2); } } This while loop passes through the file and searches for lines that match user input. The reason why two variables for rankings, rank and ran…
tagged with: parsing
has answer: http://stackoverflow.com/a/26840420
type: Question
answer count: 2
tagged with: input

http://stackoverflow.com/q/26962414
has comment: http://stackoverflow.com/comment/42463408
has comment: http://stackoverflow.com/comment/42463067
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42463362
has comment: http://stackoverflow.com/comment/42463542
has comment: http://stackoverflow.com/comment/42463288
type: Question
has title: How to create library with classes that extends sdk?
has comment: http://stackoverflow.com/comment/42463049
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/42463282
has body: Let's say I have class public class Point extends Point2D.Double{ // Point2D is of course from sdk public void myMethod(){} //some actions } The problem is when I include this code as a library from .jar file to my another project I only have access to myMethod() and not to any fields and methods from Point2D.Double class. to give example: import com.mylibrary.Point public class SomeClass{ public SomeClass(){ Point myPoint = new Point(1,2); myPoint.myMethod(); // ok myPoint.getX(); // not ok althought there is getX() method in Point2D.Double class } } How can I get access to both compiled codes?
has comment: http://stackoverflow.com/comment/42463501
has comment: http://stackoverflow.com/comment/42463578
has comment: http://stackoverflow.com/comment/42463444

http://stackoverflow.com/a/26860302
has body: Surely there's already a lib which makes it possible, but I don't know it, so, if you want to do it by code, you can try to read it as plain text and do translation manually using BufferedReader and a few loops. Try this: BufferedReader qtIn = new BufferedReader(new FileReader("example.qt")); //I don't know if you can read it as plain text straight. String tag String metaTag String lineIn String lineOut BufferedWriter writer = new BufferedWriter(new FileWriter("example.xml")); //here you should use writer to write down the heading of the xml file. while ((lineIn = qtIn.readLine()) != null) { // while loop begins here. lineIn is the string where reader stores current line read. if (lineIn.charAt(lineIn.length() - 1) == "{"){ //if line's last character is an opening brace ({) metaTag = lineIn.subString(0, lineIn.length() - 1).trim(); //we store it in string metaTag lineOut = "&lt;"+metaTag+"&gt;\n"; //and write metaTag as opening XML tag writer.write (lineOut,0,lineOut.length()); }else if (lineIn.trim() == "}"){ //else, if it's a closing brace (}) lineOut = "&lt;/"+metaTag+"&gt;\n"; //we write metaTag as closing XML tag writer.write (lineOut,0,lineOut.length()); }else{ // if it's not an opening or closing brace String[] element = lineIn.split(":"); //we split the line in element name and element data using the colon as splitter. don't forget to use trim method on both parts. tag = element[0].trim(); //this is optional, you can replace it by using element[0].trim() instead in the next line, I added it just to make it clearer lineOut = "&lt;" + tag + "&gt;" + element[1].trim() + "&lt;/" + tag +"&gt;\n" // here, we take two element parts and write them as XML tag and plain text. writer.write (lineOut,0,lineOut.length()); } } // end while //here you should write the footing of the file, if there's any. writer.close(); // don't forget to close writer I think I'm not missing anything. Don't forget to close your file. Also, I'm parting from the concept that the structure of …
type: Answer
has comment: http://stackoverflow.com/comment/42319385
answers question: http://stackoverflow.com/q/26859707
has comment: http://stackoverflow.com/comment/42331496
has comment: http://stackoverflow.com/comment/42300883
score: 0

http://stackoverflow.com/q/26985638
tagged with: linux
upvote count: 1
tagged with: shared-libraries
favorite count: 0
has body: system.loadlibrary() and system.load() fails to load the .so file I have created but successfully loads other already present lib.so files. I am creating the lib file with following command: gcc -o .so -shared -Wall -fPIC -I/usr/local/java/jdk1.8.0_20/include -I/usr/local/java/jdk1.8.0_20/include/linux -I/usr/local/include/test -ltest -lrt -lpthread here the library calls some functions from a testlib.so, hence included test directory as well.. is there anything I am missing or doing wrong while creating the library??
has comment: http://stackoverflow.com/comment/42537214
type: UnansweredQuestion
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: syste.loadlibrary()/system.load() fails to load a library (.so) file
has comment: http://stackoverflow.com/comment/42506433
type: Question
has comment: http://stackoverflow.com/comment/42505140

http://stackoverflow.com/comment/42260657
type: QuestionComment
comment on: http://stackoverflow.com/q/26848347
score: 0
has text: `Sale * Production * Production % = Costs` can be done (the best of the possible ways) by overide setValueAt, why you posted a screenshot from MsExcel
type: Comment

http://stackoverflow.com/comment/42469483
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26966123
score: 0
has text: MainActivity.this you cant use in this fragment class use getActivity() instead while creating adapter. And try to solve one problem at time

http://stackoverflow.com/comment/42416126
has text: @Zéychin Youre absolutly correct and i am totally with you - i will add one last sentence to my answer in the hope next generation developers see where the issues oftenly are made (its the requirements not the code in my experience)
type: Comment
comment on: http://stackoverflow.com/a/26935560
type: AnswerComment
score: 0

http://stackoverflow.com/q/26889501
upvote count: 1
tagged with: unit-testing
type: Question
has title: android manual / semi-automated testing
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4381296
tagged with: android
has body: I am in the process of gradually switching from manual to automatic testing using junit in android. The problem is that for some of my tests full automatic validation seems to be not possible or too sophisticated. I need to validate, for example, if an image after some transformation is looking "good enough" or not. On the other hand, I do not want to run the whole application for this but have something like a unit test which tests only the method that does the transformation. And which mocks up some sample data and a simple ui to show the image. Main question: How do you usually perform tests like these for your android applications? Side question: A basic approach I came up with would be to write a junit test class and build in some kind of stop after each test so that one can see the result image on the phone and decide if it looks good or not. Ideally, a dialog would show up on the phone or on the developers computer and as soon as I press ok the next test will be performed. But it is not so easy to implement this as there is no blocking UI model in android (c.f. https://stackoverflow.com/a/4381387/3991799). Any ideas?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26889860

http://stackoverflow.com/a/26926606
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42400228
has body: These are the issues I've identified: Issue 1 You're creating a responseText string, but you're not writing it to the output stream, so it will not be present in the response that is sent back to the client. At the end of your try block (in new.jsp), after doing responseText += OptionValue; you need to add out.print(responseText); Issue 2 Your button is of type submit, so it submits the form. This means that the page will be reloaded immediately after calling the AJAX request. Add return false to your onclick handler as follows: &lt;input type="submit" name="Submit" value="CREATE" onclick="create(textfield.value); return false;"/&gt; Or change your buttom from a submit button to a regular button: &lt;input type="button" name="Submit" value="CREATE" onclick="create(textfield.value)"/&gt; Issue 3 You need to declare var xmlHttp outside of your create method. As it is now, your stateChanged() method has no access to your xmlHttp variable.
has comment: http://stackoverflow.com/comment/42400787
answers question: http://stackoverflow.com/q/26926502
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26926502

http://stackoverflow.com/comment/42271649
has text: I am attempting to run on raspberry pie with build 1.7.0_40-b43 on linux
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26854659
score: 0

http://stackoverflow.com/a/26948386
has body: The constructor will initilize your object "hello" of type "HelloWorldV3". If there is a code in the constructor, it will be executed when calling "new HelloWorldV3( )" in your first line of code of the method. So it will be executed before the method "printTwoLines". I hope I was clear :) Thanks.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26948343

http://stackoverflow.com/comment/42493106
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26979293
has text: The immediate question I have from yours is, "Why?" If you don't want to use what happens in `B`'s constructor then why does `C` extend `B` and not `A`? When you have issues like this you need to step back and reexamine if your approach is really the most clear and intuitive.

http://stackoverflow.com/comment/42463049
comment on: http://stackoverflow.com/q/26962414
type: Comment
has text: [This actually works fine for me.](http://ideone.com/Hs7Y7L)
score: 0
type: QuestionComment

http://stackoverflow.com/q/26954500
has title: Linear and Binary search logical error
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42448962
tagged with: java
has comment: http://stackoverflow.com/comment/42448946
type: Question
has answer: http://stackoverflow.com/a/26954590
accepted answer: http://stackoverflow.com/a/26954590
tagged with: arrays
tagged with: binary-search
has comment: http://stackoverflow.com/comment/42448994
score: 0
has comment: http://stackoverflow.com/comment/42448892
tagged with: linear-search
has body: I'm working on a program where I have to demonstrate the working of a linear and binary search algorithm. For that, I'm acceping an array of 20 numbers and a search key from the user. The code compiles, and no runtime errors are thrown. However, when I search for a number, say 12, in the array, instead of printing that the number was found in position 12, it says that the number was found in position 6: import java.util.*; class prg14 { int num [] = new int [20]; int search; public void lin (int arr[], int a) { num = arr; search = a; int i; int flag = 0; for (i=0; i&lt;num.length; i++) { if (search == num[i]) { flag = 1; break; } } if (flag == 1) { System.out.println("Linear Search : "); System.out.println(a+ " found at position " + (i + 1)); } else { System.out.println("Linear Search : "); System.out.print(a+ " not present in the list \n"); } } public void binary(int array[], int a) { int first = 0; int n = 20; int last = n - 1; int middle = (first + last)/2; while( first &lt;= last ) { if ( array[middle] &lt; search ) first = middle + 1; else if ( array[middle] == search ) { System.out.println("Binary search : "); System.out.println(search + " found at position " + (middle+1) + "."); break; } else last = middle - 1; middle = (first + last)/2; } if ( first &gt; last ) {System.out.println("Binary Search : "); System.out.println(search + " not present in the list.\n"); } } public static void main(String args[]) { Scanner sc = new Scanner(System.in); prg14 obj = new prg14(); System.out.println("Enter any 20 numbers."); String str; int linn[] = new int[20]; int i; for( i = 0; i&lt;10; i++) { str = sc.next(); linn[i] = sc.nextInt(); } System.out.println("Enter number to be searched."); int search = sc.nextInt(); obj.lin(linn, search); obj.binary(linn, search); } } How do I resolve this issue? TIA.
answer count: 1
has comment: http://stackoverflow.com/comment/42449038
has comment: http://stackoverflow.com/comment/42449056
has comment: http://stackoverflow.com/comment/42448974

http://stackoverflow.com/a/38545468
downvote count: 0
type: Answer
has body: Java version is: DescriptorMatcher descriptorMatcher; descriptorMatcher=DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING ); MatOfDMatch good_matches; good_matches = new MatOfDMatch(); LinkedList&lt;MatOfDMatch&gt; dmatchesListOfMat = new LinkedList&lt;&gt;(); descriptorMatcher.knnMatch(imgDescriptors1, imgDescriptors2, dmatchesListOfMat, 2); LinkedList&lt;DMatch&gt; good_matchesList = new LinkedList&lt;&gt;(); for (int matchIndx = 0; matchIndx &lt; dmatchesListOfMat.size() ; matchIndx++) { double ratio = 0.8; if (dmatchesListOfMat.get(matchIndx).toArray()[0].distance &lt; ratio * dmatchesListOfMat.get(matchIndx).toArray()[1].distance) { good_matchesList.addLast(dmatchesListOfMat.get(matchIndx).toArray()[0]); } } good_matches.fromList(good_matchesList);
answers question: http://stackoverflow.com/q/26860992
score: 4
upvote count: 4

http://stackoverflow.com/comment/42371915
type: Comment
has text: I'm really sorry, that was my bad. It was late and I just copy-pasted your code and launched the app. Indeed it kinda worked just that all items from the navigation panel were opening the same activity. Tried to solve it today but had no success, so I looked again at Mohammed's code and eventually got it working. Hope your not angry on me...next time I'll think twice when choosing the right answer.
comment on: http://stackoverflow.com/q/26894383
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42286364
type: QuestionComment
has text: 'I have other xml file which needs to ref the above location' - What's the location of the other xml file?
comment on: http://stackoverflow.com/q/26862513
score: 0
type: Comment

http://stackoverflow.com/comment/42406192
has text: The relevant Properties class extends Hashtable, not HashSet.
comment on: http://stackoverflow.com/a/26929937
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42863275
type: Comment
has text: Is it possible to create small models and later merge them to one? I am curious to know which library supports this?
comment on: http://stackoverflow.com/a/27123714
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42249757
has text: `Async` inside `Async` is wrong . Call `notifyDataSetChange` in `onPostExecute`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26843167
score: 0

http://stackoverflow.com/comment/42252176
type: QuestionComment
has text: Try to invoke some method on an `int` literal - clearly an `int` behaves very different than a "real" object.
comment on: http://stackoverflow.com/q/26844413
score: 0
type: Comment

http://stackoverflow.com/a/26974288
upvote count: 0
has body: try this private static long TIME_OUT_IN_SECONDS = 120; httpResponse = httpClient.execute(httpPost); long requestEndTime = new Date().getTime(); long timeOfRequest = (requestEndTime - requestStratTime) / 1000; if (httpResponse == null &amp;&amp; timeOfRequest &gt; TIME_OUT_IN_SECONDS) { throw new TimeOutException(); } This occurs when data takes too much time to respond that is requested, you are missing throws timeout exception.
score: -1
downvote count: 1
answers question: http://stackoverflow.com/q/26974162
type: Answer

http://stackoverflow.com/a/26983925
answers question: http://stackoverflow.com/q/26873050
upvote count: 5
accepted answer of: http://stackoverflow.com/q/26873050
type: AcceptedAnswer
downvote count: 0
has body: Not all local days have 24 hours. Assuming you are working in the US Pacific time zone, there are 25 hours on that particular day, due to the fall-back daylight saving time transition. Calling plusHours(24) adds an exact duration of 24 hours elapsed time. Calling plusDays(1) increments the calendar day, even if the day is not exactly 24 hours.
type: Answer
score: 5

http://stackoverflow.com/q/26979083
score: 1
tagged with: java
upvote count: 1
tagged with: tomcat6
type: Question
has answer: http://stackoverflow.com/a/26982449
has title: net::ERR_CONNECTION_RESET with Tomcat 6
tagged with: intellij-idea
tagged with: javascript
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26982449
tagged with: tomcat
favorite count: 0
has body: I just setup a Tomcat 6 instance in IntelliJ using Maven and an exploded WAR. The WAR deploys, and the Java classes are clearly loading and are debuggable. For some reason, loading js files is incredibly buggy. I keep getting net::ERR_CONNECTION_RESET errors from Chrome and the outcome is the same on other browsers (the pages incompletely load, with js files not being loaded because of net::ERR_CONNECTION_RESET errors). Even if I do direct links to the files (say localhost:8080/somejavascriptfile.js) and keep hitting refresh, half the time it'll just come up empty, half the time it will load. I've looked at other solutions and people keep saying I need to do something similiar to this response.setHeader("Cache-Control", "no-cache, no-store, must-revalidate"); // HTTP 1.1. response.setHeader("Pragma", "no-cache"); // HTTP 1.0. response.setDateHeader("Expires", 0); // Proxies. But that has had no effect. Any suggestions?
type: AnsweredQuestion

http://stackoverflow.com/comment/42425330
comment on: http://stackoverflow.com/a/26940599
has text: mostly because if his sorting requirement changes at the drop of a hat (this smells like homework, after all), oxyt now knows enough to do so. Worth pointing out that plain sort()'s natural already in the answer, though.
type: AnswerComment
score: 0
type: Comment

recursion
type: Tag
tags question: http://stackoverflow.com/q/26836227
tags question: http://stackoverflow.com/q/26839890
tags question: http://stackoverflow.com/q/26891227
tags question: http://stackoverflow.com/q/26889877
tags question: http://stackoverflow.com/q/26873488
tag name: recursion
tags question: http://stackoverflow.com/q/26852076
tags question: http://stackoverflow.com/q/26961387
tags question: http://stackoverflow.com/q/26913898
tags question: http://stackoverflow.com/q/26911812
tags question: http://stackoverflow.com/q/26945086
tags question: http://stackoverflow.com/q/26939820
tags question: http://stackoverflow.com/q/26911328
tags question: http://stackoverflow.com/q/26946159
tags question: http://stackoverflow.com/q/26883474
tags question: http://stackoverflow.com/q/26983457
tags question: http://stackoverflow.com/q/26938621
tags question: http://stackoverflow.com/q/26954119
tags question: http://stackoverflow.com/q/26910992
tags question: http://stackoverflow.com/q/26909236
tags question: http://stackoverflow.com/q/26990610
tags question: http://stackoverflow.com/q/26921631
tags question: http://stackoverflow.com/q/26965607
tags question: http://stackoverflow.com/q/26952968

http://stackoverflow.com/q/26892951
has title: Generics have unexpected behaior using primitives array instead of wrapper array
type: Question
answer count: 1
tagged with: arrays
linked to: http://stackoverflow.com/q/26814064
score: 0
has body: The following code is returning a List of Integer: Integer[] arr = new Integer[] {3,2,1}; List&lt;Integer&gt; list = Arrays.asList(arr); Why is the same code using "int" returning a List of int[]: int[] arr = new int[] {3,2,1}; List&lt;int[]&gt; list = Arrays.asList(arr);
tagged with: generics
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42339759
tagged with: java
has answer: http://stackoverflow.com/a/26893004

http://stackoverflow.com/comment/42545524
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26986539
has text: @MadProgrammer: You are right..i decided to go with StanislavL's solution, which involved setting the text value in a dummy editorpane and getting its height from its preferred size. Seems to come up good in the UI, JFYI...my code also worked with getSize() after adding a padding, but i decided to stick with the other implementation as it will be a more 'generic' way for my code

http://stackoverflow.com/a/27984305
answers question: http://stackoverflow.com/q/26910933
score: 0
upvote count: 1
type: AcceptedAnswer
downvote count: 1
has body: Issue has been resolved by itself. I migrated to jax-rs while cloud endpoints were failing. Recently I tried to switch back cloud endpoints worked fine. Maybe it's related to appengine version, I'm nut sure. There were several version updates while I was on jax-rs.
has comment: http://stackoverflow.com/comment/45872190
type: Answer
has comment: http://stackoverflow.com/comment/45912303
accepted answer of: http://stackoverflow.com/q/26910933

http://stackoverflow.com/comment/42258378
has text: Use [`String.replace(char, char)`](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#replace-char-char-)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26847785

http://stackoverflow.com/comment/42433047
type: Comment
has text: @PaulKukowski I tried it on another box : just copied your code and replaced the 3 methods from my answer. It gave me the correct result, so I cannot understand why you get a NPE if you did the same.
type: AnswerComment
comment on: http://stackoverflow.com/a/26912685
score: 0

http://stackoverflow.com/comment/42322672
score: 0
has text: You use whatever widget and get the date from it in a native Date format. Then store it in the database.
type: Comment
comment on: http://stackoverflow.com/q/26863012
type: QuestionComment

http://stackoverflow.com/a/26863028
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26862684
upvote count: 2
answers question: http://stackoverflow.com/q/26862684
has body: That has nothing to do with the generator. The error message is extremely clear: NOT NULL check constraint; SYS_CT_10093 table: CUSTOMER column: FIRST_NAME So, you're trying to insert a row in the customer table, which has a not null column named FIRST_NAME, and for which no value is provided. So you get a constraint violation exception. The SQL statement is insert into Customer (FirstName, Surname, code, customerType, id) so, you see, there is no value inserted for FIRST_NAME. That also shows that your table has a column named FirstName, and another one named FIRST_NAME. That's really not a good idea.
has comment: http://stackoverflow.com/comment/42286457
has comment: http://stackoverflow.com/comment/42286161
score: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/42374300
comment on: http://stackoverflow.com/q/26900282
type: Comment
type: QuestionComment
has text: Mhhh..that might be the case. Thanks for pointing that out. Will look into it.
score: 0

http://stackoverflow.com/comment/112744202
type: AnswerComment
type: Comment
has text: this is not correct, using {1, null,2, 3} gives null pointer exception in fromArray
comment on: http://stackoverflow.com/a/56246354
score: 0

http://stackoverflow.com/comment/42433503
type: QuestionComment
score: 0
has text: You can't use `rawQuery()` to execute SQL **commands** (it is only for **queries**). Use `execSQL()`, instead. `sqLiteDatabase.execSQL("UPDATE collection SET datetime = '" + newDate + "' WHERE region = " + region, null);`
comment on: http://stackoverflow.com/q/26945507
type: Comment

http://stackoverflow.com/q/26974297
score: 0
has comment: http://stackoverflow.com/comment/42483857
has body: I've created a local HTTP server using Java Grizzly, with the basic structure: public static void main(String[] args) throws IOException { Converter.register(); //local register final HttpServer server = startServer(); System.out.println(String.format("Jersey app started with WADL available at " + "%sapplication.wadl\nHit enter to stop it...", BASE_URI)); System.in.read(); server.shutdown(); } When I run a GET request on a local browser, everything is fine: But when I try to do it with jQuery $.get() (using Brackets IDE Live Preview), it fails: function getRequest(){ var apiString = buildRequest(); $.get("http://localhost:8080/concord/webapi/from/dna/chr/10/strand/1/52500001..52567500/to/rna",function(r){ $('#outputPanel').text(r); }) .fail(function(err){ // WHY THIS FAILS ?!?! console.log(err); }); } I can see in the Console that I get the following error: XMLHttpRequest cannot load http://localhost:8080/concord/webapi/from/dna/chr/10/strand/1/52500001..52567500/to/rna. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:61484' is therefore not allowed access. When I call for a remote response (e.g. github api) it works. I'm looking for any suggestions, thx.
answer count: 0
type: UnansweredQuestion
tagged with: adobe-brackets
has comment: http://stackoverflow.com/comment/42484177
has title: Failing to get response from local Grizzly server using jQuery GET request in Brackets IDE preview
has comment: http://stackoverflow.com/comment/42484024
tagged with: grizzly
has comment: http://stackoverflow.com/comment/42483918
tagged with: java
type: Question
tagged with: jquery
tagged with: get

http://stackoverflow.com/a/26836553
has comment: http://stackoverflow.com/comment/42238764
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26836521
has body: class MemoryCalc { private double currentValue; } class SciMemCalc extends MemoryCalc { private double currentValue; } What is happening here is there are actually two variables declared with the same name. SciMemCalc does not have access to the variable declared in MemoryCalc because it is private. Instead you would normally make currentValue protected or interact with it through setters and getters. class MemoryCalc { protected double currentValue; } class SciMemCalc extends MemoryCalc { // SciMemCalc has access to currentValue }
score: 3

http://stackoverflow.com/q/26905227
has comment: http://stackoverflow.com/comment/42361390
upvote count: 10
type: Question
has comment: http://stackoverflow.com/comment/42362088
has comment: http://stackoverflow.com/comment/42369066
score: 10
has answer: http://stackoverflow.com/a/26909892
accepted answer: http://stackoverflow.com/a/26909892
tagged with: h2db
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/85526695
favorite count: 0
has comment: http://stackoverflow.com/comment/42361382
has title: Unable to get results from H2 db
type: AnsweredQuestion
has body: I'm trying to get values from h2 db, but always getting this error org.h2.jdbc.JdbcSQLException: No data is available [2000-171] at org.h2.message.DbException.getJdbcSQLException(DbException.java:329) at org.h2.message.DbException.get(DbException.java:169) at org.h2.message.DbException.get(DbException.java:146) at org.h2.message.DbException.get(DbException.java:135) at org.h2.jdbc.JdbcResultSet.checkOnValidRow(JdbcResultSet.java:2956) at org.h2.jdbc.JdbcResultSet.get(JdbcResultSet.java:2962) at org.h2.jdbc.JdbcResultSet.getInt(JdbcResultSet.java:306) I googled for an answer Make sure to call rs.next(); prior to using any of the getter methods. But I do call rs.next() ... Here's my code: public User getUser(int userId) throws SQLException { User u = new User(userId); try { Statement st = conn.createStatement(); ResultSet rs = st.executeQuery("SELECT * FROM invited_users WHERE user_id=" + userId); rs.next(); u.setName(rs.getString("user_name")); } catch (SQLException except) { JOptionPane.showMessageDialog(null, "Unable to load user! " + except); } return u; }
tagged with: java
tagged with: h2

http://stackoverflow.com/q/26921081
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26921194
score: 1
has comment: http://stackoverflow.com/comment/42390228
has title: Reading input file with names and scores, use ArrayLists to compute values
has body: I haven input file in the following format: Rory Williams 88 92 78 -1 James Barnes 87 76 91 54 66 -1 and so on.... I want to read the scores from each person until I hit -1 and store the scores in an ArrayList. I understand how to get the scores into an ArrayList for one person, but I don't understand how to group the scores by person or to read scores in for the next person. For an individual, my method looks like this: private static ArrayList&lt;Integer&gt; readNextSeries(Scanner in) { ArrayList&lt;Integer&gt; scores = new ArrayList&lt;Integer&gt;(); int x=0; while (in.hasNextLine()) { if (scores.get(x)!=-1) { scores.add(in.nextInt()); x++; } } return scores; } We have to be able to somehow store the scores for different people because then we have to compute the mean, median, maximum, and minimum score for each person and then the highest average score and lowest average score out of the group of people. My only other thought was that maybe I could create a separate ArrayList for each person using their name as the ArrayList name - I'm not sure that's correct though.
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26921131
tagged with: arraylist
answer count: 2
upvote count: 1

http://stackoverflow.com/q/26973191
score: 0
upvote count: 1
tagged with: intentservice
answer count: 1
downvote count: 1
tagged with: java
has body: In Android I need to start a service imediatlly after a database query so I can request missing bytes from an App. I'm calling it like this: Intent service = new Intent("br.com.company.intent.DO_CHUNK_REQUEST"); service.putExtra("FIELD_NAME", fieldName); service.putExtra("JOB_NAME", jobName); service.putExtra("START_BYTE", 500); service.putExtra("LENGTH", 100); AWS myCall = new AWS(); myCall.chama_servico(service); and I created a another class to work as a "service caller", since I can't extend my class to SQLiteOpenHelper and Service at the same time. My class is like this: package br.com.company.AWService; import android.app.Service; import android.content.Intent; import android.os.IBinder; public class AWS extends Service { @Override public IBinder onBind(Intent intent) { return null; } public void chama_servico (Intent service) { startService(service); } } But when I run this code I get an NullPointerException at startService(service). What Am I doing wrong? Is there a better/correct way to call a service after a database query? Thanks!
has comment: http://stackoverflow.com/comment/42481739
has comment: http://stackoverflow.com/comment/42481627
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26973346
has comment: http://stackoverflow.com/comment/42482058
type: Question
tagged with: android
favorite count: 0
has title: How do I call a service from inside a SQLiteOpenHelper class?

http://stackoverflow.com/comment/77785053
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/31891805
score: 1
has text: I am getting it with 2017.2 and SprintBootTest outer class and SpringBootApplication static inner class as per Spring Cloud Stream testing example: https://docs.spring.io/spring-cloud-stream/docs/current/reference/html/_testing.html

http://stackoverflow.com/comment/42444216
has text: I know that usually huge projects are divided to smaller modules, but then Maven is the main used tool. I have never taken part in such a big project because for now I am just an amateur :P You are right. However, I would suggest you to take up Maven and start to use it, it is amazingly useful and can help you with file storing
type: Comment
comment on: http://stackoverflow.com/a/26950033
type: AnswerComment
score: 0

http://stackoverflow.com/q/26905449
type: AnsweredQuestion
has title: Access list of lists in a random way
possible better answer: http://stackoverflow.com/a/26905762
type: Question
has answer: http://stackoverflow.com/a/26905762
has answer: http://stackoverflow.com/a/26905592
score: 0
answer count: 2
has body: I'm trying to create a list of lists and populate them as required, but I'm getting array out of bounds exception. My code is: List&lt;List&lt;String&gt;&gt; seperatedData = new ArrayList&lt;List&lt;String&gt;&gt;(); int index; while ((line = br.readLine()) != null) { String[] data = line.split(","); index = data[0].hashCode() % redCount; if(seperatedData.get(index) == null) { List&lt;String&gt; single = new ArrayList&lt;String&gt;(); seperatedData.add(single); seperatedData.get(index).add(line); } else { seperatedData.get(index).add(line); } }
tagged with: java
accepted answer: http://stackoverflow.com/a/26905592

http://stackoverflow.com/comment/42553439
comment on: http://stackoverflow.com/q/26866759
type: Comment
type: QuestionComment
has text: http://java.dzone.com/articles/thats-impossible-or-finding mentions that JIT bugs could caused 'impossible' exceptions.
score: 0

http://stackoverflow.com/q/26903045
tagged with: jdbc
has title: How to pass the values of user defined datatype variable to MS SQL from java using spring jdbc store procedure
tagged with: spring-jdbc
type: AnsweredQuestion
tagged with: stored-procedures
tagged with: java
tagged with: mssql-jdbc
type: Question
has body: I have the below MS SQL store procedure with the user defined variable (@Location CREATE PROCEDURE [Organization].[Organization_Insert] ( @OrganizationID NVARCHAR(256), @Location Locationtype ReadOnly ) @Location has following attributes: OrganizationSubID, LocationCode Am using the below java class to invoke the store procedure, class OrganizationInsertProcedure extends StoredProcedure { private final String[] outputParameters = new String[] {OUTPUT}; public PlanActivityInsertProcedure(DataSource dataSource) { super(dataSource, "Organization_Insert"); declareParameter(new SqlParameter("@OrganizationID", Types.NVARCHAR)); declareParameter(new SqlParameter("@Location", Types.ARRAY, "Locationtype")); compile(); } Here, my question is, how to construct the @Location variable from java and pass it to the MS SQL database. (am using sqljdbc4.jar driver to connect the database) I whole day Googled and tried many implementations and nothing paid off. Please someone shed some lights on this...
accepted answer: http://stackoverflow.com/a/26957055
has comment: http://stackoverflow.com/comment/42452167
score: 0
has answer: http://stackoverflow.com/a/26957055
answer count: 1

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

http://stackoverflow.com/comment/42290662
comment on: http://stackoverflow.com/q/26865623
has text: You could do it with Regular Expressions, Subtrings + IndexOf or with the URL-class.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42447257
type: Comment
has text: So he has a `0%` chance? Edit: isn't this just 25%? Wouldn't `rand.nextInt(4) < 3` make more sense?
comment on: http://stackoverflow.com/a/26953486
type: AnswerComment
score: 4

http://stackoverflow.com/q/26987594
accepted answer: http://stackoverflow.com/a/26987996
tagged with: java
has comment: http://stackoverflow.com/comment/42507789
has body: In my application, i need to send mail for multiple recipients but i can able to send only one recipient. I try using semi colon that also wont work. I tried but i didnt get any solution, if anyone know about this please make me to know about that.Hope someone will help me to find. Thanks in advance. import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collection; import java.util.List; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; @WebServlet("/SendMailAttachServlet") @MultipartConfig(fileSizeThreshold = 1024 * 1024 * 2, // 2MB maxFileSize = 1024 * 1024 * 10, // 10MB maxRequestSize = 1024 * 1024 * 50) // 50MB public class SendMailAttachServlet extends HttpServlet { private String host; private String port; public void init() { // reads SMTP server setting from web.xml file ServletContext context = getServletContext(); // host = context.getInitParameter("host"); port = context.getInitParameter("port"); } /** * handles form submission */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { List&lt;File&gt; uploadedFiles = saveUploadedFiles(request); host="smtp.gmail.com"; port="587"; String user = request.getParameter("Sender"); String pass = request.getParameter("Password"); String recipient = request.getParameter("recipient"); System.out.println(recipient); String subject = request.getParameter("subject"); String content = request.getParameter("content"); String resultMessage = ""; try { EmailUtility.sendEmailWithAttachment(host, port, user, pass, recipient, subject, content, uploadedFiles); resultMessage = "The e-mail…
type: Question
tagged with: jakarta-mail
answer count: 2
upvote count: 6
has answer: http://stackoverflow.com/a/54899228
tagged with: smtp
favorite count: 0
possible better answer: http://stackoverflow.com/a/54899228
has title: I need to send mail for multiple recipients
tagged with: email
linked to: http://stackoverflow.com/q/13854037
downvote count: 0
score: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26987996

http://stackoverflow.com/comment/42366930
has text: can you post your AngularJS code that is responsible for calling your rest service??
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26907296
score: 0

http://stackoverflow.com/q/26855345
score: 1
favorite count: 0
tagged with: compiler-errors
answer count: 2
has comment: http://stackoverflow.com/comment/42273295
upvote count: 1
has title: Issues with Java Class
tagged with: java
has answer: http://stackoverflow.com/a/26855411
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26855578
has comment: http://stackoverflow.com/comment/42272942
tagged with: class
has body: I'm having trouble with a homework assignment, creating a class that calls methods from another class. We are given the following class: /** A bank account has a balance that can be changed by deposits and withdrawals. */ public class BankAccount { private double balance; /** Constructs a bank account with a zero balance. */ public BankAccount() { balance = 0; } /** Constructs a bank account with a given balance. @param initialBalance the initial balance */ public BankAccount(double initialBalance) { balance = initialBalance; } /** Deposits money into this account. @param amount the amount to deposit */ public void deposit(double amount) { balance = balance + amount; } /** Makes a withdrawal from this account, or charges a penalty if sufficient funds are not available. @param amount the amount of the withdrawal */ public void withdraw(double amount) { final double PENALTY = 10; if (amount &gt; balance) { balance = balance - PENALTY; } else { balance = balance - amount; } } /** Adds interest to this account. @param rate the interest rate in percent */ public void addInterest(double rate) { double amount = balance * rate / 100; balance = balance + amount; } /** Gets the current balance of this account. @return the current balance */ public double getBalance() { return balance; } } I'm then given the following prompt: "Implement a class Portfolio. This class has two objects, checking and savings, of the type BankAccount. Implement four methods: public void deposit(double amount, String account) public void withdraw(double amount, String account) public void transfer(double amount, String account) public double getBalance(String account) Here the account string is "S" or "C". For the deposit or withdrawal, it indicates which account is affected. For a transfer, it indicates the account from which the money is taken; the money is automatically transferred to the other account." So here is what I've done: public class Portfolio { BankAccount checking; BankAccount savings;…
type: Question

http://stackoverflow.com/comment/42408391
has text: What is the sound format? I had problems with sounds that can be played via MediaPlayer, but not from notifications... try to replace your sound file by a wmv, for example. (I don't remember exactly the file format I had problems with)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26931490

http://stackoverflow.com/a/26877740
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26877715
downvote count: 0
type: Answer
has body: The String input in menu() is a different variable from the String input in main. The menu function should be returning the value for selectedNum to use. Once that fix is made, menu(); selectedNum = Integer.parseInt(input); should be changed to: selectedNum = Integer.parseInt(menu());
has comment: http://stackoverflow.com/comment/42312890

http://stackoverflow.com/a/26899860
has body: You have your source and target set in the wrong place; they should be on maven-compiler-plugin.
accepted answer of: http://stackoverflow.com/q/26899694
answers question: http://stackoverflow.com/q/26899694
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42352543

http://stackoverflow.com/a/26938311
answers question: http://stackoverflow.com/q/26938123
downvote count: 0
has body: The basic answer is that in OOP you don't share variables like this. One of the main points of OOP (as well as other modular programming paradigms) is encapsulation. An object can be modified or queried according to how its public interface specifies that it can. To modify the object's state or change its behavior, you have to call one of the methods belonging to that object. That way, the object is in full control of its own state; it knows when its own methods are called, and those methods alone are able to modify the object's state information. Having a shared variable would ruin all that. If a variable were shared between two objects, then when one object assigns to the variable, it could modify the behavior of the other object in a way that the other object can't control. So this is something to be avoided. Instead, one of the objects will need to call a method of the other object. Most likely, if you have a turnOn method of your LightSwitch, it will need to turn on the Light. The most straightforward way to do this, I think, is to tell the LightSwitch in its constructor what Light it will turn on: public LightSwitch (Light light) { ... } or, if it controls more than one light, public LightSwitch(Light[] light) { ... } // or use a List or Set or whatever Then the constructor will save this reference, and its turnOn method will then call light.turnOn(). That's how you would handle this in OOP, not with a shared variable.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26950197
has comment: http://stackoverflow.com/comment/42443761
tagged with: gwt
tagged with: java
type: Question
has body: My GWT project is working in development mode. After compiling the project an running it on tomcat server I get the following error: Failure her500 Internal Server Error The call failed on the server; see server log for details The server log: t-8.0.15\webapps\PurchaseOrder 15-Nov-2014 20:50:36.375 INFO [localhost-startStop-1] org.apache.catalina.startu p.HostConfig.deployDirectory Deployment of web application directory C:\apache-t omcat-8.0.15\webapps\PurchaseOrder has finished in 40 ms 15-Nov-2014 20:50:36.376 INFO [localhost-startStop-1] org.apache.catalina.startu p.HostConfig.deployDirectory Deploying web application directory C:\apache-tomca t-8.0.15\webapps\ROOT 15-Nov-2014 20:50:36.411 INFO [localhost-startStop-1] org.apache.catalina.startu p.HostConfig.deployDirectory Deployment of web application directory C:\apache-t omcat-8.0.15\webapps\ROOT has finished in 35 ms 15-Nov-2014 20:50:36.417 INFO [main] org.apache.coyote.AbstractProtocol.start St arting ProtocolHandler ["http-apr-8080"] 15-Nov-2014 20:50:36.432 INFO [main] org.apache.coyote.AbstractProtocol.start St arting ProtocolHandler ["ajp-apr-8009"] 15-Nov-2014 20:50:36.433 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 2707 ms 15-Nov-2014 20:56:06.865 INFO [localhost-startStop-2] org.apache.catalina.startu p.HostConfig.deployDirectory Deploying web application directory C:\apache-tomca t-8.0.15\webapps\war 15-Nov-2014 20:56:18.339 INFO [localhost-startStop-2] org.apache.jasper.servlet. TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scan ned but no TLDs were found in them. Skipping unneeded JARs during scanning can i mprove startup time and JSP compilation time. 15-Nov-2014 20:56:18.379 INFO [localhost-startStop-2] org.apache.catalina.startu p.HostConfig.deployDirectory Deployment of web application directory C:\apache-t omcat-8.0.15\webapps\war has finished in 11,514 m…
has comment: http://stackoverflow.com/comment/42443250
tagged with: apache
tagged with: tomcat
has answer: http://stackoverflow.com/a/26954468
score: 0
answer count: 1
has title: 500 Internal Server error deploying GWT app on Apache Tomcat server
type: UnansweredQuestion

http://stackoverflow.com/q/26849496
tagged with: java
tagged with: mtom
tagged with: jaxb
type: Question
upvote count: 2
has body: I have a CXF based web service that is using MTOM. It's using MTOM perfectly fine, however there are some byte[] fields that I always want to be inline in the SOAP XML. I do NOT want them to be sent as mime attachments. Even if I do not use the @XmlMimeType attribute on the byte array responses always use MTOM on the byte fields. Is it possible to have some byte arrays place the payload inline and others use MTOM? The only way I have seen this possible is based on size by using the threshold, but this is not what I want. Example: public class Content { //I want this field inline private byte[] contentNONMTOM; //I want this field to be attached/MTOM @XmlMimeType("application/octet-stream") private byte[] contentMTOM ....
has title: Use MTOM on only certain fields, other fields inline - CXF SOAP
has answer: http://stackoverflow.com/a/26850236
accepted answer: http://stackoverflow.com/a/26850236
answer count: 1
tagged with: soap
favorite count: 0
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: cxf

http://stackoverflow.com/comment/42254311
type: QuestionComment
comment on: http://stackoverflow.com/q/26840096
type: Comment
has text: two mistakes, 1. Substance has better and intesive buggy history (with comparing in former Sun was Nimbus quite ignored) and has a few excelent themes, NImbus has a few new bugs in Java7 (JLabel, JButton and most of keys aren't refresehed from nimbus base) 2. Sunstance is alive, has Java7 version, 3. reason for linking tha Substance is fact that in one JFrames window is possible to test and to compare all good custom L&Fs (required to download before) 4. again to search for custom L&Fs based on Nimbus, keys are accesible, settable
score: 0

http://stackoverflow.com/comment/42303817
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26872781
has text: You already seem to have the means to parse html/xml. `class="Bla"` is just a class name mostly used to address css style-sheets or as identifiers for JavaScript it's just a name don't mix it up with `style="visibility:hidden"` or `type="hidden"`

http://stackoverflow.com/comment/42319487
has text: @anonimoo90 I think you'll need to refactor your code. OutOfMemory? How much memory do you have?
score: 0
comment on: http://stackoverflow.com/a/26880332
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42247724
score: 0
has text: You could use an xml like this .. `<bean id="myItemReader" class="your.package.MyItemReader" scope="step"/>`. Without scope step you defining a singleton bean.
comment on: http://stackoverflow.com/q/26839410
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42408485
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26931604
has text: there is not .play() as i tried. it was working before but i don't understand why it is stop working, maybe because i've been playing around the code.

http://stackoverflow.com/comment/42527758
comment on: http://stackoverflow.com/a/26978564
score: 0
type: Comment
has text: Okay, thanks. And if there's a method in the class that I want to call everytime, with the name "hello" (it doesn't have to exist). Can I somehow save this method in a variable so that incase that method exists, I invoke it every time before the other method?
type: AnswerComment

http://stackoverflow.com/a/26871706
has comment: http://stackoverflow.com/comment/42301840
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26871663
has body: Edit: Why without a for loop? Use a StringBuilder StringBuilder builder = new StringBuilder(); builder.append( myArray.remove(0)); for( String s : myArray) { builder.append( "&amp;"); builder.append( s); } String result = builder.toString();
upvote count: 2
has comment: http://stackoverflow.com/comment/42301743

http://stackoverflow.com/q/26933577
tagged with: java
has comment: http://stackoverflow.com/comment/42416338
type: Question
has comment: http://stackoverflow.com/comment/42412008
tagged with: websphere
has comment: http://stackoverflow.com/comment/42412691
tagged with: sql-server
score: 0
has body: I am having a problem that the DataSource is not reusing the connections it is creating a new one. The problem is then that it runs out of allowed connections. I am using Java, MSSQL and Websphere. Here is how I open the connection: public static Connection open(boolean transaction) throws NamingException, SQLException { Context ctx; Connection con = null; ctx = new InitialContext(); DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/MYDB"); if (ds == null) { throw new NamingException("No data source"); } con = ds.getConnection(); if (con == null) { throw new SQLException("No database connection"); }else{ con.setAutoCommit(!transaction); } return con; } In the finally of every DAO function I have a close function that closes everything. public static void close(ResultSet rs, PreparedStatement ps, Connection con) throws SQLException{ if (rs != null) { try { rs.close(); } catch (SQLException e) { throw e;} } if (ps != null) { try {ps.close(); } catch (SQLException e) { throw e;} } if (con != null) { if(con.getAutoCommit()){ try { con.close(); } catch (SQLException e) { throw e;} } } } These functions I am working with are not transaction based connections. Every time the loop comes around to a function the code calls the open connection but instead of using one already established it creates a new one. I am monitoring the connections created in the Activity Monitor of the SQL Server Management Studio. Any ideas why it is not reusing the connections? EDIT: Here is the connection pool properties from Websphere: Solution: So as it happens in most occasions, I was shooting my self in the foot. Turns out the close function above is correct but it is also being called in the Finally statement of a commit or rollback, which it wont close the connection. I changed the program to set the autocommit to true after a commit or rollback so it can close it correctly. And sure enough that was the issue. Thanks for your help.
has comment: http://stackoverflow.com/comment/42412057
has comment: http://stackoverflow.com/comment/42419639
type: UnansweredQuestion
has title: How to ensure that connections will be reused in pool
tagged with: connection-pooling
has comment: http://stackoverflow.com/comment/42412384
answer count: 0
has comment: http://stackoverflow.com/comment/42413097
has comment: http://stackoverflow.com/comment/42412033

http://stackoverflow.com/a/26835919
has comment: http://stackoverflow.com/comment/42237777
type: Answer
score: 1
has body: I think your logic on implementing onFinish is wrong. onFinish getting called after your timer has been done or you called cancel. You should move the mCountDownTimer.cancel(); to the last question (probably), and it will call onFinish automatically. In your current code, your timer will be canceled only if the timer has been done, because you called cancel in the onFinish.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26835878
answers question: http://stackoverflow.com/q/26835878
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42266605
type: Comment
has text: @SotiriosDelimanolis Well = is just comparing the left and right to see if they are the same and == is comparing to see if their refer to the same variable?
comment on: http://stackoverflow.com/q/26851973
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42450242
comment on: http://stackoverflow.com/a/26955256
type: AnswerComment
has text: @Christian.tucker it's not about how long it takes, for the reason not to use finalize for anything else see http://stackoverflow.com/questions/2506488/when-is-the-finalize-method-called-in-java
score: 0
type: Comment

http://stackoverflow.com/comment/42460132
type: AnswerComment
score: 0
type: Comment
has text: It was not that easy, cause our build script has grown significantly in last two years. As you can see in my answer below test task didn't even have specified classpath property. Anyway you helped me to get under way, thank you
comment on: http://stackoverflow.com/a/26911053

http://stackoverflow.com/comment/42340472
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26892404
has text: I meant the first screenshot. The one from the file browser ;-)
score: 0

jpa
tags question: http://stackoverflow.com/q/26903555
tags question: http://stackoverflow.com/q/26911562
tags question: http://stackoverflow.com/q/26934011
tags question: http://stackoverflow.com/q/26943523
tags question: http://stackoverflow.com/q/26971454
tags question: http://stackoverflow.com/q/26860144
tags question: http://stackoverflow.com/q/26908769
tags question: http://stackoverflow.com/q/26861475
tags question: http://stackoverflow.com/q/26866608
tags question: http://stackoverflow.com/q/26928328
tags question: http://stackoverflow.com/q/26928840
tags question: http://stackoverflow.com/q/26865654
tags question: http://stackoverflow.com/q/26873107
tags question: http://stackoverflow.com/q/26865063
tags question: http://stackoverflow.com/q/26969991
tags question: http://stackoverflow.com/q/26871957
tags question: http://stackoverflow.com/q/26878396
tags question: http://stackoverflow.com/q/26981379
tags question: http://stackoverflow.com/q/26932184
tags question: http://stackoverflow.com/q/26962589
tags question: http://stackoverflow.com/q/26948403
tags question: http://stackoverflow.com/q/26977173
tags question: http://stackoverflow.com/q/26891009
tags question: http://stackoverflow.com/q/26862684
tags question: http://stackoverflow.com/q/26842986
tags question: http://stackoverflow.com/q/26875236
tags question: http://stackoverflow.com/q/26896051
type: Tag
tags question: http://stackoverflow.com/q/26905155
tags question: http://stackoverflow.com/q/26851096
tags question: http://stackoverflow.com/q/26920381
tags question: http://stackoverflow.com/q/26858335
tags question: http://stackoverflow.com/q/26931157
tags question: http://stackoverflow.com/q/26974273
tags question: http://stackoverflow.com/q/26903002
tags question: http://stackoverflow.com/q/26880633
tags question: http://stackoverflow.com/q/26977766
tags question: http://stackoverflow.com/q/26951322
tags question: http://stackoverflow.com/q/26897556
tags question: http://stackoverflow.com/q/26862289
tags question: http://stackoverflow.com/q/26868661
tags question: http://stackoverflow.com/q/26916239
tags question: http://stackoverflow.com/q/26908557
tags question: http://stackoverflow.com/q/26971483
tags question: http://stackoverflow.com/q/26984496
tags question: http://stackoverflow.com/q/26892426
tags question: http://stackoverflow.com/q/26980362
tags question: http://stackoverflow.com/q/26969270
tags question: http://stackoverflow.com/q/26979774
tags question: http://stackoverflow.com/q/26911311
tags question: http://stackoverflow.com/q/26885040
tags question: http://stackoverflow.com/q/26862098
tag name: jpa
tags question: http://stackoverflow.com/q/26890149
tags question: http://stackoverflow.com/q/26991102
tags question: http://stackoverflow.com/q/26878979
tags question: http://stackoverflow.com/q/26842334
tags question: http://stackoverflow.com/q/26980437
tags question: http://stackoverflow.com/q/26896490
tags question: http://stackoverflow.com/q/26856452
tags question: http://stackoverflow.com/q/26890984
tags question: http://stackoverflow.com/q/26934383
tags question: http://stackoverflow.com/q/26957647
tags question: http://stackoverflow.com/q/26908207
tags question: http://stackoverflow.com/q/26927157
tags question: http://stackoverflow.com/q/26979128
tags question: http://stackoverflow.com/q/26971584

http://stackoverflow.com/q/26984754
type: Question
has body: I have the following Runnable.run() method: public void run() { calculateStuff(); boolean ioSuccesful = IOforThisRunnable(); while(!ioSuccesful ) { Thread.sleep(500); // alternative? boolean ioSuccesful = IOforThisRunnable(); } } I want to execute this code in a ThreadPoolExecutor with a maximum number of Threads. Now for my question: Suppose my threadpool consist of 5 threads. In the current example 5 runnables would block execution for any additional Threads since Thread.sleep() does not release the thread?! (if IO is not succesful) Is there any way to release the thread instead of using Thread.sleep() so that other runnables can start executing while another is waiting for IO? So that in the worst case scenario all runnables would be sitting in while loop?
has answer: http://stackoverflow.com/a/26985188
answer count: 1
accepted answer: http://stackoverflow.com/a/26985188
score: 0
has title: Java ThreadPoolExecutor release thread to thread pool
tagged with: scala
type: AnsweredQuestion
tagged with: java
tagged with: executor

http://stackoverflow.com/q/26869577
answer count: 1
tagged with: jdbc
tagged with: return
has answer: http://stackoverflow.com/a/26869718
tagged with: soap
accepted answer: http://stackoverflow.com/a/26869718
tagged with: web-services
has title: Returning multiple values in a Java method which calls PLSQL procedure with multiple OUT parameters
type: AnsweredQuestion
tagged with: java
type: Question
score: 0
has body: I am creating a SOAP Web service by wrapping PL/SQL procedures in Java.I have java method that uses JDBC to call a PL/SQL procedure with multiple OUT parameters. I need this method to return values of all the OUT parameters. For instance Here is the PL/SQL procedure header: -- Purpose: print the employees manger details (id and name) -- Example Of: Procedure with multiple parameters of OUT type PROCEDURE get_empl_manager(emp_id employees.employee_id%type , mngr_id OUT employees.employee_id%type , manager_name OUT VARCHAR2); Here is how I would return these two values. I have the following Java method signature: public Manager getEmpManagerDetails(int empId) Where Manager is a Class with following definition: Class Manager { int managerId; String managerName; } I am sure this will work but I am wondering If there is a recommended/preferred way (in context of JDBC or SOAP) to return multiple values that you get from the PL/SQL procedures OUT parameters.

http://stackoverflow.com/comment/42327572
type: QuestionComment
has text: It will not call the method of `AX`. `a2` has only the visibility of methods from class `A`.
comment on: http://stackoverflow.com/q/26886477
score: 0
type: Comment

http://stackoverflow.com/a/26988293
has comment: http://stackoverflow.com/comment/42516442
type: AcceptedAnswer
has body: You can use recursion to achieve this, to merge the first list with the tail list(a list of list). public class Permutation { public static List&lt;List&lt;Integer&gt;&gt; calculate(List&lt;List&lt;Integer&gt;&gt; input) { List&lt;List&lt;Integer&gt;&gt; result= new ArrayList&lt;List&lt;Integer&gt;&gt;();// if (input.isEmpty()) { // If input is an empty list result.add(new ArrayList&lt;Integer&gt;());// then add empty list to the resultand return return result; } else {//here we have a non-empty list to process List&lt;Integer&gt; head = input.get(0);//get the first list as a head List&lt;List&lt;Integer&gt;&gt; tail= calculate(input.subList(1, input.size()));//recursion to calculate a tail list to calculate a tail list for (Integer h : head) {//we merge every head element with every tail list for (List&lt;Integer&gt; t : tail) { List&lt;Integer&gt; resultElement= new ArrayList&lt;Integer&gt;();//here is a new element of our result list resultElement.add(h);//firstly, add the head element to this tmp list resultElement.addAll(t);//add all the element from the tail list result.add(resultElement); } } } return result; } public static void main(String[] args) { List&lt;List&lt;Integer&gt;&gt; bigList=Arrays.asList(Arrays.asList(1,2),Arrays.asList(3,4),Arrays.asList(5,6)); System.out.println(calculate(bigList)); } } output: [[1, 3, 5, 7], [1, 3, 5, 8], [1, 3, 6, 7], [1, 3, 6, 8], [1, 4, 5, 7], [1, 4, 5, 8], [1, 4, 6, 7], [1, 4, 6, 8], [2, 3, 5, 7], [2, 3, 5, 8], [2, 3, 6, 7], [2, 3, 6, 8], [2, 4, 5, 7], [2, 4, 5, 8], [2, 4, 6, 7], [2, 4, 6, 8]]
has comment: http://stackoverflow.com/comment/42516514
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/26987665
answers question: http://stackoverflow.com/q/26987665

http://stackoverflow.com/comment/42464117
type: Comment
type: QuestionComment
has text: Exactly as above. Also, there is no real reason why `3/2` is better than `17/53` or `1.74`, they just chose a number between 1 and 2 which was easy to remember.
comment on: http://stackoverflow.com/q/26925556
score: 0

http://stackoverflow.com/q/26843496
linked to: http://stackoverflow.com/q/26151636
has answer: http://stackoverflow.com/a/26875344
has comment: http://stackoverflow.com/comment/42252210
has title: EJB transaction not rolling back
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26875344
has body: I've the above EJB: @Stateless public class ItilEJB { @PersistenceContext protected EntityManager em; public <T> T find(Class<T> clazz, Long id) { if (clazz == null || id == null) { return null; } return em.find(clazz, id); } public Chamado atender(Long chamadoId) { Chamado chamado = find(Chamado.class, chamadoId); if (!isChamadoAtendido(chamadoId)) { Status emAndamento = new Status(Status.EM_ANDAMENTO); HistoricoChamado historico = new HistoricoChamado(); historico.setDescricao("Início do atendimento do chamado."); historico.setChamado(chamado); historico.setStatus(emAndamento); historico.setSla(chamado.getSla()); chamado.setStatus(emAndamento); save(historico); save(chamado); } return chamado; } public void save(BaseEntity entity) { if (entity.getId() == null) { if (!helper.canInsert(this, entity)) { throw new AlertMessageRuntimeException("user.db.constraint"); } em.persist(entity); } else { if (!helper.canUpdate(this, entity)) { throw new AlertMessageRuntimeException("user.db.constraint"); } em.merge(entity); } } } If my second save, save(chamado); throws one Exception (Both runtime or not) the first save is not rolled back, I can't understand why. For me, every EJB call would be encapsulate in one transaction and if a Exception occurs, the whole interaction with the DB layer would be rolled back. How can I accomplish this behavior? If my second save throws a error, I want the first save action be rolled back. Thanks I'm using MySQL as DBMS and Wildfly 8.1 as Application Server. I haven't changed any of the defaults, so I don't think that auto-commit mode is enable. <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence java:jboss/datasources/MySQLDS <property name="hibernate.show_sql" value="true" /> This is my datasource configuration in standalone.xml jdbc:mysql://${env.OPENSHIFT_MYSQL_DB_HOST}:${env.OPENSHIFT_MYSQL_DB_PORT}/${env.OPENSHIFT_APP_NAME} mysql ${env.OPENSHIFT_MYSQL_DB_USERNAME} ${env.OPENSHIFT_MYSQL_DB_PASSWORD} <check-valid…
type: AnsweredQuestion
tagged with: transactions
has comment: http://stackoverflow.com/comment/42294343
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26876877
accepted answer: http://stackoverflow.com/a/26876877
tagged with: ejb

cucumber-jvm
tag name: cucumber-jvm
tags question: http://stackoverflow.com/q/26978918
type: Tag
tags question: http://stackoverflow.com/q/26868832
tags question: http://stackoverflow.com/q/26965838
tags question: http://stackoverflow.com/q/26902690

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/26835763
tags question: http://stackoverflow.com/q/26887758
tags question: http://stackoverflow.com/q/26983709
tags question: http://stackoverflow.com/q/26960877
tags question: http://stackoverflow.com/q/26963275
tags question: http://stackoverflow.com/q/26864244
tags question: http://stackoverflow.com/q/26938125
tags question: http://stackoverflow.com/q/26952832
type: Tag
tags question: http://stackoverflow.com/q/26891227
tags question: http://stackoverflow.com/q/26873772
tags question: http://stackoverflow.com/q/26950769
tags question: http://stackoverflow.com/q/26951055

http://stackoverflow.com/a/26892953
has comment: http://stackoverflow.com/comment/42342962
has comment: http://stackoverflow.com/comment/42339685
type: Answer
has body: A static variable is one that lives with the class itself. A non-static variable is unique to each instance of that class (i.e., each object built from that class.) A static variable you can access as a property of the class, like: SomeclassIMadeUp.numberOfFish; so if you change the numberOfFish property for that class, anywhere you reference it, you see the change (as you've noticed.) To have one unique to each instance, don't declare the variable as static and then add a getter and/or setter method to access it. like private int numberOfFish; public int getNumberOfFish() { return (numberOfFish); } So to your question... Ocean pacific = new Ocean(); pacific.water = Ocean.salty; // &lt;-- Copying the value from a static variable in the class Ocean // to the instance variable in the object pacific (which is of Ocean class). pacific.setNumberOfFish(1000000000); Octopus o = new Octopus(); o.diningOpportunities = pacific.getNumberOfFish(); // &lt;-- Calls the public method to return a // value from the instance variable in the object pacific.
score: 0
answers question: http://stackoverflow.com/q/26892772

http://stackoverflow.com/comment/42477559
has text: possible duplicate of [Regex to strip HTML tags](http://stackoverflow.com/questions/4075742/regex-to-strip-html-tags)
score: 2
comment on: http://stackoverflow.com/q/26970772
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42262943
type: Comment
type: QuestionComment
has text: Which language is this? It looks like it's Java, but I'm not sure.
comment on: http://stackoverflow.com/q/26850261
score: 0

http://stackoverflow.com/q/26863417
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/26864175
answer count: 2
has body: I am trying to support the hypermedia constraint using link elements as per http://martinfowler.com/articles/richardsonMaturityModel.html#level3 in my response XML. I have a BankAccount object and I can return one link element on its own but I am having trouble when trying to return a list of link elements (even one on its own in a list is an issue). I would prefer not to have to encapsulate the link elements in a links parent element; I would prefer to list off the link elements. My BankAccount class is as follows: @XmlRootElement(name = "bankaccount") @XmlType(propOrder={"branchCode","accountNo","custName", "custAddress", "custType", "custRating", "balance", "link"}) public class BankAccount { private String branchCode, accountNo, custName, custAddress, custType, custRating; private double balance; // private Link link = new Link(); // works private List&lt;Link&gt; links;// = new ArrayList&lt;&gt;(); public BankAccount(){ } public BankAccount(String branchCode, String accountNo, String custName, String custAddress, String custType, String custRating, double balance) { this.branchCode = branchCode; this.accountNo = accountNo; this.custName = custName; this.custAddress = custAddress; this.custType = custType; this.custRating = custRating; this.balance = balance; } @XmlElement public void setBranchCode(String branchCode) { this.branchCode = branchCode; } public String getBranchCode() { return branchCode; } // other setters and getters... // the link element on its own that works... // @XmlElement(name = "link") // public void setLink(Link aLink){ // this.link = aLink; // } // public Link getLink(){ // return link; // } @XmlElement(name = "link") public List&lt;Link&gt; getLinks() { return links; } public void setLinks(List&lt;Link&gt; links) { this.links = links; } } The Link class: @XmlAccessorType(XmlAccessType.FIELD) public class Link { @XmlAttribute(name = "rel") private String rel; @XmlAttribute(name = "href") private String href; public String getRel() { retur…
downvote count: 0
tagged with: jax-rs
has comment: http://stackoverflow.com/comment/42288210
has title: JAXB error when trying to create a list of elements
favorite count: 0
has answer: http://stackoverflow.com/a/26864266
has comment: http://stackoverflow.com/comment/42288821
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26014656
tagged with: http://stackoverflow.com/tag/xml
score: 2
upvote count: 2
tagged with: java

http://stackoverflow.com/q/26894590
tagged with: java
downvote count: 3
score: -1
has body: Hello I am currently working on a assignment for an exam in my Java programming course. Right now I am trying to make this program run without errors. Can anyone please help me to understand what I am doing wrong? I have this code and I get stuck with an NullPointerException: java.lang.NullPointerException 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 edu.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272) import java.util.Random; import java.util.Scanner; public class BattleShip { // Board size int boardxlength = 5; int boardylength = 5 //ships Ship submarine; Ship destroyer; Ship battleship; // Random number function Random random = new Random(); // Begin Main public void main(String args[]) { // create Ships SetupShips(); System.out.println(submarine.length); } // end Main function // Create Ships function public void SetupShips() { submarine = new Ship("submarine", random.nextInt(boardxlength), random.nextInt(boardylength), 2); destroyer = new Ship("destroyer", random.nextInt(boardxlength), random.nextInt(boardylength), 3); battleship = new Ship("battleship", random.nextInt(boardxlength), random.nextInt(boardylength), 4); } /** * ************************************** */ /* CLASSES /******************************************/ public class Ship { String type; int row; int col; int length; //Constructor public Ship(String strtype, int intx, int inty, int intlength) { type = strtype; row = intx - 1; col = inty - 1; length = intlength; } } // end Ship Class }// end main class
linked to: http://stackoverflow.com/q/15057203
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42344033
has answer: http://stackoverflow.com/a/26896716
tagged with: drjava
has comment: http://stackoverflow.com/comment/42342876
favorite count: 0
tagged with: class
has comment: http://stackoverflow.com/comment/42342990
has comment: http://stackoverflow.com/comment/42343042
has answer: http://stackoverflow.com/a/26895912
has comment: http://stackoverflow.com/comment/42342853
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42342889
has comment: http://stackoverflow.com/comment/42342832
has comment: http://stackoverflow.com/comment/42343866
has title: Why am I receiving a NullPointerException during compilation?
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42343569
has comment: http://stackoverflow.com/comment/42342916

http://stackoverflow.com/q/26941651
tagged with: eclipse
has answer: http://stackoverflow.com/a/55041435
has answer: http://stackoverflow.com/a/26941727
type: Question
has answer: http://stackoverflow.com/a/53801662
possible better answer: http://stackoverflow.com/a/26941727
has title: System.out.println error New programmer
has answer: http://stackoverflow.com/a/26941673
has comment: http://stackoverflow.com/comment/42427101
has comment: http://stackoverflow.com/comment/42427060
accepted answer: http://stackoverflow.com/a/26941673
favorite count: 0
tagged with: java.util.scanner
answer count: 4
type: AnsweredQuestion
has body: I'm trying to do a simple input program and I get an error on the System.out.println command, I don't know why it doesn't accept the command and can't continue working until I fix it. The error says: Multiple markers at this line - Syntax error, insert ")" to complete MethodDeclaration - Syntax error, insert "Identifier (" to complete MethodHeaderName - Syntax error on token ".", @ expected after this token - Syntax error, insert "SimpleName" to complete QualifiedName My code goes as follows. package classPack; import java.util.Scanner; public class Main { Scanner s = new Scanner(System.in); int numone = s.nextInt(); System.out.println("please input the number of numbers you want to analyze"); Scanner r = new Scanner(System.in); int numtwo = s.nextInt(); }
upvote count: 3
score: 1
tagged with: java
downvote count: 2
tagged with: output

http://stackoverflow.com/a/26844151
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26844135
answers question: http://stackoverflow.com/q/26844135
type: Answer
has body: Your map config is null, that's why you get the NullPointerException. You should initialize it e.g. Map &lt;String, NodeList&gt; config = new HashMap &lt;String, NodeList&gt;();

http://stackoverflow.com/a/26938135
has body: For comparing string you need to use equals method. Example: if(answer.equals("AA")){ Note this will compare case-sensitive. If you don't want case-sensitive use: if(answer.equalsIgnoreCase("AA")){
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42420995
type: Answer
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26938121
answers question: http://stackoverflow.com/q/26938121
score: 0
has comment: http://stackoverflow.com/comment/42420981

http://stackoverflow.com/comment/42434996
type: Comment
has text: I was able to understand none out of the question and the answer.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26946301

http://stackoverflow.com/comment/42492698
type: Comment
score: 0
has text: yes of course! Your feature vector may consist of 12 different iris edge's(According to your statement).
comment on: http://stackoverflow.com/a/26974283
type: AnswerComment

http://stackoverflow.com/comment/42354522
score: 0
type: Comment
type: QuestionComment
has text: I declared cmbBox as `static` which was causing this error. Now the problem is solved. Thanks guys
comment on: http://stackoverflow.com/q/26887287

http://stackoverflow.com/comment/42305199
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26873120
has text: You can annotate a class with `@Test`? Doesn't this belong the test method? ([JavaDoc](http://junit.sourceforge.net/javadoc/org/junit/Test.html))
score: 0

http://stackoverflow.com/a/26853998
has comment: http://stackoverflow.com/comment/42270864
downvote count: 0
has comment: http://stackoverflow.com/comment/42275317
has comment: http://stackoverflow.com/comment/42275341
answers question: http://stackoverflow.com/q/26853875
has body: This is not hard to do, but what do you mean by change one of the threes? You can add a boolean flag outside of your for loop that can tell if you've encountered a 3 or not and what the index of that 3 is. Try something like this: boolean changedThree = false; int threeIndex = -1; for(int i = 0; i &lt; arrayA.length; i++){ if(arrayA[i] == 3 &amp;&amp; !changedThree){ arrayA[i] = 4; threeIndex = i; changedThree = true; } System.out.println(arrayA[i] + " "); } I don't know for sure if that captures the information you need, but hopefully can give you a push in the right direction. Let me know if you have questions. EDIT To avoid any duplicate values, I recommend you create an array list, and add the unique values to it. Then, you can use the ArrayList.contains() method to see if a value exists already. So, I would recommend changing your code to this: ArrayList&lt;int&gt; usedCharacters = new ArrayList&lt;int&gt;(); int changedCounter = 0; Random rand = new Random(); for(int i = 0; i &lt; arrayA.length; i++){ if(!usedCharacters.contains(arrayA[i])){ // If we haven't used this number yet usedCharacters.add(arrayA[i]); } else{ // Generate a new number - make sure we aren't creating a duplicate int temp = rand.nextInt(20) + 1; while(usedCharacters.contains(temp)){ temp = rand.nextInt(20) + 1; } // Assign new variable, increment counter arrayA[i] = temp; changedCounter++; } } If you're not familiar with the random.nextInt() method, read this.
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42315135
score: 1
has comment: http://stackoverflow.com/comment/42270492

http://stackoverflow.com/comment/85439845
comment on: http://stackoverflow.com/a/41519414
type: AnswerComment
has text: No, I mean that if both `DependentClass1 dependentObject1` and `DependentClass2 dependentObject2` having implementation of a interface `ABCInterface` then when I use `@Autowired` on `ABCInterface`, then whose definition is took by container?
type: Comment
score: 0

http://stackoverflow.com/a/26904891
accepted answer of: http://stackoverflow.com/q/26899150
score: 0
type: AcceptedAnswer
has body: I myself use AdMob. Here is how it works in a nutshell And here is the implementation
answers question: http://stackoverflow.com/q/26899150
type: Answer

http://stackoverflow.com/comment/42470585
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26966525
type: AnswerComment
has text: Of course you should return a different class depending on the columnIndex.

http://stackoverflow.com/comment/42653718
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27056584
has text: I added a stack trace for better visibility of the problem. The error is the same when I added in try/catch like you suggested. Thank you for your input. Ultimately, to get it to work, I completely removed the custom class CellElement and just used the built in ObjectProperty class that is shown in the example. Everything worked fine after that with no Converter needed!

http://stackoverflow.com/q/26953995
has comment: http://stackoverflow.com/comment/42452777
score: 0
tagged with: rest
has body: Using SDN 3.1.2 and neo4j-rest-graphdb 2.0.1, I come across this exception while saving an entity (frequency 1/5): 2014-11-16T04:54:29.018090+00:00 app[web.1]: [error] play - Cannot invoke the action, eventually got an error: java.lang.RuntimeException: Error reading as JSON ' 502 Bad Gateway 2014-11-16T04:54:29.018095+00:00 app[web.1]: The server returned an invalid or incomplete response. 2014-11-16T04:54:29.029618+00:00 app[web.1]: 2014-11-16T04:54:29.029620+00:00 app[web.1]: ! @6k83hj7gp - Internal server error, for (POST) [/api/meetings] -> 2014-11-16T04:54:29.018097+00:00 app[web.1]: 2014-11-16T04:54:29.029622+00:00 app[web.1]: 2014-11-16T04:54:29.018104+00:00 app[web.1]: ' 2014-11-16T04:54:29.029615+00:00 app[web.1]: [error] application - 2014-11-16T04:54:29.029624+00:00 app[web.1]: play.api.Application$$anon$1: Execution exception[[RuntimeException: Error reading as JSON ' 502 Bad Gateway 2014-11-16T04:54:29.029625+00:00 app[web.1]: The server returned an invalid or incomplete response. 2014-11-16T04:54:29.029627+00:00 app[web.1]: 2014-11-16T04:54:29.029630+00:00 app[web.1]: at play.api.Application$class.handleError(Application.scala:293) ~[com.typesafe.play.play_2.10-2.2.3.jar:2.2.3] 2014-11-16T04:54:29.029632+00:00 app[web.1]: at play.api.DefaultApplication.handleError(Application.scala:399) [com.typesafe.play.play_2.10-2.2.3.jar:2.2.3] 2014-11-16T04:54:29.029634+00:00 app[web.1]: at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$3$$anonfun$applyOrElse$3.apply(PlayDefaultUpstreamHandler.scala:264) [com.typesafe.play.play_2.10-2.2.3.jar:2.2.3] 2014-11-16T04:54:29.029628+00:00 app[web.1]: ']] 2014-11-16T04:54:29.029646+00:00 app[web.1]: at org.neo4j.rest.graphdb.util.JsonHelper.readJson(JsonHelper.java:57) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na] 2014-11-16T04:54:29.029648+00:00 app[web.1]: at org.neo4j.rest.graphdb.util.JsonHelper.jsonToSingleValue(JsonHelper.java:62) ~[org.neo4j.neo4j-rest-graphdb-2.0.1.jar:na] 2014-11-16T04:54:29.029649+00…
tagged with: neo4j
has comment: http://stackoverflow.com/comment/42504626
tagged with: spring-data-neo4j
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42658217
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42451072
type: Question
has title: neo4j-rest-graphdb causes randomly a 502 bad gateway
has comment: http://stackoverflow.com/comment/42451024
has comment: http://stackoverflow.com/comment/42504232

http://stackoverflow.com/comment/42261035
score: 1
has text: http://developer.android.com/reference/org/json/JSONObject.html#JSONObject%28java.lang.String%29. The constructor you're looking for is right there, in the documentation. You MUST learn to read the documentation.
comment on: http://stackoverflow.com/q/26849139
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26899432
type: AnsweredQuestion
has body: EDIT: Thanks a ton for everyone who has helped. I can't believe I missed that single typo. I'm in need of help for some basic math in Java. I'm trying to create a heat index calculator but when Java compiles runs the program the calculator seems to slip up. I've checked it over multiple times to see the problem but cant find anything. Help would be greatly appreciated. Code: double t = 84.3; //temperature int h = 81; //humidity //the following are parts of the heat index formula double c1 = -42.379; double c2 = 2.04901523; double c3 = 10.14333127; double c4 = -0.22475541; double c5 = -.00683783; double c6 = -5.481717E-2; double c7 = 1.22874E-3; double c8 = 8.5282E-4; double c9 = -1.99E-6; double hI = c1 + c2 * t + c3 * h + c4 * t * h + c5 * t*t + c6 * h*h + c7 * t*t * h + c8 * t + h*h + c9 * t*t * h*h; //formula for calculating heat index System.out.println(hI); So the problem here is that instead of giving me the desired output (heat index), it's returning a very large number (6184.5981258548). Is there an issue with my code? Once again, any help would be appreciated. Thanks.
tagged with: java
has comment: http://stackoverflow.com/comment/42351826
has comment: http://stackoverflow.com/comment/42351828
type: Question
score: 0
answer count: 2
has title: Having a beginner issue with some basic math functions in Java. Anything I'm doing wrong?
has comment: http://stackoverflow.com/comment/42351858
has comment: http://stackoverflow.com/comment/42351761
has comment: http://stackoverflow.com/comment/42351667
has comment: http://stackoverflow.com/comment/42351680
possible better answer: http://stackoverflow.com/a/26899486
has answer: http://stackoverflow.com/a/26899486
has answer: http://stackoverflow.com/a/26899492
accepted answer: http://stackoverflow.com/a/26899492

http://stackoverflow.com/comment/42491080
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26974793
has text: I was referring to the step where the greet() method was "overridden" to implement its German version(see the tutorial). By the way using model fragment should provide enough "modularity" to my code right?

http://stackoverflow.com/a/26956798
downvote count: 0
answers question: http://stackoverflow.com/q/26956514
score: 1
upvote count: 1
type: Answer
has body: you dont understand the IntentService very well . The method of onHandleIntent was called in a sub thread which the framework started, this Service will kill itself when the onHandleIntent was completed , therefor he reason is that you put the job in a new thread which you started . So, ou should put code into the onHandleIntent. while (true) { try { // Logging events myLogger(); Log.e(TAG, "Awake"); // TIMER Thread.sleep(TIMER); } catch (Exception e) { Log.e("MyService", "local Thread error "+ e.toString()); } }

http://stackoverflow.com/a/27457834
type: Answer
answers question: http://stackoverflow.com/q/26924219
score: 0
has body: Please check firewall and disable antivirus shield and check again...

http://stackoverflow.com/a/26881478
type: Answer
answers question: http://stackoverflow.com/q/26841807
score: 0
has body: After a wild struggling with V2 I went back to V.1.7.9 and everything works. Maven Dependency: com.orientechnologies orientdb-graphdb 1.7.9 it seems that there are some unsolved issues with V.2.x I will do another PoC within a month or so.
has comment: http://stackoverflow.com/comment/42369796

http://stackoverflow.com/q/26845885
upvote count: 15
score: 15
has answer: http://stackoverflow.com/a/26995108
has body: I have openCV-3.0.0 alpha and I found a sample code on the openCV tutorials website. I used to same code and compiled it, but eclipse tells me that the rectangle() method in the org.opencv.core.Core class cannot be found. I checked the class myself and indeed could not find this method. Does anyone know in which class this method is now stored in? I found a similar problem with the org.opencv.highgui.Highgui class which was discontinued in the openCV-3.0.0 and replaced by org.opencv.imgcodecs.Imgcodecs
possible better answer: http://stackoverflow.com/a/33347566
answer count: 2
has answer: http://stackoverflow.com/a/33347566
accepted answer: http://stackoverflow.com/a/26995108
downvote count: 0
has title: Java OpenCV - org.opencv.core.Core rectangle() method missing
favorite count: 0
tagged with: opencv
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
tagged with: import
type: Question

http://stackoverflow.com/q/26942208
type: AnsweredQuestion
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/26978221
type: Question
has comment: http://stackoverflow.com/comment/42428001
has comment: http://stackoverflow.com/comment/42428014
has body: I want to run a CompletableFuture property on a given class. If i have initialized like so, would that be dangerous and possibly create a partially constructed object? public class MyClass { public final CompletableFuture&lt;BigDecimal&gt; myExpensiveVal = CompletableFuture.supplyASync(() -&gt; calculateExpensiveMethod(this)); //... }
score: 0
has title: Is this a reference escape to a partially constructed object?
answer count: 1
accepted answer: http://stackoverflow.com/a/26978221
tagged with: future
tagged with: java-8

http://stackoverflow.com/a/26888084
downvote count: 0
has body: "germany" is not a time zone. If your machine is in germany and you use TimeZone.getDefault().getDisplayName() from jdk (not from jodatime) you get "Mitteleuropäische Zeit". If you need the country try Locale.getDefault().getDisplayCountry().
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26887783

http://stackoverflow.com/a/26953364
score: 0
answers question: http://stackoverflow.com/q/26952565
has body: Here's a working code in case it helps you :) Tried to separate it into functions to make it a bit more clear. Note that the code given to you above is WAY more efficient than this one, but this one might be a little easier to understand. import java.util.*; import java.lang.*; import java.io.*; /* Name of the class has to be "Main" only if the class is public. */ class Ideone { static int numBoxes = 4; //Change this to your liking. static int height = 3; //Just how many | will it have. static int width = 6; // public static void main(String[] args) throws java.lang.Exception { topBot(); printHeight(); topBot(); } public static void topBot() { for (int i = 0; i <= numBoxes * width; i++) { if (i % width == 0) //When this happens we're in a new box. System.out.print("+"); else System.out.print("-"); } System.out.println(); //Move to next line. } public static void printHeight() { for (int j = 0; j < height; j++) { for (int i = 0; i <= numBoxes * width; i++) { if (i % width == 0) //Whenever this happens we're in a new box. System.out.print("|"); else System.out.print(" "); } System.out.println(); //Move to next line. } } } Output: +-----+-----+-----+-----+ | | | | | | | | | | | | | | | +-----+-----+-----+-----+
type: Answer

http://stackoverflow.com/comment/42565104
has text: @CharliesS: yes, i want to create a file/valid crl on the fly. i will encode it and test the code. Thank you again!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27006748
type: Comment

http://stackoverflow.com/comment/42246901
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26839638
type: Comment
has text: Did you call rs.next() first?

http://stackoverflow.com/comment/42322783
has text: @Shubh That depends on what is an equal date for you. Different milliseconds means different date.
score: 0
comment on: http://stackoverflow.com/q/26883454
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26853248
type: Answer
answers question: http://stackoverflow.com/q/26853227
has body: Well, what is returned is of type String[]. So if you know that there will be two items, you can reference it as an array.. if(x.split(" ")[1].equals("+")) Extra Reading You should look at String Comparison.
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/42269170
has comment: http://stackoverflow.com/comment/42269099
has comment: http://stackoverflow.com/comment/42269042
score: 5

http://stackoverflow.com/comment/42420666
comment on: http://stackoverflow.com/a/26936799
score: 0
type: AnswerComment
has text: Thanks a lot for valuable answer. Yes so I am starting roll on TCP connections between controller and C applications. The DB approach also seems good. But also C applications will be at different sites, like in Australia, Canada, USA, India, so will DB be helpful here?
type: Comment

http://stackoverflow.com/comment/42322509
comment on: http://stackoverflow.com/a/26883137
score: 0
type: Comment
has text: This answer is misleading. Some software requires installation with an installer, which places things in directories other than `Program Files`.
type: AnswerComment

http://stackoverflow.com/comment/42469783
score: 0
comment on: http://stackoverflow.com/q/26966162
type: Comment
has text: You don't need a main, thats just the usual entry point from java runners. If you use a different runner, you need to offer different entry points. For instance, junit uses annotations to indicate which methods to run. Maven surefire can call just about any method you include. Eclipse can call directly to methods, or use junit/maven as runners.
type: QuestionComment

http://stackoverflow.com/q/26978761
tagged with: java
has comment: http://stackoverflow.com/comment/42492943
has comment: http://stackoverflow.com/comment/42492188
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42523664
type: Question
has comment: http://stackoverflow.com/comment/42493837
has title: Nothing happens when I press the button to accept a picture
has comment: http://stackoverflow.com/comment/42496214
has comment: http://stackoverflow.com/comment/42492360
score: 0
has body: I made a class(ShowPhoto.java) which can make and save a photo. But nothing is happening when I click the "V" in my photo maker. So it makes the photo, but when you verify the photo, the app gives an error. When I press this button, the app should save the photo. Any idea what I forgot to add in my code? package com.example.photoviewer; //imports here public class FotoMaker extends Activity { private static final String LOG_TAG = "debugger"; ImageView iv; // Uri uriOfPicture; static final int REQUEST_TAKE_PHOTO = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.add_pic); iv = (ImageView) findViewById(R.id.imageView); Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick (View v){ dispatchTakePictureIntent(); Log.i(LOG_TAG, "test5"); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_TAKE_PHOTO &amp;&amp; resultCode == RESULT_OK) { Bundle extras = data.getExtras(); Bitmap imageBitmap = (Bitmap) extras.get("data"); iv.setImageBitmap(imageBitmap); } } String mCurrentPhotoPath; private File createImageFile() throws IOException { Log.i(LOG_TAG, "test3"); // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_PICTURES); File image = File.createTempFile( imageFileName, /* prefix */ ".jpg", /* suffix */ storageDir /* directory */ ); // Save a file: path for use with ACTION_VIEW intents mCurrentPhotoPath = "file:" + image.getAbsolutePath(); return image; } private void dispatchTakePictureIntent() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); // Ensure that there's a camera activity to handle the intent if (takePictureIntent.resolveActivity(g…
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42492017
has comment: http://stackoverflow.com/comment/42492070
linked to: http://stackoverflow.com/q/19042511
has comment: http://stackoverflow.com/comment/42496180
has comment: http://stackoverflow.com/comment/42522707
has comment: http://stackoverflow.com/comment/42492031

http://stackoverflow.com/comment/42461023
comment on: http://stackoverflow.com/q/26959069
score: 0
has text: @Tom It's working however it does not display the price of the ticket which should be £0.70 ***************** Your Ticket Registration:qweqrtw Cost: £0.0 *****************
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26873238
linked to: http://stackoverflow.com/q/16751572
type: UnansweredQuestion
has title: Cannot call perl script from Java
has comment: http://stackoverflow.com/comment/42304662
tagged with: java
type: Question
has body: When I'm trying to run a perl script from my main java application: try { ProcessBuilder pb = new ProcessBuilder(path+"\\script.pl"); Process p = pb.start(); // Start the process. p.waitFor(); // Wait for the process to finish. System.out.println("Script executed successfully"); } catch (Exception e) { e.printStackTrace(); } } I get the following error (not a valid win32 app): java.io.IOException: Cannot run program "C:\workspace\kepler\Alert_Handler\target\test-classes\script.pl": CreateProcess error=193, %1 no es una aplicación Win32 válida at java.lang.ProcessBuilder.start(Unknown Source)
has answer: http://stackoverflow.com/a/26874127
answer count: 2
linked to: http://stackoverflow.com/q/4727480
tagged with: perl
score: 0
has comment: http://stackoverflow.com/comment/42304735
has answer: http://stackoverflow.com/a/26873702
has comment: http://stackoverflow.com/comment/42351759

http://stackoverflow.com/comment/42262006
score: 0
comment on: http://stackoverflow.com/a/26848420
type: Comment
has text: How is it possible to disable GC?
type: AnswerComment

http://stackoverflow.com/q/26838517
has body: I have downloaded commom-daemon tool and used with a java application. I have created a bat file as shown below set SERVICE_NAME=sample set PR_INSTALL=D:\commons-daemon-1.0.15-bin-windows-signed\prunsrv.exe REM Service log configuration set PR_LOGPREFIX=%SERVICE_NAME% set PR_LOGPATH=D:\logs set PR_STDOUTPUT=D:\logs\stdout.txt set PR_STDERROR=D:\logs\stderr.txt set PR_LOGLEVEL=Error REM Path to java installation set PR_JVM=C:\Java\jre7\bin\client\jvm.dll set PR_CLASSPATH=D:\commons-daemon-1.0.15-bin-windows-signed\Daemon.jar REM Startup configuration set PR_STARTUP=auto set PR_STARTMODE=jvm set PR_STARTCLASS=com.SomeService set PR_STARTMETHOD=start REM Shutdown configuration set PR_STOPMODE=jvm set PR_STOPCLASS=com.SomeService set PR_STOPMETHOD=stop REM JVM configuration set PR_JVMMS=256 set PR_JVMMX=1024 set PR_JVMSS=4000 set PR_JVMOPTIONS=-Duser.language=DE;-Duser.region=de In cmd , I install the service using the command prunsrv.exe //IS//sample After this, a service named sample become available in the list of services and when I tried to start it it shows: Windows could not start the sample on Local Computer. For more information review the System event log. If this is a non-Microsoft service, contact the service vendor and refer to the server specific error code 1 UPDATED When I run prunsrv.exe //ES//sample it shows The data area passed to a system call is too small. Failed to start service Can any one help me in this?
has answer: http://stackoverflow.com/a/30601282
answer count: 4
has comment: http://stackoverflow.com/comment/42243785
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42241845
upvote count: 1
tagged with: windows-services
has title: Error in starting java application as windows services
type: Question
has answer: http://stackoverflow.com/a/39878910
has comment: http://stackoverflow.com/comment/42242270
has comment: http://stackoverflow.com/comment/42244793
has answer: http://stackoverflow.com/a/46210784
has comment: http://stackoverflow.com/comment/42244644
has comment: http://stackoverflow.com/comment/42244728
downvote count: 0
has comment: http://stackoverflow.com/comment/42245123
has comment: http://stackoverflow.com/comment/42242424
favorite count: 0
has comment: http://stackoverflow.com/comment/42244909
has answer: http://stackoverflow.com/a/34734038
type: UnansweredQuestion

swing
tags question: http://stackoverflow.com/q/26951193
tags question: http://stackoverflow.com/q/26881657
tags question: http://stackoverflow.com/q/26897368
tags question: http://stackoverflow.com/q/26930651
tags question: http://stackoverflow.com/q/26939216
tags question: http://stackoverflow.com/q/26864638
tags question: http://stackoverflow.com/q/26953956
tags question: http://stackoverflow.com/q/26876749
tags question: http://stackoverflow.com/q/26989589
tags question: http://stackoverflow.com/q/26919951
tags question: http://stackoverflow.com/q/26976910
tags question: http://stackoverflow.com/q/26907684
tags question: http://stackoverflow.com/q/26969884
tags question: http://stackoverflow.com/q/26848347
tags question: http://stackoverflow.com/q/26912360
tags question: http://stackoverflow.com/q/26980931
tags question: http://stackoverflow.com/q/26942576
tags question: http://stackoverflow.com/q/26928218
tags question: http://stackoverflow.com/q/26925275
tags question: http://stackoverflow.com/q/26908583
tags question: http://stackoverflow.com/q/26936896
tags question: http://stackoverflow.com/q/26939086
tags question: http://stackoverflow.com/q/26837006
tags question: http://stackoverflow.com/q/26860204
tags question: http://stackoverflow.com/q/26936783
tags question: http://stackoverflow.com/q/26877474
tags question: http://stackoverflow.com/q/26895825
tags question: http://stackoverflow.com/q/26921142
tags question: http://stackoverflow.com/q/26835440
tags question: http://stackoverflow.com/q/26923282
tags question: http://stackoverflow.com/q/26873189
tags question: http://stackoverflow.com/q/26854010
tags question: http://stackoverflow.com/q/26939414
tags question: http://stackoverflow.com/q/26906039
tags question: http://stackoverflow.com/q/26910000
tags question: http://stackoverflow.com/q/26924799
tags question: http://stackoverflow.com/q/26928563
tags question: http://stackoverflow.com/q/26857711
tags question: http://stackoverflow.com/q/26930907
tags question: http://stackoverflow.com/q/26886708
tags question: http://stackoverflow.com/q/26956815
tags question: http://stackoverflow.com/q/26967055
tags question: http://stackoverflow.com/q/26942531
tags question: http://stackoverflow.com/q/26987056
tags question: http://stackoverflow.com/q/26840684
tags question: http://stackoverflow.com/q/26877125
tags question: http://stackoverflow.com/q/26875085
tags question: http://stackoverflow.com/q/26832832
tags question: http://stackoverflow.com/q/26912730
tags question: http://stackoverflow.com/q/26847488
tags question: http://stackoverflow.com/q/26959864
tags question: http://stackoverflow.com/q/26967230
tags question: http://stackoverflow.com/q/26856600
tags question: http://stackoverflow.com/q/26898797
tags question: http://stackoverflow.com/q/26971062
tags question: http://stackoverflow.com/q/26946267
tags question: http://stackoverflow.com/q/26983546
tags question: http://stackoverflow.com/q/26950589
tags question: http://stackoverflow.com/q/26950802
tags question: http://stackoverflow.com/q/26948509
tags question: http://stackoverflow.com/q/26925741
tags question: http://stackoverflow.com/q/26898536
tags question: http://stackoverflow.com/q/26970449
tags question: http://stackoverflow.com/q/26871417
tags question: http://stackoverflow.com/q/26955310
tags question: http://stackoverflow.com/q/26837204
tags question: http://stackoverflow.com/q/26966063
tags question: http://stackoverflow.com/q/26856099
tags question: http://stackoverflow.com/q/26959250
tags question: http://stackoverflow.com/q/26900804
tags question: http://stackoverflow.com/q/26935052
type: Tag
tags question: http://stackoverflow.com/q/26855366
tags question: http://stackoverflow.com/q/26836283
tags question: http://stackoverflow.com/q/26848647
tags question: http://stackoverflow.com/q/26979949
tags question: http://stackoverflow.com/q/26836850
tags question: http://stackoverflow.com/q/26903292
tags question: http://stackoverflow.com/q/26844631
tags question: http://stackoverflow.com/q/26965049

http://stackoverflow.com/q/26978865
has answer: http://stackoverflow.com/a/26979188
has title: Pretty-printing XML using Java
tagged with: saxparser
has comment: http://stackoverflow.com/comment/42492174
answer count: 3
has comment: http://stackoverflow.com/comment/42492646
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26997157
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42494556
tagged with: xerces
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42493761
has body: There are a dozen threads regarding that topic, but all of them contain answers that do not work for me in a satisfactory manner. It seems one needs to use a specific DOM implementation. However, I cannot get it to read the xml input: @Test public void testPrettyPrintConvertDomLevel3() throws UnsupportedEncodingException { String unformattedXml = "&lt;?xml version=\"1.0\" encoding=\"UTF-16\"?&gt;&lt;QueryMessage\n" + " xmlns=\"http://www.SDMX.org/resources/SDMXML/schemas/v2_0/message\"\n" + " xmlns:query=\"http://www.SDMX.org/resources/SDMXML/schemas/v2_0/query\"&gt;\n" + " &lt;Query&gt;\n" + " &lt;query:CategorySchemeWhere&gt;\n" + " \t\t\t\t\t &lt;query:AgencyID&gt;ECB\n\n\n\n&lt;/query:AgencyID&gt;\n" + " &lt;/query:CategorySchemeWhere&gt;\n" + " &lt;/Query&gt;\n\n\n\n\n" + "&lt;/QueryMessage&gt;"; System.out.println(prettyPrintWithXercesDomLevel3(unformattedXml.getBytes("UTF-16"))); } Here is the method: public static String prettyPrintWithXercesDomLevel3(byte[] input) { try { //System.setProperty(DOMImplementationRegistry.PROPERTY,"org.apache.xerces.dom.DOMImplementationSourceImpl"); DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); DOMImplementationLS impl = (DOMImplementationLS) registry.getDOMImplementation("XML 3.0 LS 3.0"); if (impl == null) { throw new RuntimeException("No DOMImplementation found !"); } log.info(String.format("DOMImplementationLS: %s", impl.getClass().getName())); LSParser parser = impl.createLSParser( DOMImplementationLS.MODE_SYNCHRONOUS, //"http://www.w3.org/2001/XMLSchema"); "http://www.w3.org/TR/REC-xml"); log.info(String.format("LSParser: %s", parser.getClass().getName())); LSInput lsi = impl.createLSInput(); lsi.setByteStream(new ByteArrayInputStream(input)); Document doc = parser.parse(lsi); LSSerializer serializer = impl.createLSSerializer(); serializer.getDomConfig().setParameter("format-pretty-print",Boolean.TRUE); LSOutput output = impl.createLSOutput(); output.setEncoding("UTF-8"); ByteArrayOutputSt…
has comment: http://stackoverflow.com/comment/42494443
has answer: http://stackoverflow.com/a/26979482
type: Question
tagged with: pretty-print
has comment: http://stackoverflow.com/comment/42493656
has comment: http://stackoverflow.com/comment/42492511

http://stackoverflow.com/q/26916178
linked to: http://stackoverflow.com/q/11731377
has answer: http://stackoverflow.com/a/26923731
has body: It's my first day trying servlets. It's just a simple login function, but I get an error that doesn't explain what I'm doing wrong. It just says 404: The requested resource is not available. Here's my servlet: public class Login extends HttpServlet { private static final long serialVersionUID = 1L; public Login() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(); String key = "ole"; String username = request.getParameter("username"); String password = request.getParameter("password"); response.sendRedirect("NewFile.jsp"); if (session.getAttribute(username).equals(key) && session.getAttribute(password).equals(key)) { response.sendRedirect("secret.jsp"); } else { response.sendRedirect("NewFile.jsp"); } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } } And here's my login page: Login page Enter username and password below. There is a file called secret.jsp as well, but there's nothing interesting in there. I don't understand why it's returning 404. When I have remove the if statement it works... only then, there's not much function.
duplicate of: http://stackoverflow.com/q/11731377
tagged with: servlets
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26919081
has comment: http://stackoverflow.com/comment/42381171
tagged with: jsp
has title: 404 error in servlets
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42381914
has comment: http://stackoverflow.com/comment/42381009
has answer: http://stackoverflow.com/a/26919017
has comment: http://stackoverflow.com/comment/42383056
has comment: http://stackoverflow.com/comment/42381054
tagged with: java
type: Question

tablecellrenderer
tags question: http://stackoverflow.com/q/26848347
tag name: tablecellrenderer
tags question: http://stackoverflow.com/q/26840508
tags question: http://stackoverflow.com/q/26969313
type: Tag

http://stackoverflow.com/q/26865279
favorite count: 0
type: UnansweredQuestion
tagged with: android
has body: I have used from location and to location in my application....I got the exact distance using Google distance Api...in the same way,while we are moving on the road we have to calculate the distance in every location(Updatedly)?and when I reached my destination my tracking must be stopped? please Help me Guys...
tagged with: java
score: -4
has answer: http://stackoverflow.com/a/26865453
type: Question
upvote count: 0
downvote count: 4
answer count: 1
has title: how to get the Distance in service while tracking the way in Android?
linked to: http://stackoverflow.com/q/16428737
has comment: http://stackoverflow.com/comment/42290245

http://stackoverflow.com/comment/42442109
type: AnswerComment
has text: I did all changes, but I still get error. My code is a little diferrent, I just created this example in SOF
type: Comment
comment on: http://stackoverflow.com/a/26911833
score: 0

http://stackoverflow.com/comment/42497322
has text: The exception stack trace also shows java.io.FileNotFoundException: FirstPa.txt Did you give correct file path?
comment on: http://stackoverflow.com/q/26981534
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42356612
type: QuestionComment
comment on: http://stackoverflow.com/q/26902103
has text: @konainali Yes, location is received from 3G (and the like) as well, though it's much more inaccurate than wifi.
score: 0
type: Comment

http://stackoverflow.com/q/26969884
answer count: 0
score: 1
tagged with: java
has body: Hello, I've been working on a GUI application that should resize dynamically and change background color multiple times after clicking a button. My first shot was to make a for loop inside an actionPerformed(ActionEvent e) method but it doesn't work properly. Strangely enough, the app changes properly if the listener is removed and the commented code from main function is used. Why is that? This code is actually a simple example of a problem which I've came across making a slightly more complex app. Could You kindly add a line or two if the solution varies if my window consists of many JPanels and I decide to repeatedly change properties of some other elements with one button click? import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingConstants; public class TempWindow { public static void main(String [] args ) { Frame f = new Frame(); // for (int i = 0; i &lt; 3; i++) { // if(i == 0) { // f.getMyPanel().setBackground(Color.red); // } // if (i == 1) { // f.setSize(500, 400); // f.getMyPanel().setBackground(Color.yellow); // } // if( i == 2) { // f.setSize(100, 200); // f.getMyPanel().setBackground(Color.green); // } // // try { // Thread.sleep(500); // } catch (InterruptedException e) { // e.printStackTrace(); // } // f.repaint(); // } } } class Frame extends JFrame { MyPanel panel; JButton but1; public Frame() { this.setSize(400, 300); this.setLocationRelativeTo(null); this.setLayout(new BorderLayout()); this.setDefaultCloseOperation(EXIT_ON_CLOSE); but1 = new JButton("Start"); this.getContentPane().add(but1, BorderLayout.NORTH); panel = new MyPanel(); this.getContentPane().add(panel, BorderLayout.CENTER); but1.addActionListener(new DanceActionListener(this)); this.setVisible(true); } public MyPanel getMyPanel() { return panel; } } class MyP…
has title: Repaint many elements with one button click in GUI app
type: Question
has comment: http://stackoverflow.com/comment/42475961
has comment: http://stackoverflow.com/comment/42476588
upvote count: 1
has comment: http://stackoverflow.com/comment/42477740
has comment: http://stackoverflow.com/comment/42476002
tagged with: user-interface
downvote count: 0
linked to: http://stackoverflow.com/q/4396583
favorite count: 0
tagged with: event-dispatch-thread
has comment: http://stackoverflow.com/comment/42476023
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42476071

http://stackoverflow.com/q/26884347
tagged with: connection-pooling
score: 0
has answer: http://stackoverflow.com/a/26884512
type: Question
has body: have been a long-time reader here and now I`ve got a problem I can´t really get my head around. For ease of access and to save object creation overhead I have a static class realizing database accesses. The used JVM implementation is Tomcat and for connection pooling org.apache.commons.dbcp is used. I've read a lot about thread-safety, heap and stack here and elsewhere but I can`t get to a definitive conclusion if multiple method calls on my static class won't interfere with each other. Most topics I've read deal with instance methods while I use static ones which might have implications I overlooked. If I understood everything correctly, as the variables connection, statement, resultset are on the method level, each function call should have a unique reference on the stack to a unique object in the heap and it should not be possible that multiple method calls interfere with each other. Am I right or do I stand corrected? Any help would be appreciated. The (shortened) code is : public class DBQuery{ private static String pathToDataSource = ""; private static javax.naming.Context cxt = null; private static javax.sql.DataSource ds = null; private static void getDataSource() throws Exception { if(pathToDataSource.equals("")){ pathToDataSource = Config.getParam("PathToDataSource"); } cxt = new javax.naming.InitialContext(); ds = (javax.sql.DataSource) cxt.lookup(pathToDataSource); } private static Connection connect() throws Exception { if(ds==null){ getDataSource(); } return ds.getConnection(); } public static Vector doDBquery(String querystring) throws Exception { Vector retVec = new Vector(); Connection connection = null; Statement statement = null; ResultSet resultset = null; try { connection = getConnection(); statement = connection.createStatement(); resultset = statement.executeQuery(querystring); ... } catch(Exception e) { ... } finally { myFinallyBlock(resultset, statement, connection); } return retVec; } // more methods like doDBInsert() following, hence closu…
tagged with: java
tagged with: static-methods
has title: Is a pooled db-access using method-level connection in a static class/method safe?
answer count: 1
type: UnansweredQuestion

manifest.mf
tags question: http://stackoverflow.com/q/26966687
tag name: manifest.mf
type: Tag

http://stackoverflow.com/comment/42282703
type: QuestionComment
comment on: http://stackoverflow.com/q/26859994
has text: You'd be better off changing the server to support TCP/IP. SPX is not a useful protocol. For one thing, it lacks an orderly close. See [this answer](http://stackoverflow.com/q/15887029/207421) for further details.
score: 0
type: Comment

http://stackoverflow.com/comment/42448193
type: Comment
score: 0
has text: Make sure you're opening a text file not a binary file and for really huge file this method is limited to the heap available to JVM. Try to allocate more heap while starting your program/app.
type: AnswerComment
comment on: http://stackoverflow.com/a/26948600

http://stackoverflow.com/comment/42374482
type: AnswerComment
comment on: http://stackoverflow.com/a/26912031
has text: Perfect, thank you ever so much. You just need to add a closing brace to close off the try statement.
type: Comment
score: 0

http://stackoverflow.com/comment/42314832
comment on: http://stackoverflow.com/q/26878910
type: Comment
has text: This code is not even going to compile.
score: 0
type: QuestionComment

regex
tags question: http://stackoverflow.com/q/26879447
tags question: http://stackoverflow.com/q/26878070
tags question: http://stackoverflow.com/q/26983563
tags question: http://stackoverflow.com/q/26939954
tags question: http://stackoverflow.com/q/26928953
tags question: http://stackoverflow.com/q/26897498
tags question: http://stackoverflow.com/q/26895588
tags question: http://stackoverflow.com/q/26921068
tag name: regex
tags question: http://stackoverflow.com/q/26970292
tags question: http://stackoverflow.com/q/26908179
tags question: http://stackoverflow.com/q/26885147
tags question: http://stackoverflow.com/q/26968554
tags question: http://stackoverflow.com/q/26969668
tags question: http://stackoverflow.com/q/26872490
tags question: http://stackoverflow.com/q/26915473
tags question: http://stackoverflow.com/q/26833023
tags question: http://stackoverflow.com/q/26954353
tags question: http://stackoverflow.com/q/26974739
tags question: http://stackoverflow.com/q/26926484
tags question: http://stackoverflow.com/q/26877243
tags question: http://stackoverflow.com/q/26874441
tags question: http://stackoverflow.com/q/26991133
tags question: http://stackoverflow.com/q/26886045
tags question: http://stackoverflow.com/q/26848983
tags question: http://stackoverflow.com/q/26892428
tags question: http://stackoverflow.com/q/26988688
tags question: http://stackoverflow.com/q/26970501
tags question: http://stackoverflow.com/q/26940186
tags question: http://stackoverflow.com/q/26856565
tags question: http://stackoverflow.com/q/26970986
tags question: http://stackoverflow.com/q/26883273
tags question: http://stackoverflow.com/q/26917111
tags question: http://stackoverflow.com/q/26962867
tags question: http://stackoverflow.com/q/26929358
tags question: http://stackoverflow.com/q/26972588
tags question: http://stackoverflow.com/q/26971143
tags question: http://stackoverflow.com/q/26955841
tags question: http://stackoverflow.com/q/26970314
tags question: http://stackoverflow.com/q/26897062
tags question: http://stackoverflow.com/q/26902920
tags question: http://stackoverflow.com/q/26846700
tags question: http://stackoverflow.com/q/26916882
tags question: http://stackoverflow.com/q/26940731
tags question: http://stackoverflow.com/q/26851488
tags question: http://stackoverflow.com/q/26897810
tags question: http://stackoverflow.com/q/26959612
tags question: http://stackoverflow.com/q/26980040
tags question: http://stackoverflow.com/q/26927152
tags question: http://stackoverflow.com/q/26960705
tags question: http://stackoverflow.com/q/26859706
type: Tag
tags question: http://stackoverflow.com/q/26855372
tags question: http://stackoverflow.com/q/26871240
tags question: http://stackoverflow.com/q/26922936
tags question: http://stackoverflow.com/q/26930859
tags question: http://stackoverflow.com/q/26908588

http://stackoverflow.com/comment/42301642
comment on: http://stackoverflow.com/a/26869177
has text: @youssefabaza read my update. I would not take control of the data positioning away from the adapter, instead give your adapter all of your data so that when you click on the item you can pull your data from your adapter and use it as you need it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42455322
type: Comment
comment on: http://stackoverflow.com/a/26958225
type: AnswerComment
score: 0
has text: I agree with you and I also gave the same answer but he told me that it's possible. That's why I am looking for the answer here because I haven't got yet how it's possible.

http://stackoverflow.com/q/26935339
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26937793
score: 1
tagged with: java
tagged with: hibernate
tagged with: orm
accepted answer: http://stackoverflow.com/a/26937793
has comment: http://stackoverflow.com/comment/42524908
linked to: http://stackoverflow.com/q/787722
type: Question
downvote count: 0
has title: Hibernate and Postgresql autoincrement not syncing
tagged with: postgresql
answer count: 1
has body: I'm having a problem with Hibernate and Postgres. I'm repeating through a code block for testing purposes to make sure everything is working properly. This code block, however, includes repeat persist methods to persist two user accounts to the useraccount table. It works properly the first time. However, every subsequent time I run the code, the UserAccount objects IDs are incremented, while their corresponding users in the table stay at their original values. I've tried using native and identity as the generator class, identity keeps the id at 0 and native has the same issue I've described above. I realize this is an unrealistic circumstance (repeating through an identical codeblock) but I don't feel that this is performing as it should. In fact, after removing all entries from all tables, the users are added to the user table properly. Is there a way to ensure that he object property id syncs with the table id? Here is the xml mapping for the useraccount ids. <class name="UserAccount" table="useraccounts"> <generator class="increment"/> And here is the Hibernate config file <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> org.hibernate.dialect.PostgreSQL82Dialect org.postgresql.Driver jdbc:postgresql://localhost:5432/agora-db postgres postgres 1 create true update <mapping resource="hibernate.hbm.xml"/> </hibernate-configuration>
favorite count: 0
has comment: http://stackoverflow.com/comment/42479198
tagged with: identifier

http://stackoverflow.com/q/26851469
has answer: http://stackoverflow.com/a/29545500
has title: How to have a configurable @WebServiceRef(wsdlLocation
linked to: http://stackoverflow.com/q/2522746
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33739339
tagged with: maven
has answer: http://stackoverflow.com/a/26851690
tagged with: java
tagged with: annotations
tagged with: jax-ws
type: Question
has body: I am having a maven build and project with a webservice client that will be deployed on a wildfly server. In my Client EJB, I have the following @Stateless public class MyClientEJB { @WebServiceRef(wsdlLocation = "http://localhost:8080/HelloWorld/HelloWorldService?wsdl") private HelloWorldService service; I want to have different url for Test and Production, how can I have this url as a configurable entry. I tried creating profiles in my pom.xml file but that requires following code and I don't know how to use it in @WebServiceRef annotation. private void initProperties() { InputStream is = getClass().getClassLoader().getResourceAsStream("application.properties"); if (is != null) { try { properties.load(is); BASE_URL = (String)properties.getProperty("student.restws.url"); } catch (IOException e) { logger.error("Error when reading properties: ", e); throw new RuntimeException("Can not load application.properties file."); } } else { logger.error("Error when finding application.properties."); throw new RuntimeException("Error when finding application.properties."); } } Any example would be appreciated. Thanks Update: I added wsdl folder under src/main/resources/META_INF and copied the wsdl file there. In the @WebServiceRef annotation then updated to @WebServiceRef(wsdlLocation = "META-INF/wsdl/HelloWorld.wsdl") But I get the following runtime error when webservice is invoked. Caused by: java.io.IOException: JBAS015526: Child 'META-INF/wsdl/HelloWorld.wsdl' not found for VirtualFile: "/C:/wildfly-8.1.0.Final/bin/content/hello-world.war" wsdl file has the following defined: &lt;wsdl:service name="HelloWorldService"&gt; &lt;wsdl:port name="HelloWorldPort" binding="tns:HelloWorldEndpointBinding" &gt; &lt;soap:address location="http://localhost:9090/HelloWorldPort"/&gt; &lt;/wsdl:port&gt; &lt;/wsdl:service&gt;
has comment: http://stackoverflow.com/comment/42301711
tagged with: wildfly-8
has comment: http://stackoverflow.com/comment/42278282
score: 0
answer count: 3

http://stackoverflow.com/q/26859714
has title: java programming Exception in thread "main" what is this error?
tagged with: arraylist
has answer: http://stackoverflow.com/a/26863013
has body: I wrote this program to find the item and then to remove all elements which are smaller than the item. The are no compilation errors, but when I run the program, the following message appears. Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 5, Size: 5 at java.util.ArrayList.rangeCheck(ArrayList.java:653) at java.util.ArrayList.remove(ArrayList.java:492) at bb.deleteValues(bb.java:15) at bb.main(bb.java:33) Process completed. " Code: import java.util.ArrayList; import java.util.Scanner; public class bb { public static boolean deleteValues(ArrayList&lt;Integer&gt; list, int item) { int p =list.indexOf(item); if(!list.contains(item)) return false; else for(int i=p; i&lt;list.size();i++ ) {int n=list.get(i); if (n&gt;list.get(i+1)) list.remove(p); list.remove(i+1); } return true; } public static void main(String[] args) { ArrayList&lt;Integer&gt; a= new ArrayList&lt;Integer&gt;(8); a.add(3); a.add(10); a.add(4); a.add(5); a.add(3); a.add(2); a.add(8); a.add(6); a.add(4); if(deleteValues(a,4)) for(int x : a) System.out.print(x+ " "); } }
favorite count: 0
has answer: http://stackoverflow.com/a/26859740
accepted answer: http://stackoverflow.com/a/26859740
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26859729
has answer: http://stackoverflow.com/a/26859995
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26859729
downvote count: 0

http://stackoverflow.com/comment/42278718
type: Comment
has text: @amitbhardwaj There's a `Period` and `Duration` class in JodaTime...
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26858419

http://stackoverflow.com/comment/42499984
type: AnswerComment
has text: I like how I went to the Colorado School of Mines' website, copied and pasted the code that they had there, and still, nothing appeared.
type: Comment
comment on: http://stackoverflow.com/a/26964108
score: 0

http://stackoverflow.com/comment/42467503
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26947054
has text: I think I got it. BalusC's MultipartMap actually does what I'm looking for. I just have to make some changes my processing servlet so I can use it.
score: 0

http://stackoverflow.com/comment/42472047
comment on: http://stackoverflow.com/a/26961603
has text: yes, it is a little bit slow but more than okay - works great! really appreciate your input!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26984660
has body: When I run the program if I type something other than "true" or "false" it throws a InputMismatchException. do { System.out.print("Do passengers have an individual tv screen?" + "(true OR false): "); hasVideo = keyboard.nextBoolean(); bus.setIndividualVideo(hasVideo); } while (!(hasVideo == true) &amp;&amp; !(hasVideo == false));
has answer: http://stackoverflow.com/a/26984841
score: 0
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: boolean
has answer: http://stackoverflow.com/a/26984693
has title: How to reprompt for invalid Boolean input (java)
has answer: http://stackoverflow.com/a/26984787
answer count: 3

http://stackoverflow.com/comment/42309753
type: AnswerComment
comment on: http://stackoverflow.com/a/26875952
type: Comment
score: 0
has text: `Sentence<?>` would be more proper. Otherwise you've got a raw type in there still. But yes this is basically the solution, because using a raw `Sentence` causes the entire class to be erased (including the type of `Iterable`).

http://stackoverflow.com/a/26955933
has body: I have finally found the problem. It is linked to the type of my server application. I have use "Native appliaction installed" like I saw in some post and it is necessary to use "Web appliaction" to make it works. Hope it will help someone...
accepted answer of: http://stackoverflow.com/q/26940531
answers question: http://stackoverflow.com/q/26940531
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/43025494
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/133776797
answers question: http://stackoverflow.com/q/26838803
has body: RabbitMQ has priority queue implementation in the core as of version 3.5.0. You can declare priority queues using the x-max-priority argument. This argument should be an integer indicating the maximum priority the queue should support. For example, using the Java client: Channel ch = ...; Map&lt;String, Object&gt; args = new HashMap&lt;String, Object&gt;(); args.put("x-max-priority", 10); ch.queueDeclare("my-priority-queue", true, false, false, args); You can then publish prioritised messages using the priority field of basic.properties. Larger numbers indicate higher priority.
type: Answer
upvote count: 4

http://stackoverflow.com/a/26937412
answers question: http://stackoverflow.com/q/26937307
has comment: http://stackoverflow.com/comment/42419978
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42419319
has comment: http://stackoverflow.com/comment/42420627
has body: The following lines IBO = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, IBO); glBufferData(GL_ARRAY_BUFFER, indices, GL_STATIC_DRAW); are creating a new array buffer. from the name you choose and the data you copy to, I guess this is your index buffer and thus should be of type GL_ELEMENT_ARRAY_BUFFER. What the error message is telling you is, that you draw command cannot use 0 as offset into your index buffer if there is non. Why is there nothing drawn after fixing the index buffer? Problem 1: You are only drawing 4 indices. If you want to draw 2 triangles, you will need 6 indices. Problem 2: OpenGL is a statemachine and VAOs only store the last state that was set when they are unbound. This means your calls to glDisableVertexAttribArray will disable the attributes for your VAO. You should move this calls after GL30.glBindVertexArray(0);
type: Answer
has comment: http://stackoverflow.com/comment/42419513
has comment: http://stackoverflow.com/comment/42419144
score: 1
has comment: http://stackoverflow.com/comment/42420503
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26937307

http://stackoverflow.com/a/26966925
answers question: http://stackoverflow.com/q/26966803
has body: Before finishing current Activity start another Activity : startActivity(i); finish();
score: 0
type: Answer

http://stackoverflow.com/comment/42277839
comment on: http://stackoverflow.com/q/26858239
score: 0
has text: you seem to have missed a closing brace on scanner.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42319436
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26881739
score: 3
has text: What exception/ error does it throw?

http://stackoverflow.com/q/26857457
has answer: http://stackoverflow.com/a/26857704
has comment: http://stackoverflow.com/comment/42306686
type: UnansweredQuestion
downvote count: 2
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42276730
tagged with: java
score: -1
has title: CSS and JS are not rendered when index.jsp is set as welcome file
tagged with: servlets
has comment: http://stackoverflow.com/comment/42276569
has comment: http://stackoverflow.com/comment/42306711
answer count: 1
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/42276815
has comment: http://stackoverflow.com/comment/42276961
favorite count: 0
has comment: http://stackoverflow.com/comment/42316029
has body: I am facing a problem in jsp-servlet, when I am setting up my index.jsp as welcome-file (default page to run first as soon as the project gets run) at that time the CSS and JS files are not rendered. My project Hierarchy is like this -ProjectName &nbsp; &nbsp; &nbsp; &nbsp; -User &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; -css &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; -js &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; -index.jsp And also when I run my project the URL in the browser will be localhost:8080/ProjectName so here index.jsp is called but without CSS and JS files. Edit: Finally, I had solved this issue by copying the CSS and JS to the root directory also. i.e. I have CSS and JS @ "User" as well as "ProjectName".
tagged with: css

http://stackoverflow.com/q/26956095
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26956164
has body: Through the below mentioned program I have encrypted the text using the key and also decrypted the same using the same key but what if, if I forget the key, then how can i get my original text? import java.io.IOException; import java.io.UnsupportedEncodingException; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.spec.AlgorithmParameterSpec; import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import javax.crypto.*; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.PBEParameterSpec; /** * Encryption and Decryption of String data; PBE(Password Based Encryption and Decryption) * @author Vikram */ public class CryptoUtil { Cipher ecipher; Cipher dcipher; // 8-byte Salt byte[] salt = { (byte) 0xA9, (byte) 0x9B, (byte) 0xC8, (byte) 0x32, (byte) 0x56, (byte) 0x35, (byte) 0xE3, (byte) 0x03 }; // Iteration count int iterationCount = 19; public CryptoUtil() { } /** * * @param secretKey Key used to encrypt data * @param plainText Text input to be encrypted * @return Returns encrypted text * */ public String encrypt(String secretKey, String plainText) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, InvalidKeyException, InvalidAlgorithmParameterException, UnsupportedEncodingException, IllegalBlockSizeException, BadPaddingException{ //Key generation for enc and desc KeySpec keySpec = new PBEKeySpec(secretKey.toCharArray(), salt, iterationCount); SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec); // Prepare the parameter to the ciphers AlgorithmParameterSpec paramSpec = new PBEParameterSpec(salt, iterationCount); //Enc process ecipher = Cipher.getInstance(key.getAlgorithm()); ecipher.init(Cipher.ENCRYPT_MODE, key, paramSpec); String charSet="UTF-8"; byte[] in = plainText.getBytes(charSet); byte[] out = ecipher.doFinal(in); String encStr=new sun.mi…
tagged with: java
has comment: http://stackoverflow.com/comment/42454041
has comment: http://stackoverflow.com/comment/42451908
type: Question
answer count: 1
score: -1
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42451595
has title: How to get the original text, if I forget the key
favorite count: 0
has comment: http://stackoverflow.com/comment/42451604

http://stackoverflow.com/a/26872131
score: 0
has comment: http://stackoverflow.com/comment/42303700
has comment: http://stackoverflow.com/comment/42303603
answers question: http://stackoverflow.com/q/26871358
type: Answer
has body: Try getting it from the current thread context loader: Properties properties = new Properties(); ClassLoader loader = Thread.currentThread().getContextClassLoader(); try (InputStream in = loader.getResourceAsStream("config/config.properties")) { properties.load(in); } catch (IOException e) { throw new IllegalStateException("Cannot start, properties not found."); } This code compiles for JDK 7+, since it uses auto closeable, but can be translated to previous JDK version by moving the resource loader statement to be in in the try-catch clause.
has comment: http://stackoverflow.com/comment/42303314

http://stackoverflow.com/q/26895301
has body: I am trying to redraw JFreeChart series every a few seconds with new data. Redrawing is doing in own thread. Everything is working fine but clearing the series causes weird memory leak. I am not sure if the problem comes from sleeping the thread or there's any bug in the clear() method. This is complete sample code (problematic line in method SampleDataFeed): import java.util.Calendar; import java.util.Random; import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.time.FixedMillisecond; import org.jfree.data.time.ohlc.OHLCSeries; import org.jfree.data.time.ohlc.OHLCSeriesCollection; public class sample1 { private static OHLCSeries series1; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // window JFrame wnd = new JFrame(); wnd.setVisible(true); wnd.setSize(800, 500); wnd.setLocationRelativeTo(null); wnd.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // chart series OHLCSeries series = new OHLCSeries("Test"); OHLCSeriesCollection seriesCollection = new OHLCSeriesCollection(); seriesCollection.addSeries(series); series1 = seriesCollection.getSeries(0); // chart final JFreeChart chart = ChartFactory.createCandlestickChart(null, "Time", "Price", seriesCollection, false); chart.getXYPlot().setOrientation(PlotOrientation.VERTICAL); // chart panel final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setMaximumDrawHeight(2000); chartPanel.setMaximumDrawWidth(3000); wnd.add(chartPanel); // chart data feeding thread new DataFeedingThread().start(); } }); } private static class DataFeedingThread implements Runnable { private Thread t; @Override public void run() { // run recursively while (true) { // feed the chart with random data SampleDataFeed(); // what 1 second before next run try { Thread.sleep(1000); } catch (Inter…
type: Question
has title: Clearing the chart causes memory leak?
has comment: http://stackoverflow.com/comment/42349690
answer count: 1
has comment: http://stackoverflow.com/comment/42378475
has answer: http://stackoverflow.com/a/26920780
score: 0
has comment: http://stackoverflow.com/comment/42374372
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/42381136
has comment: http://stackoverflow.com/comment/42378573
has comment: http://stackoverflow.com/comment/42377917
has comment: http://stackoverflow.com/comment/42376652
linked to: http://stackoverflow.com/q/17160643
has comment: http://stackoverflow.com/comment/42347417
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42348697
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42348331
has comment: http://stackoverflow.com/comment/42376693
tagged with: java
has comment: http://stackoverflow.com/comment/42381151
has comment: http://stackoverflow.com/comment/42347840
has comment: http://stackoverflow.com/comment/42373956
accepted answer: http://stackoverflow.com/a/26920780

http://stackoverflow.com/q/26974617
has answer: http://stackoverflow.com/a/26975073
has comment: http://stackoverflow.com/comment/42484878
has title: How to find all character pairs within a string
tagged with: char
has comment: http://stackoverflow.com/comment/42485481
tagged with: string
has body: For the project I have in class, I have to count the diad. For example, if the input is this line: ab ab. there will be 6 diads in total. Which are: "ab", "b ", " a", "ab", "b." and ".\n" How can I scan the input char by char and find all the diads? What I currently have is: int i=0; while(input.hasNext()){ char c = input.next().charAt(i); i++; System.out.println(c); } However, this only prints out one character from the string at a time. Can anyone help me in modifying my code?
has answer: http://stackoverflow.com/a/26975139
accepted answer: http://stackoverflow.com/a/26975073
possible better answer: http://stackoverflow.com/a/26975139
has comment: http://stackoverflow.com/comment/42485567
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42484335
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42485526
has comment: http://stackoverflow.com/comment/42484592

http://stackoverflow.com/q/26925073
type: Question
tagged with: jakarta-ee
downvote count: 0
has answer: http://stackoverflow.com/a/26925337
upvote count: 1
answer count: 1
favorite count: 0
tagged with: single-sign-on
type: UnansweredQuestion
tagged with: web-applications
tagged with: design-patterns
has body: I have some doubts regarding web application integration. So Please suggest me possible ways for implementing below functionality. Lest's say I have one web Application(WebApp1) in Java/.net/PHP and Second web application(WebApp2) in Java. Both web application is deployed on different web servers. and uses the one common database. One web application(WebApp1) has only login form and other web application(WebApp2) has game module. now when User log in from one web Application(WebApp1) with correct credential then it should redirect to other web application(WebApp2). So Please suggest me how to implement this functionality. Thanks.
has title: How to integrate one webapplication (java) with another webapplication(java/.net.php)?
score: 1
tagged with: java

http://stackoverflow.com/a/26884078
has comment: http://stackoverflow.com/comment/42323449
has body: When you open it as simple text file does it keep your format yyyy-MM-dd HH:ss ? It might be due to the software you use which change automatically the format of your string recognized as a date to a default one.
has comment: http://stackoverflow.com/comment/42323687
answers question: http://stackoverflow.com/q/26883839
score: 0
type: Answer

http://stackoverflow.com/comment/42284383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26860654
has text: i and j both are intended to iterate through the sections of the graph. There are a number of DECADE sections. DECADE = 14 in this case. The g.drawLine() method is dependent on pixels. There are 14 sections, and each section is 70 pixels wide, so I used the width of the total panel as the test and incremented by the width of a section, as a line begins and ends at each section. I believe that you are correct about the second X value needing to be a different value.
score: 0

http://stackoverflow.com/comment/42507311
has text: Use a [`CardLayout`](http://download.oracle.com/javase/8/docs/api/java/awt/CardLayout.html) as shown in [this answer](http://stackoverflow.com/a/5786005/418556).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26986219

http://stackoverflow.com/q/26979268
has title: Android NullPointerException on SearchView using ActionBar
score: 0
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42493288
has body: I'm trying to implement a search functionality in my actionbar, but it is not working as expected, when I run the app I get the following error: java.lang.NullPointerException at br.com.representemais.FragmentClientes.onCreateOptionsMenu(FragmentClientes.java:80) Line 80: searchView.setQueryHint(this.getString(R.string.search)); @Override public void onCreate(Bundle savedInstanceState) { shouldExecuteOnResume = false; super.onCreate(savedInstanceState); // TODO Auto-generated method stub setContentView(R.layout.fragment_cliente); } @Override public boolean onCreateOptionsMenu(Menu menu ) { // TODO Auto-generated method stub MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); searchView = (SearchView) MenuItemCompat.getActionView(menu.findItem(Menus.PROCURAR)); searchView.setQueryHint(this.getString(R.string.search)); ((EditText)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text)) .setHintTextColor(getResources().getColor(R.color.white)); searchView.setOnQueryTextListener(OnQuerySearchView); menu.findItem(Menus.PROCURAR).setVisible(true); return super.onCreateOptionsMenu(menu); } XML: &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" &gt; &lt;item android:id="@+id/menu_search" android:icon="@drawable/ic_action_search" android:title="@string/search" app:actionViewClass="android.support.v7.widget.SearchView" app:showAsAction="ifRoom|collapseActionView" /&gt; &lt;/menu&gt;
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/18260951
tagged with: search
has comment: http://stackoverflow.com/comment/42494726
has comment: http://stackoverflow.com/comment/42495439
tagged with: android-menu
has answer: http://stackoverflow.com/a/26992519
type: Question
has comment: http://stackoverflow.com/comment/42493374
has comment: http://stackoverflow.com/comment/42495348
tagged with: android
tagged with: android-actionbar
has answer: http://stackoverflow.com/a/26981028

http://stackoverflow.com/a/26875939
upvote count: 9
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26875813
type: Answer
has comment: http://stackoverflow.com/comment/42309652
has body: Use an Iterator Iterator&lt;Pearl&gt; iter = this.pearls.iterator(); while ( iter.hasNext() ) { Pearl pearl = iter.next(); // logic iter.remove(); } or simply for (Iterator&lt;Pearl&gt; iter = pearls.iterator(); iter.hasNext();) { Pearl pearl = iter.next(); // logic iter.remove(); }
accepted answer of: http://stackoverflow.com/q/26875813
score: 9

http://stackoverflow.com/q/26882825
type: Question
has comment: http://stackoverflow.com/comment/42395187
has comment: http://stackoverflow.com/comment/42331263
tagged with: apache-tika
tagged with: hadoop
score: 0
has comment: http://stackoverflow.com/comment/42394938
has comment: http://stackoverflow.com/comment/42395696
has comment: http://stackoverflow.com/comment/42358051
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42395943
has title: Extracting document content using Apache Tika and Cloudera Hadoop
has body: I'm trying to extract content from document using Apache Tika jar 1.6 and running MapReduce job using CDH4.6. I have used the code form the below link https://groups.google.com/forum/#!topic/chennaihug/waobSlV0-AE But when I run the code following error is thrown 14/11/12 17:14:55 INFO mapred.JobClient: Task Id : attempt_201411121354_0007_m_000000_1, Status : FAILED Error: java.lang.ClassNotFoundException: org.apache.tika.exception.TikaException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at TikaFileInputFormat.createRecordReader(TikaFileInputFormat.java:15) at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:644) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:330) 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) Can anyone suggest how to resolve this issue?
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42358135

http://stackoverflow.com/a/27037412
downvote count: 0
answers question: http://stackoverflow.com/q/26899559
type: Answer
score: 1
upvote count: 1
has body: First clean your project then deselect "Build Automatically" option from Project/Build Automatically. Now try to export it.

http://stackoverflow.com/q/26904371
has answer: http://stackoverflow.com/a/27104712
linked to: http://stackoverflow.com/q/23203884
score: 4
answer count: 2
downvote count: 0
favorite count: 0
tagged with: windowbuilder
tagged with: swing
upvote count: 4
possible better answer: http://stackoverflow.com/a/27104712
has answer: http://stackoverflow.com/a/39689010
linked to: http://stackoverflow.com/q/22737535
accepted answer: http://stackoverflow.com/a/39689010
type: AnsweredQuestion
has title: Eclipse WindowBuilder Glitch in Text
has comment: http://stackoverflow.com/comment/42370526
tagged with: java
has body: I'm getting strange results in my Eclipse WindowBuilder whenever I try to run my GUI, the top left area has glitchy text (I don't really know what else to call this problem). I've tried searching everywhere but apparently no one else is getting this problem. Problems with the image: Display is being displayed as Displa, 'Search' is scrambled. Problem image: I've tried creating a new project, tried reinstalling eclipse, deleting all my eclipse metafiles, redownloading WindowBuilder, I even uninstalled Java JDK and Java from my computer and reinstalled it. I'm running Windows 7 Ultimate Service pack 1 64bit. Java 8 Update 25 (64-bit). Java SE Development Kit Update 25 (64-bit). Eclipse IDE for Java Developers Version: Luna Service Release 1 (4.4.1) Build id: 20140925-1800 Here is my using WindowBuilder process to give you guys an insight, as I maybe doing something wrong: Create a new project, creating new application window under WindowBuilder. Go to design, add JTabbedPane in the center, and then add JPanel(s), apply GridBagLayout under all of my tabs and then add regardless of what element I put, the first element is always affected by this glitch and so are the tabs themselves affected. I've tried supplied all the information I can please ask me if you want to know more to try to help me figure out what is wrong. My layout of GridBagLayout: Other notes: I've also noticed that even after clean and fresh installs sometimes or often whenever I add a new element to my GUI after reopening or anything I get a big error and have to spam "Reparse" button a few times before I can go back to editing. UPDATE: I also noticed if I type anything in the text fields it will glitch out and I won't be able to see what I'm typing.
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42362725
has comment: http://stackoverflow.com/comment/42360118
linked to: http://stackoverflow.com/q/22491990
has comment: http://stackoverflow.com/comment/42368960

http://stackoverflow.com/a/26883473
has body: @Saj, the Class object is not inherited by your classes, so MOrder.class or MInventory.class can't be type of Class object. All object inherits from Object class, and even Class object inherits from Object class. So, your logic seems incorrect. Think in terms other way to know which type of Object to create.
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26883241

createinstance
type: Tag
tag name: createinstance
tags question: http://stackoverflow.com/q/26854186

http://stackoverflow.com/comment/42496968
has text: had a silly mistake on an other place - you can't cast tv.getText to String→you have to add "" after the line..
type: AnswerComment
comment on: http://stackoverflow.com/a/26981256
score: 0
type: Comment

http://stackoverflow.com/q/26964878
tagged with: java
type: Question
upvote count: 2
has body: when i use xclip in terminal like following and hit ctrl+shift+v, cliboard will be written current date, and i get following roroco@roroco ~/Dropbox/jvs/ro-idea $ echo -n $(date)|xclip -selection clipboard roroco@roroco ~/Dropbox/jvs/ro-idea $ Mon Nov 17 10:54:21 HKT 2014 but when i try following code: class Ex { public static void main(String[] args) { try { Runtime.getRuntime().exec("echo -n $(date)|xclip -selection clipboard"); } catch (IOException e) { e.printStackTrace(); } } } clipboard is not changed, **my question is **how to make Runtime.getRuntime().exec work like terminal also i try java clipboard: package ro.ex; import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; public class Ex { public static void main(String[] args) { String myString = "This text will be copied into clipboard when running this code!"; StringSelection stringSelection = new StringSelection(myString); Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); clpbrd.setContents(stringSelection, null); } } it also doesn't work this is my os: No LSB modules are available. Distributor ID: LinuxMint Description: Linux Mint 17 Qiana Release: 17 Codename: qiana update following code work for me(just add System.in.read()) but it must keep java process running package ro.ex; import java.awt.*; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.io.IOException; /** * Created by roroco on 11/17/14. */ public class Ex2 { public static void main(String[] args) throws IOException { String myString = "This text will be copied into clipboard when running this code!"; StringSelection stringSelection = new StringSelection(myString); Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard(); clpbrd.setContents(stringSelection, stringSelection); System.in.read(); } } update the most simple way is, save content to tmp file, and use xclip to read it public class Util { public static vo…
tagged with: shell
has title: Runtime.getRuntime().exec can't work with xclip
favorite count: 0
linked to: http://stackoverflow.com/q/5928225
has comment: http://stackoverflow.com/comment/42467509
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42479892
has comment: http://stackoverflow.com/comment/42467586
score: 2

http://stackoverflow.com/comment/92967430
type: Comment
score: 3
comment on: http://stackoverflow.com/a/41766552
type: AnswerComment
has text: This is definitely the better, cleaner solution, and can confirm that this removed the warning. Thanks!

http://stackoverflow.com/q/26916678
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42382028
tagged with: java
tagged with: listview
linked to: http://stackoverflow.com/q/22441056
has body: I have created the listview which consists of all the application installed on that device. When the installed applications are displayed to the user, each application have its corresponding checkbox. User clicks on the multiple checkboxes and the corresponding application names are saved. What I want is, when user again starts the application, the checkboxes of the applications which are saved by user should be checked. How can I do this ? Can anyone help me? Thanks in advance. Here is the code AppList.java public class AppList extends Activity { AppInfoAdapter adapter ; AppInfo app_info[] ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_app_list); final ListView listApplication = (ListView)findViewById(R.id.listApplication); final Button b= (Button) findViewById(R.id.button001); final Context context = null; b.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub StringBuilder result = new StringBuilder(); for(int i=0;i&lt;app_info.length;i++) { if(adapter.mCheckStates.get(i)==true) { result.append(app_info[i].applicationName).append(","); // result.append(","); } } String playlists = result.toString(); StoringClas.writeApps(AppList.this, playlists); //String[] po = playlists.split(","); //b.setText(po[2]+"o"); } }); ApplicationInfo applicationInfo = getApplicationInfo(); PackageManager pm = getPackageManager(); List&lt;PackageInfo&gt; pInfo = new ArrayList&lt;PackageInfo&gt;(); pInfo.addAll(pm.getInstalledPackages(0)); app_info = new AppInfo[pInfo.size()]; int counter = 0; for(PackageInfo item: pInfo){ try{ applicationInfo = pm.getApplicationInfo(item.packageName, 1); app_info[counter] = new AppInfo(pm.getApplicationIcon(applicationInfo), String.valueOf(pm.getApplicationLabel(applicationInfo))); System.out.println(counter); } catch(Exception e){ System.out.println(e.getMessage()); } counter++; } adapter = new AppInfo…
type: Question
has answer: http://stackoverflow.com/a/26916777
has title: Saving checkbox state for dynamically created checkboxes in Android
answer count: 1
score: 0
tagged with: android-listview
tagged with: android
tagged with: checkbox
duplicate of: http://stackoverflow.com/q/22441056

http://stackoverflow.com/comment/42291489
comment on: http://stackoverflow.com/a/26865645
score: 0
type: Comment
has text: I checked and I noticed there was something from the java 6 version but I couldn't get rid of it. Do you know what this error means? pic: http://i62.tinypic.com/vxn0vn.jpg
type: AnswerComment

http://stackoverflow.com/comment/42318180
has text: Have you even read my question? this should not be an answer BTW. I know the differences between the two databases and data types (I have been working on both databases for 2 years.. Dah!!)
type: Comment
comment on: http://stackoverflow.com/a/26881032
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42394371
comment on: http://stackoverflow.com/q/26923062
score: 0
has text: Well, yes, you're already using `NumberFormat.getCurrencyInstance()` in the buttons. Can't you just use it in the driver class too?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26930094
score: 0
type: Answer
has body: Your question is unclear I want to know is there is a way to create a rectangle around a tree and if the rectange overlaps the other tree same rectangle: do something. But I will do the best I can: You could just create two boxes about the tree. You would do that by checking something like if (object.box() overlaps otherObject.box()) However, you could also have a far more detailed collision box by using a double[][][] and then storing it with the coordinate. Basically, you would put the coordinates in the double[][][], and then you could check if the other tree is within that double[][][], and if it is, then they have collided. You could set a 1 for a coordinate, and a 0 for air. So for example, if (double[treeX][treeY][treeZ] == 1) do collision stuff here.
answers question: http://stackoverflow.com/q/26928556

http://stackoverflow.com/a/26951668
answers question: http://stackoverflow.com/q/26951652
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26951652
has comment: http://stackoverflow.com/comment/42444210
score: 0
has comment: http://stackoverflow.com/comment/42444646
has comment: http://stackoverflow.com/comment/42444630
type: Answer
has comment: http://stackoverflow.com/comment/42444110
has comment: http://stackoverflow.com/comment/42444148
has body: Here's how: try { // Considering var1 = MainActivity2 Class cls = Class.forName("package.name." + var1); Intent intent = new Intent(MainActivity.this, cls); startActivity(intent); } catch (ClassNotFoundException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/42444256

http://stackoverflow.com/comment/42459913
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26959069
score: 0
has text: @Bailey either `InsertCoin(new Coin(1D));` or change the parameter of `InsertCoin` to `int`.

http://stackoverflow.com/a/26964373
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26964248
type: AcceptedAnswer
has body: FootballClub inherits the variables declared in SportsClub so you can set them as you please. public FootballClub( int gPlayed, int gWins, int gLosses, int gDraws, int gFor, int gAgainst, String inName, String inLocation, int inCapacity ) { played = gPlayed; wins = gWins; losses = gLosses; draws = gDraws; goalsFor = gFor; goalsAgainst = gAgainst; // set the variables from the superclass name = inName; location = inLocation; capacity = inCapacity; } FootballClub also inherits the methods declared in SportsClub so you can use the setters and getters too. Normally you would create a constructor for SportsClub that sets these and then call that constructor from the FootballClub constructor. // in SportsClub protected SportsClub( String inName, String inLocation, int inCapacity ) { name = inName; location = inLocation; capacity = inCapacity; } // in FootballClub public FootballClub( int gPlayed, int gWins, int gLosses, int gDraws, int gFor, int gAgainst, String inName, String inLocation, int inCapacity ) { super(inName, inLocation, inCapacity); played = gPlayed; wins = gWins; losses = gLosses; draws = gDraws; goalsFor = gFor; goalsAgainst = gAgainst; } You should also make your member variables protected or private if you are using setters and getters. I don't know how to print The object You need to override toString. There is a short tutorial here. Also unrelated side note: all Java variable identifiers should start with a lowercase letter. When you have a method like this: public void setName(String Name) { name = Name; } It should be: public void setName(String inName) { name = inName; } Or: public void setName(String name){ this.name = name; }
answers question: http://stackoverflow.com/q/26964248
has comment: http://stackoverflow.com/comment/42467373
upvote count: 2

http://stackoverflow.com/a/26950579
upvote count: 3
score: 3
has body: The typical, pre-Java-8 way of doing things looks like public static Predicate&lt;Bid&gt; isBidByUser(final User usr) { return new Predicate&lt;Bid&gt;() { @Override public boolean apply(Bid p) { return p.getUser().getName().equals(usr.getName()); } }; }
answers question: http://stackoverflow.com/q/26950520
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26950520
type: Answer

http://stackoverflow.com/a/26908589
type: Answer
has comment: http://stackoverflow.com/comment/42367928
has body: I think I was looking at the wrong algorithm for what I was trying to achieve. Instead of using methods to split by separators, the following two-step approach was more successful: First, I implemented a lexer (aka tokenizer, scanner) that splits the string into tokens which include the separators. I.e. split 1.22-3 into 1, ., 22, -, 3 Then, I implement a parser which interprets this token stream, i.e. distinguishes segments and their separators. Possible implementation of the lexer: import java.util.ArrayList; import java.util.List; public final class FixedStringTokenScanner { /** * Splits the given input into tokens. Each token is either one of the given constant string * tokens or a string consisting of the other characters between the constant tokens. * * @param input * The string to split. * @param fixedStringTokens * A list of strings to be recognized as separate tokens. * @return A list of strings, which when concatenated would result in the input string. * Occurrences of the fixed string tokens in the input string are returned as separate * list entries. These entries are reference-equal to the respective fixedStringTokens * entry. Characters which did not match any of the fixed string tokens are concatenated * and returned as list entries at the respective positions in the list. The list does * not contain empty or null entries. */ public static List<String> splitToFixedStringTokensAndOtherTokens(final String input, final String... fixedStringTokens) { return new FixedStringTokenScannerRun(input, fixedStringTokens).splitToFixedStringAndOtherTokens(); } private static class FixedStringTokenScannerRun { private final String input; private final String[] fixedStringTokens; private int scanIx = 0; StringBuilder otherContent = new StringBuilder(); List<String> result = new ArrayList<String>(); public FixedStringTokenScannerRun(final String input, final String[] fixedStringTokens) { this.input = input; this.fixedStringTokens = fixedStringTokens; } List<String> sp…
has comment: http://stackoverflow.com/comment/42375208
score: 0
has comment: http://stackoverflow.com/comment/42374816
answers question: http://stackoverflow.com/q/26908588
has comment: http://stackoverflow.com/comment/42367240
has comment: http://stackoverflow.com/comment/42368101

http://stackoverflow.com/q/26866739
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/33983330
tagged with: java
score: 17
upvote count: 17
type: Question
possible better answer: http://stackoverflow.com/a/33983330
accepted answer: http://stackoverflow.com/a/26871389
has title: How do I close an AWS S3 client connection
has answer: http://stackoverflow.com/a/63885560
tagged with: amazon-web-services
has body: What is the protocol for closing an aws s3 client connection? @Override public boolean connect() { if (connected) return false; else s3Client = new AmazonS3Client(credentials); return true; } @Override public boolean diconnect() { // what should take place here? return false; }
downvote count: 0
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/78851081
has answer: http://stackoverflow.com/a/26871389

http://stackoverflow.com/a/26993650
has body: I have been able to fix this just by stretching the sizes of the document while I created it in iText. I think it has something to do with the DPI settings, but I could not find it anywhere online. The size in iText is set like this: document.setPageSize(new Rectangle(660, 625)); The width (which is 660) is exactly enough to fit on my receipt (which has width = 80mm). The height is just based on trial on error. When the receipt gets bigger (in terms of more height), the printer magically prints a longer receipt. Can anyone maybe tell my why? The pagesize is set to a constant...
accepted answer of: http://stackoverflow.com/q/26950102
type: Answer
answers question: http://stackoverflow.com/q/26950102
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26955733
has comment: http://stackoverflow.com/comment/42452344
has comment: http://stackoverflow.com/comment/42451561
has comment: http://stackoverflow.com/comment/42452283
has answer: http://stackoverflow.com/a/26956270
has answer: http://stackoverflow.com/a/26957969
has body: I just finished a project, and i added to my JMenu an image, i exported it as runnable jar file and when i run it on a different computer, the images aren't appearing. ( because they are on my computer ). Is it possible to add these images to the actual runnable jar? How? this is what i use to get my image. jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Users\\Jeff\\Desktop\\16 (1).jpg"));
has comment: http://stackoverflow.com/comment/42452365
type: Question
has comment: http://stackoverflow.com/comment/42451743
has comment: http://stackoverflow.com/comment/42451797
tagged with: java
has title: I just finished a project, and i added to my JMenu an image, how to keep it in the jar file
has comment: http://stackoverflow.com/comment/42451753
has comment: http://stackoverflow.com/comment/42452085
tagged with: image
has comment: http://stackoverflow.com/comment/42451768
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42451600
has comment: http://stackoverflow.com/comment/42451373
has comment: http://stackoverflow.com/comment/42451860
has comment: http://stackoverflow.com/comment/42452021
has comment: http://stackoverflow.com/comment/42451875
has comment: http://stackoverflow.com/comment/42451488
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42452231
has comment: http://stackoverflow.com/comment/42451824
has comment: http://stackoverflow.com/comment/42451902
has comment: http://stackoverflow.com/comment/42451933
has comment: http://stackoverflow.com/comment/42452141
has comment: http://stackoverflow.com/comment/42451630
has comment: http://stackoverflow.com/comment/42451421

http://stackoverflow.com/comment/42456109
has text: What Exception you are getting? Did you try running this in Eclipse or in Windows CMD?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26958661

http://stackoverflow.com/comment/42266714
score: 0
comment on: http://stackoverflow.com/q/26852133
type: Comment
type: QuestionComment
has text: Final variable value can not be changed once assigned.

http://stackoverflow.com/comment/42414258
comment on: http://stackoverflow.com/q/26934799
type: QuestionComment
type: Comment
score: 1
has text: Please post the output of `dependency:tree`. Most likely, you're getting a transitive dependency pulled in.

http://stackoverflow.com/comment/42363484
type: QuestionComment
comment on: http://stackoverflow.com/q/26906530
has text: There is no "best practice" for this. It is a matter of opinion / personal taste.
score: 3
type: Comment

http://stackoverflow.com/q/26897223
has body: I have a server that creates a new Thread when a client joins and puts it in an ArrayList (that is of the type EchoThread). It works great - creates a new JLabel for each one and updates their positions in my game near instantly, however if one leaves (that isn't the last client in the arraylist) then I want the server to move all of the clients (that are higher than the index of the client that left) down by one. I have tried many things, some partially working. Here is the method if somebody leaves, where i is equal to the index of the client that left: public static void removeClient(int i) throws Exception { } I tried a couple of things, such as using a for loop to move each of the EchoThread's in the arrayList down by one, however they dont seem to work: The ArrayList: static ArrayList&lt;EchoThread&gt; clients = new ArrayList&lt;EchoThread&gt;(); The for loop that I tried: for(int ii = i+1; ii &lt; clients.size()-1; ii++){ EchoThread e = clients.get(ii); clients.set(ii-1, e); } I also tried to make a temporary arraylist that gets all of the elements in the clients arraylist added, except the index i, and then set the clients arraylist to equal the temporary arraylist, but it still failed. Somebody said I could use a linked list, but I don't know how? Edit: p = a JPanel f = a JFrame clients = an arrayList&lt;EchoThread&gt; clientinfo = a JLabel in EchoThread class clientname = an arraylist of strings clientpos = an arraylist of the positions of each client info = a JLabel to show number of clients that are connected Method: public static void removeClient(int i) throws Exception { p.remove(clients.get(i).clientinfo); p.revalidate(); f.validate(); f.repaint(); clients.get(i).clientinfo.setVisible(false); clients.remove(i); clientnames.remove(i); clientpos.remove(i); info.setText("Clients Connected: " + clients.size()); for(int ii = i+1; ii &lt; clients.size()-1; ii++){ EchoThread e = clients.get(ii); clients.set(ii-1, e); } }
tagged with: arraylist
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26915512
has answer: http://stackoverflow.com/a/26897328
has comment: http://stackoverflow.com/comment/42347688
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26897326
has answer: http://stackoverflow.com/a/26915512
type: Question
has title: Move Elements In An ArrayList Down One That Are Higher Than Specific Index
possible better answer: http://stackoverflow.com/a/26897326

http://stackoverflow.com/a/26848670
score: 1
has comment: http://stackoverflow.com/comment/42260672
has comment: http://stackoverflow.com/comment/42260517
has comment: http://stackoverflow.com/comment/42261048
has comment: http://stackoverflow.com/comment/42261024
has comment: http://stackoverflow.com/comment/42260635
downvote count: 0
has comment: http://stackoverflow.com/comment/42260719
accepted answer of: http://stackoverflow.com/q/26848555
has comment: http://stackoverflow.com/comment/42260801
has comment: http://stackoverflow.com/comment/42260283
answers question: http://stackoverflow.com/q/26848555
has body: //Correction Use Jar file Instead of Zip in your class path.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42260845
has comment: http://stackoverflow.com/comment/42260236
has comment: http://stackoverflow.com/comment/42260617
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42260723
has comment: http://stackoverflow.com/comment/42260170
has comment: http://stackoverflow.com/comment/42260955
has comment: http://stackoverflow.com/comment/42261031

http://stackoverflow.com/q/26988235
tagged with: java
possible better answer: http://stackoverflow.com/a/79021464
tagged with: gradle
type: Question
has answer: http://stackoverflow.com/a/79021464
has body: This is the error I'm getting and one that is seemingly unfixable from what I've been searching through on StackOverflow. Error:A problem was found with the configuration of task ':checkDebugManifest'. &gt; File '/Users/wasimsandhu/AndroidStudioProjects/Conjugation/src/main/AndroidManifest.xml' specified for property 'manifest' does not exist. I keep getting this error every time I rebuild the project or sync Gradle files. I have tried solutions in various other threads here to no avail. Here is my app/build.gradle file: apply plugin: 'com.android.application' android { signingConfigs { config { // removed for this post } } compileSdkVersion 21 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.wsandhu.conjugation" minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName "0.5" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.config } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.+' compile 'de.cketti.library.changelog:ckchangelog:1.2.1' compile 'com.nispok:snackbar:2.0.1' } And here is the build.gradle file in the root directory: apply plugin: 'com.android.application' // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:0.13.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } android { compileSdkVersion 21 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.wsandhu.conjugation" minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName "0.5" } } AndroidManifest.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.wsandhu.conju…
has answer: http://stackoverflow.com/a/26988837
answer count: 2
has comment: http://stackoverflow.com/comment/42509422
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26988837
tagged with: android
score: 11
linked to: http://stackoverflow.com/q/27407520
has title: AndroidManifest.xml - specified for property 'manifest' does not exist
tagged with: http://stackoverflow.com/tag/xml
upvote count: 11
type: AnsweredQuestion

primefaces
tags question: http://stackoverflow.com/q/26889443
tags question: http://stackoverflow.com/q/26987951
tags question: http://stackoverflow.com/q/26857976
tags question: http://stackoverflow.com/q/26869487
tags question: http://stackoverflow.com/q/26991168
tags question: http://stackoverflow.com/q/26984296
tag name: primefaces
tags question: http://stackoverflow.com/q/26966886
tags question: http://stackoverflow.com/q/26911267
tags question: http://stackoverflow.com/q/26860936
tags question: http://stackoverflow.com/q/26897886
tags question: http://stackoverflow.com/q/26891786
type: Tag
tags question: http://stackoverflow.com/q/26889557

http://stackoverflow.com/a/26969982
type: AcceptedAnswer
downvote count: 0
has body: As @Mikesname suggests, try writing bytes to temp file and then upload. Use promises and async features of play framework. I am sure you can convert this java code to scala as part of your homework: Promise&lt;File&gt; filePromise = WS.url("http://stackoverflow.com/questions/26967252/how-to-get-java-io-file-by-using-play-ws").get().map((r) -&gt; { FileOutputStream out = null; File file = File.createTempFile("file", null); try { out = new FileOutputStream(file); InputStream bodyAsStream = r.getBodyAsStream(); byte[] barr = new byte[8 * 1024]; int read = 0; while ((read = bodyAsStream.read(barr)) != -1) { out.write(barr, 0, read); } } finally { if (out != null) { out.close(); } } return file; }); filePromise.map((file) -&gt; { // Use amazon service to upload. return file; });
has comment: http://stackoverflow.com/comment/117904182
answers question: http://stackoverflow.com/q/26967252
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26967252
score: 2

http://stackoverflow.com/comment/42388222
score: 1
comment on: http://stackoverflow.com/q/26919951
has text: Don't call `repaint` within a `paint` method, this is setting you up for an infinite loop of paint requests that will consume your CPU cycles
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26854261
has answer: http://stackoverflow.com/a/26854335
has answer: http://stackoverflow.com/a/26854940
has body: I am programming a game and need to execute two keyEvents before fire(); For now I have done this to test: if (key == KeyEvent.VK_SPACE) { fire(); } What I need is: if (key == KeyEvent.VK_DOWN) &amp;&amp; (key == KeyEvent.VK_UP) { fire(); } The problem is, they need to be pressed in this sequence: First down, then up and so fire, but I don't know how can I do it.
linked to: http://stackoverflow.com/q/1457071
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: keyevent
has title: Java event after two keyEvents
tagged with: java
has comment: http://stackoverflow.com/comment/42272507
type: Question
answer count: 2
tagged with: game-engine
downvote count: 0

http://stackoverflow.com/comment/42509279
type: Comment
comment on: http://stackoverflow.com/a/26969662
score: 0
type: AnswerComment
has text: @Serdar Well, managing server instances across multiple machines is hardly going to be *simple* - at best, someone else will have already done the complicated work for you and provided a nice abstraction over the top. For this there isn't one yet. I suggest looking into Java remote management tools, you might find that someone's already built much of the framework so you just have to write the PostgreSQL-specifics.

http://stackoverflow.com/q/26887505
has answer: http://stackoverflow.com/a/67311111
type: Question
tagged with: mongodb
score: 5
has body: I'm using Spring Data's CrudRepository with mongodb and i have some issue to write a query which will select a document with specific subdocument value. Here's an example: { "_id" :, "_class" :, "matchHeader" : { "suspend" : {}, "active" : true, "booked" : true, "eventId" : NumberLong(1009314492), "status" : "" }, "matchInfo" : { } } } i need to select the document with specific eventId field in matchHeader subdocument. i tried to write a function like this findByMatchHeaderEventId(id) but it doesn't helped at all.how can i achieve that?
upvote count: 5
answer count: 3
has answer: http://stackoverflow.com/a/32904419
downvote count: 0
favorite count: 0
has title: Spring data mongodb query for subdocument field
type: UnansweredQuestion
tagged with: spring-data-mongodb
has answer: http://stackoverflow.com/a/35179995
tagged with: nosql
tagged with: java
tagged with: spring-data

http://stackoverflow.com/a/26935035
has comment: http://stackoverflow.com/comment/42510544
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26929718
has body: What came to my mind is a LoadingCache&lt;StringPair, AtomicInteger&gt;. Key is: public final class StringPair { private final String key1, key2; // + constructor, hashCode, equals } I would create it as such... LoadingCache&lt;StringPair, AtomicInteger&gt; cache = CacheBuilder.newBuilder() .build( new CacheLoader&lt;StringPair, AtomicInteger&gt;() { public AtomicInteger load(StringPair key) { return new AtomicInteger(0); } }); then... AtomicInteger value = cache.get(new StringPair("AB", "AB")); value.addAndGet(123); or cache.get(new StringPair("AB", "AB")).addAndGet(123) In this pattern, you only do the lookup once and the update is very efficient as it doesn't have to traverse the map again. You are not really using the cache as a cache but just a loading map. As long as you don't need to access the map with just the first key, I think this would work well.
downvote count: 0
has comment: http://stackoverflow.com/comment/42597214
type: Answer

http://stackoverflow.com/comment/42233463
comment on: http://stackoverflow.com/q/26833242
has text: thanks - this is the info i needed - somehow your google-kung-fu is better than mine ;-)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42432159
type: QuestionComment
comment on: http://stackoverflow.com/q/26944681
has text: Can you show the output from `echo $JAVA_HOME`,`echo $PATH` and `echo $CLASSPATH`?
type: Comment
score: 0

http://stackoverflow.com/comment/42436564
has text: Depending on what you're doing, [SharedPreferences](http://developer.android.com/reference/android/content/SharedPreferences.html) may work. Otherwise you could try @SweetWisher's solution.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26902065
type: Comment

ajax
tags question: http://stackoverflow.com/q/26932476
tags question: http://stackoverflow.com/q/26832952
tags question: http://stackoverflow.com/q/26881923
tags question: http://stackoverflow.com/q/26859096
tags question: http://stackoverflow.com/q/26969773
type: Tag
tags question: http://stackoverflow.com/q/26899912
tags question: http://stackoverflow.com/q/26987288
tags question: http://stackoverflow.com/q/26932404
tags question: http://stackoverflow.com/q/26848390
tags question: http://stackoverflow.com/q/26922327
tags question: http://stackoverflow.com/q/26926502
tags question: http://stackoverflow.com/q/26906293
tags question: http://stackoverflow.com/q/26865476
tags question: http://stackoverflow.com/q/26991851
tags question: http://stackoverflow.com/q/26934202
tags question: http://stackoverflow.com/q/26904322
tags question: http://stackoverflow.com/q/26960809
tag name: ajax

http://stackoverflow.com/comment/42310651
comment on: http://stackoverflow.com/q/26876634
type: Comment
type: QuestionComment
score: 1
has text: Extended Euclidean Algorithm. Google it!

http://stackoverflow.com/a/26996213
has body: You are not measuring shift, but rather HashMap.put. Look at Long.hashCode() implementation and you'll see why &lt;&lt; 32 is the turning point.
has comment: http://stackoverflow.com/comment/42539072
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26983658
accepted answer of: http://stackoverflow.com/q/26983658
has comment: http://stackoverflow.com/comment/42686594
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42529592

http://stackoverflow.com/q/26857236
tagged with: sshd
type: UnansweredQuestion
score: 6
has title: Apache MINA SFTP - limit the directory structure that the user sees
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/38443972
upvote count: 6
linked to: http://stackoverflow.com/q/38441969
tagged with: authorization
tagged with: mina
has body: Am using Apache MINA SSHD to build my own custom SFTP Server. I want to limit the file system my user sees. I just want them to see the directory structure under /aa/bb/cc I do not want them to be able to see or navigate any other folder. And from the directories under /aa/bb/cc, a user will have read access to some directories and write access to only a selected few. How do I achive this ?
answer count: 1
favorite count: 0

http://stackoverflow.com/a/26937288
has comment: http://stackoverflow.com/comment/42419817
downvote count: 0
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26936917
answers question: http://stackoverflow.com/q/26936917
has body: It might not be the most performant solution but I think this is the easiest one: BigDecimal input = new BigDecimal("248.03500000066338"); double rounded = input.round(new MathContext(6)).doubleValue();

http://stackoverflow.com/comment/42395974
comment on: http://stackoverflow.com/q/26911562
type: Comment
type: QuestionComment
has text: And there should be because? Add your `Application` class. Regarding your config `spring-tx` is already included by using the `spring-boot-starter-data-jpa` depenency, next to that the current version conflicts with the other Spring jars in your project!.
score: 0

http://stackoverflow.com/q/26883839
has title: Date formatting is lost after putting it to CSV file
answer count: 1
score: 0
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/42323218
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42323320
has comment: http://stackoverflow.com/comment/42323233
has body: I have some date, which I need to put into CSV file. I formatted the date to String using simple date format. By using debugger I found out that it works, date is really formatted correctly. However after putting it into CSV file I get format dd-MM-yyyy HH:ss and I wanted yyyy-MM-dd HH:ss. Here is the code: if (x.Contact_Email_IsSubscribed.equals("False")) { //boolean merged = false; Date latestUnsubscriptionDate=new Date(0); // MERGE UNSUBSCRIBED DATE WITH CONTACT for (Contact y : unsubscribedContacts) { if (y.EmailAddress.equals(x.C_EmailAddress)) { //find latest unsubscription date Date unsubscriptionDate=new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(y.ActivityDate); //System.out.println(unsubscriptionDate); if (unsubscriptionDate.compareTo(latestUnsubscriptionDate)&gt;0){ latestUnsubscriptionDate=unsubscriptionDate; //System.out.println(); } } } values.append(x.toString() + ";" + new SimpleDateFormat("yyyy-MM-dd HH:mm").format(latestUnsubscriptionDate)); values.append("\n"); } else { values.append(x.toString() + ";null" + "\n"); } And to the CSV file it is simply written like this: writer = new FileWriter(sFileName); writer.append(values.toString()); It is driving me crazy.
has answer: http://stackoverflow.com/a/26884078
tagged with: simpledateformat
tagged with: java
tagged with: date
type: Question

http://stackoverflow.com/q/26926588
type: Question
linked to: http://stackoverflow.com/q/17293304
has title: Calling thread object method after completion of run
tagged with: java
answer count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/26926707
upvote count: 1
type: UnansweredQuestion
has body: I am writing a class that reads remote file data on a seperate thread. This class inherits from thread and reads some remote file data in run method.I stored the data in a string. Can i add other method that returns this data string? i saw isalive return false value after run method returns. Do i need to use event mechanism? Please suggest some better workaround.
has answer: http://stackoverflow.com/a/26926721
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42399551
tagged with: jvm
favorite count: 0

http://stackoverflow.com/comment/42513990
has text: Why do you think a local variable is static?
comment on: http://stackoverflow.com/q/26991291
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42503462
comment on: http://stackoverflow.com/q/26984767
type: QuestionComment
has text: I can see a myMediaPlayer.pause(); on the first button, is that on purpose?
score: 0
type: Comment

http://stackoverflow.com/q/26881447
has comment: http://stackoverflow.com/comment/42318810
upvote count: 0
has comment: http://stackoverflow.com/comment/42318745
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26881530
has answer: http://stackoverflow.com/a/26881626
has comment: http://stackoverflow.com/comment/42318832
has title: java.lang.NoClassDefFoundError after some time
type: Question
linked to: http://stackoverflow.com/q/17973970
tagged with: java
tagged with: noclassdeffounderror
score: -1
has answer: http://stackoverflow.com/a/26881644
has comment: http://stackoverflow.com/comment/42431360
has comment: http://stackoverflow.com/comment/42319007
answer count: 3
has body: I have running an application (3rd party, not selfprogrammed) on tomcat. After some days I get an java.lang.NoClassDefFoundError error insome situation. After a restart of the JVM it runs fine again. What could be the reason ? Doesn't the classloader loads all classes at start ? Stacktrace: java.lang.NoClassDefFoundError: com/ibm/cognos/bux/service/atom/provider/cm/AtomUtils com.ibm.cognos.bux.service.atom.provider.cm.providers.impl.contentmanager.DefaultAtomProvider.createSearchPath(DefaultAtomProvider.java:150) com.ibm.cognos.bux.service.atom.provider.cm.providers.impl.contentmanager.DefaultAtomProvider.doGet(DefaultAtomProvider.java:185) com.ibm.cognos.bux.service.atom.provider.cm.providers.BaseAtomProvider.handleRequest(BaseAtomProvider.java:52) com.ibm.cognos.bux.service.atom.provider.cm.ContentManagerAtomProvider.handleRequest(ContentManagerAtomProvider.java:71) com.ibm.cognos.bux.service.atom.ModelATOM.handleRequest(ModelATOM.java:232) com.ibm.cognos.bux.service.atom.ViewATOM.handleRequest(ViewATOM.java:90) com.ibm.cognos.bux.BUXControllerBaseImpl.mvcHandleRequest(BUXControllerBaseImpl.java:154) com.ibm.cognos.bux.service.atom.AtomService.handleRequest(AtomService.java:55) com.ibm.cognos.bux.http.ServiceRequestHelper._executeRequest(ServiceRequestHelper.java:80) com.ibm.cognos.bux.http.ServiceRequestHelper.executeRequest(ServiceRequestHelper.java:50) com.ibm.cognos.bux.service.main.ViewDHTMLInputStreamResolver$2.callImpl(ViewDHTMLInputStreamResolver.java:481) com.ibm.cognos.bux.service.main.ViewDHTMLInputStreamResolver$2.callImpl(ViewDHTMLInputStreamResolver.java:1) com.ibm.cognos.bux.service.main.BUXCallable.call(BUXCallable.java:34) java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) java.util.concurrent.FutureTask.run(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source)
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/42460887
type: QuestionComment
comment on: http://stackoverflow.com/q/26961109
has text: @DavidWallace Searching & Updating a `Player` can be done in O(1) using `HashMap<String, Player>. But overall cost ofconstructing a separate list of max scorers will be O(nlogn).
score: 0
type: Comment

http://stackoverflow.com/comment/42520772
has text: @Subh That should be resolved since I moved the comments to chat. It overrides the rep requirement so Andy should be able to join.
comment on: http://stackoverflow.com/a/26935647
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42338601
has text: @StoneBird, I don't have any device. If I can send the whole project, would you test it for me? Here, I badly need help, and because of this issue, I cannot go further
score: 0
comment on: http://stackoverflow.com/q/26891861
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42451024
score: 0
type: QuestionComment
type: Comment
has text: Perhaps it is a problem with your network setup? The HTML page that comes back sounds not like something that the Neo4j server would return?
comment on: http://stackoverflow.com/q/26953995

thrift
tags question: http://stackoverflow.com/q/26867013
type: Tag
tag name: thrift

http://stackoverflow.com/a/26919757
upvote count: 1
has comment: http://stackoverflow.com/comment/42388128
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26919701
has comment: http://stackoverflow.com/comment/42388182
has body: If all you are trying to do is call a method by name, you don't need to cast it to anything. It is sufficient to use the Object with further reflection. See Class.getDeclaredMethod(), as in: Object carObj = ...; Method method = carObj.getClass().getDeclaredMethod(methodName, ...); Object retObj = method.invoke(carObj, ...); Note that we don't care what type carObj actually is, although if you wanted to check you could always use instanceof or Class.isAssignableFrom or Class.isInstance. It is a bit weird, though, that you are instantiating a new object then calling one of its methods all in one go. That object goes away once your runTheMethod returns. By the way, it looks like you're just trying to get and set bean properties. You might want to have a look at Apache Commons BeanUtils instead, then your example becomes simply: CarBean bean = ...; String color = (String)PropertyUtils.getSimpleProperty(bean, "color"); // calls getter.
score: 1

http://stackoverflow.com/comment/42435796
comment on: http://stackoverflow.com/q/26946747
has text: The google keywords you're looking for are "primitive type collections".
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26834042
has comment: http://stackoverflow.com/comment/42268953
answers question: http://stackoverflow.com/q/26833913
has body: there are several aspects to GridBagLayout (GBL) that get missed by first time users. 1) components placed inside the GBL will initialize at their "preferred" size. JPanel, iirc, has a preferred size of 1x1. 2) if you want the GBL cells to resize according to the enclosing container, you need to give them a weightx and weighty. what those two attributes do is say, give the cell a percentage of the available area according to the ratio of all the weightx's and weighty's assigned. e.g. if i have 2 cells and 1 has weightx = 1.0 and the second one is given 2.0, then the first cell will be 1/2 as wide as the second (or the second one will be twice as wide). 3) GBL takes alot of trial and error when you first dive in, BUT it is the most powerful, flexible, and reliable layout (especially compared to nested layouts, blech)
has comment: http://stackoverflow.com/comment/42273650
upvote count: 2
has comment: http://stackoverflow.com/comment/42234838
has comment: http://stackoverflow.com/comment/42234670
has comment: http://stackoverflow.com/comment/42236686
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42273570
downvote count: 0
has comment: http://stackoverflow.com/comment/42302040
has comment: http://stackoverflow.com/comment/42302056

http://stackoverflow.com/comment/42317568
comment on: http://stackoverflow.com/q/26857976
has text: Setting 'ajax="false"' didn't call the print method.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42374366
has text: No need for `where` clause if you `order by` the same column.
comment on: http://stackoverflow.com/q/26912255
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26914471
answers question: http://stackoverflow.com/q/26904554
has comment: http://stackoverflow.com/comment/42489878
type: Answer
has comment: http://stackoverflow.com/comment/109552128
has body: To add another maven project (that is not part of your main project) as a dependency: open you main project in Maven Projects Tool Window click on green + button and select pom.xml of a dependency repeat 2 as required Source: https://www.jetbrains.com/idea/help/maven-projects-tool-window.html?search=maven%20project
has comment: http://stackoverflow.com/comment/42490852
upvote count: 5
score: 5
downvote count: 0

http://stackoverflow.com/comment/42352156
comment on: http://stackoverflow.com/a/26899701
has text: Does this work when there are multiple strings that appear the same amount of time, when it adds both into a list for further processing?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42363930
comment on: http://stackoverflow.com/a/26906797
score: 0
type: AnswerComment
type: Comment
has text: I thought about it but assining the value of str twice if default seemed redondant

http://stackoverflow.com/q/26855003
accepted answer: http://stackoverflow.com/a/26862913
score: 2
downvote count: 0
tagged with: java
tagged with: mysql
type: Question
tagged with: hive
type: AnsweredQuestion
upvote count: 2
tagged with: hadoop
tagged with: sql
answer count: 1
favorite count: 0
has body: I need to insert unique rows into a hive table based on Customer name and Address. is there anyway we can generate unique value using customer name and address? I am looking to generate unique_value column like below and select rows with distinct unique_value. For example like below I want to generate unique_value column {customer_name} {address} {unique_value} omar street1 111 ryan stree2 222 omar street1 111 or any other approaches are also appreciated!.
has title: Generate unique customer id / insert unique rows in hive
has answer: http://stackoverflow.com/a/26862913

http://stackoverflow.com/q/26884424
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26884632
linked to: http://stackoverflow.com/q/6598203
has comment: http://stackoverflow.com/comment/42325468
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26884518
has body: I'm trying to create a hand evaluator that it will allow me to compare if one hand is better than another. I know there many other post on SO about this topic however many of them are old now and the links no longer link to anything useful. The only way I can think of doing this at the moment is to manually check for every different combination. Eg check for ace of any suit, if this doesn't exist then move to the next combination eg straight flush then 4 of a kind and so on. However, then how would you compare a pair of 2s to a pair of 3s unless you gave an integer to every combination of cards that made something interesting. However, that would very hard to do manually. Is there a better way?
tagged with: poker
has comment: http://stackoverflow.com/comment/42324276
has comment: http://stackoverflow.com/comment/42337926
has answer: http://stackoverflow.com/a/26885566
has comment: http://stackoverflow.com/comment/42325460
has title: Java 7 card poker hand evaluator
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42325364
has comment: http://stackoverflow.com/comment/42325245
favorite count: 0

http://stackoverflow.com/q/26888675
type: Question
accepted answer: http://stackoverflow.com/a/27246874
answer count: 1
tagged with: google-play-games
score: 0
has body: I've got a huge problem with google play games services. Indeed, in some devices, when I try to launch my game, the api try to connect to the services : the play game window appears, then we saw the loading image (a circle), finally an error message comes in front "Unfortunately, Google Service has stopped". When we click on OK, the process restart ( the loading image, the message ...). We use GameHepler to implements Google games service. Here is the class AndroidLauncher : public class AndroidLauncher extends AndroidApplication implements AdControl, ActionResolver, GameHelperListener, MultiplayerInterface, RoomUpdateListener, RealTimeMessageReceivedListener, RoomStatusUpdateListener, View.OnClickListener, OnInvitationReceivedListener { protected AdView adView; private GameHelper gameHelper; private MonJeu monJeu; private static final String AD_UNIT_ID = "XXXXXXXXXXXXXXXXXXXXX"; private final int SHOW_ADS = 1; private final int HIDE_ADS = 0; // Request codes for the UIs that we show with startActivityForResult: final static int RC_SELECT_PLAYERS = 19070; final static int RC_INVITATION_INBOX = 19071; final static int RC_WAITING_ROOM = 19072; final static int MAIN_SCREEN = 29070; final static int GAME_SCREEN = 29071; final static int POPUP_INVIT = 29072; final static int LOADING_SCREEN = 29073; // The participants in the currently active game ArrayList&lt;Participant&gt; mParticipants = null; String creatorId; // Room ID where the currently active game is taking place; null if we're // not playing. String mRoomId = null; // My participant ID in the currently active game String mMyId = null; // If non-null, this is the id of the invitation we received via the // invitation listener String mIncomingInvitationId = null; // Are we playing in multiplayer mode? boolean mMultiplayer = false; protected Handler handler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { case SHOW_ADS: { adView.setVisibility(View.VISIBLE); break; } case HID…
has answer: http://stackoverflow.com/a/27246874
tagged with: android
has comment: http://stackoverflow.com/comment/42349142
has comment: http://stackoverflow.com/comment/42380499
has comment: http://stackoverflow.com/comment/42335466
type: AnsweredQuestion
tagged with: libgdx
has comment: http://stackoverflow.com/comment/42384388
tagged with: java
has title: Android Google play games services signin failed and looped
tagged with: google-play-services

http://stackoverflow.com/comment/42388989
comment on: http://stackoverflow.com/q/26920142
score: 0
type: QuestionComment
type: Comment
has text: When I read code in my head, I read the `=` sign as "becomes". So I read `a = 5` as "a becomes 5". Or `temp = intNum[j]` as "temp becomes intNum[j]".

http://stackoverflow.com/comment/42384698
has text: Adrian AFAIK C# supports cache for Asp.Net and MVC. In contrast, Java has `ServletContext` since I remember working with Java web application, which could be similar but it's not a real cache since its elements need to be removed manually and doesn't offer synchronization when adding/removing attributes. Also, I don't really wonder why is or there isn't a class called Cache in Java. If you understand how a cache should work, then you can create yours and Java offers you the basic elements to do so.
comment on: http://stackoverflow.com/a/26917397
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/42470032
has text: Did you try to debug the code? Provide complete SQL and what is the output when you execute the SQL via commandline?
comment on: http://stackoverflow.com/q/26965184
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26885258
has body: I am trying to develop a plugin for Sonar which can get input from some third party API and get some results, Third party API will give me details such as Line number and file name, I want to put a link to that file and line on sonar widget, Can anyone help me, how can I create a link to particular file and line on Sonar widget
type: UnansweredQuestion
tagged with: sonarqube
score: 2
downvote count: 0
favorite count: 0
has title: Sonarqube Plugin development
type: Question
upvote count: 2
answer count: 1
has answer: http://stackoverflow.com/a/36669127
tagged with: java

http://stackoverflow.com/q/26880504
answer count: 0
has comment: http://stackoverflow.com/comment/42317351
tagged with: java
has comment: http://stackoverflow.com/comment/42317422
has comment: http://stackoverflow.com/comment/42317465
type: Question
has comment: http://stackoverflow.com/comment/42317311
tagged with: eclipse
score: 0
has title: sending textview data in android to server
tagged with: apache
has comment: http://stackoverflow.com/comment/42317256
type: UnansweredQuestion
tagged with: android
has body: this code is running correctly.but the problem is.it is not saving text view value in data base. please help me. when onclick button is executed the data should fetch to data base.but its is not showing any thing in data base. i converted the lat lang values into string and after that it is converted into address format. iam calling the string values of lat lang into data base.it is not showing any thing. public class Cam extends Activity { /** Called when the activity is first created. */ String lat="", lon=""; String ret = ""; TextView tv; HttpClient httpclient; HttpPost httppost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cam); Button btnAdd = (Button)findViewById(R.id.btnAddress); btnAdd.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // Acquire a reference to the system Location Manager LocationManager locationManager = (LocationManager) Cam.this.getSystemService(Context.LOCATION_SERVICE); // Define a listener that responds to location updates LocationListener locationListener = new LocationListener() { public void onLocationChanged(Location location) { // Called when a new location is found by the network location provider. lat = Double.toString(location.getLatitude()); lon = Double.toString(location.getLongitude()); tv = (TextView)findViewById(R.id.txtAddress); tv.setText(GetAddress(lat, lon)); } public void onStatusChanged(String provider, int status, Bundle extras) {} public void onProviderEnabled(String provider) {} public void onProviderDisabled(String provider) {} }; // Register the listener with the Location Manager to receive location updates locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); } }); } public String GetAddress(String lat, String lon) { Geocoder geocoder = new Geocoder(this, Locale.ENGLISH); try { List&lt;Address&gt; addresses = geocoder.getFromLocation(Double.parseDouble(lat), Double.pars…

http://stackoverflow.com/q/26959735
has body: I have the following problem in Android: I store some data as an ArrayList in a Couchbase lite document: ArrayList&lt;FluxDocReg&gt; list_flux = (ArrayList&lt;FluxDocReg&gt;)doc.getProperty("flux"); if (list_flux == null) list_flux = new ArrayList&lt;FluxDocReg&gt;(); FluxDocReg flux = new FluxDocReg(); //..... list_flux.add(flux); //save 'list_flux' in document ... so until I have an ArrayList of LinkedHashedMap objects instead of FluxDocReg. Next, I read the property: if (documentBD != null &amp;&amp; documentBD.getProperty("flux") != null) { ArrayList&lt;FluxDocReg&gt; list_flux = ArrayList&lt;FluxDocReg&gt;)documentBD.getProperty("flux"); ///*****there are some objects in ArrayList, each of type LinkedHashedMap instead of FluxDocReg for (int i = 0; i &lt; list_flux.size(); i++) { ****ERROR**** FluxDocReg flux = (FluxDocReg)list_flux.get(i); } } I get an error when it tries to cast "FluxDocReg flux = (FluxDocReg)list_flux.get(i)" I know that there are some objects in ArrayList, each of type LinkedHashedMap instead of FluxDocReg... What did I do wrong and how can I fix it? Thanks, Catalin
has comment: http://stackoverflow.com/comment/42457873
has comment: http://stackoverflow.com/comment/42598011
has comment: http://stackoverflow.com/comment/42457912
upvote count: 1
answer count: 1
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/27255277
has title: Iterator error for ArrayList: java.util.LinkedHashMap cannot be cast to MyObject
tagged with: android
tagged with: couchbase-lite
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42870623
score: 1
tagged with: java

http://stackoverflow.com/a/26959639
type: Answer
answers question: http://stackoverflow.com/q/26959468
has comment: http://stackoverflow.com/comment/42457864
score: 0
type: AcceptedAnswer
has body: For one of my project, I have use IKVM : http://sourceforge.net/projects/ikvm/ IKVM.NET is a JVM for the Microsoft .NET Framework and Mono. It can both dynamically run Java classes and can be used to convert Java jars into .NET assemblies. It also includes a port of the OpenJDK class libraries to .NET. And this thread to help you to use it with Excel VBA : http://sourceforge.net/p/ikvm/mailman/message/32106884/ Perhaps, this can help you.
accepted answer of: http://stackoverflow.com/q/26959468

http://stackoverflow.com/comment/42239679
has text: please check my updated ans if you no required to ordering then you simply use HashSet.
type: Comment
comment on: http://stackoverflow.com/a/26836988
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42511040
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26989495
has text: Only i using turkish char set give a id textview and my R.java give error i delete xml file but keeping give error
type: AnswerComment

http://stackoverflow.com/comment/42233582
type: QuestionComment
comment on: http://stackoverflow.com/q/26833587
score: 0
has text: Most notably, windows uses \r\n as the line separator.
type: Comment

http://stackoverflow.com/comment/42630448
score: 1
type: AnswerComment
has text: @KostyaKrivomaz Please see the answer below from eee. It certainly is possible to achieve what you seem to want.
type: Comment
comment on: http://stackoverflow.com/a/26854341

http://stackoverflow.com/a/26916536
has comment: http://stackoverflow.com/comment/42381699
has comment: http://stackoverflow.com/comment/42381744
has body: Here is what indexOf does: it iterates through the list, and tests if each RetailItem in the list is equal (using equals()) the the object passed as argument to indexOf(). A RetailItem can't be equal to a String. And a String can't be equal to a RetailItem. So that can't possibly work. So you need to iterate by yourself, to find the first RetailItem whose targetUPC is equal to the targetUPC entered by the user. int index = -1; for (int i = 0; i &lt; list.size(); i++) { if (list.get(i).getTargetUpc().equals(targetUpc) { index = i; break; } }
answers question: http://stackoverflow.com/q/26916175
has comment: http://stackoverflow.com/comment/42381806
score: 0
has comment: http://stackoverflow.com/comment/42381654
type: Answer
has comment: http://stackoverflow.com/comment/42381830

http://stackoverflow.com/a/26903314
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42362499
has body: You can simply traverse the rows as well, If I understood what you want correctly int[][] result = function(parameter); System.out.println(Arrays.deepToString(result)); for (int row = 0; row &lt; result.length; row++) { for (int col= 0; col&lt; result[0].length; col++) { if (result[row][col] &gt;= 179 &amp;&amp; result[row][col] &lt;= 204) { System.out.print("\\"); } if (result[row][col] &gt;= 205 &amp;&amp; result[row][col] &lt;= 230) { System.out.print("."); } if (result[row][col] &gt;= 231 &amp;&amp; result[row][col] &lt;= 255) { System.out.print(" "); } } }
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26903237
score: 1
answers question: http://stackoverflow.com/q/26903237

http://stackoverflow.com/comment/42526088
comment on: http://stackoverflow.com/a/26980100
score: 0
type: AnswerComment
has text: @starikoff I suspect that is the case, without actually diving deep into the native code I guess we can just assume `notifyAll` will actually release the threads and offer no prioritization.
type: Comment

http://stackoverflow.com/comment/77993444
score: 0
type: Comment
type: QuestionComment
has text: See also https://stackoverflow.com/q/4266592/32453
comment on: http://stackoverflow.com/q/26923775

http://stackoverflow.com/a/26984345
score: 0
has comment: http://stackoverflow.com/comment/42502772
answers question: http://stackoverflow.com/q/26984246
type: Answer
has body: Just use textElement.setText(""+numofcoins);

http://stackoverflow.com/comment/42476834
score: 0
comment on: http://stackoverflow.com/q/26970314
type: Comment
type: QuestionComment
has text: Regular expressions return true or false... you will have to split your string at every "/" and chop that into an array. You have provided a minimum of detail and that is why I keep my answer this short - I am not willing to do more work than you ;)

http://stackoverflow.com/q/26987093
tagged with: prepared-statement
type: Question
tagged with: database
tagged with: sql-server
score: 0
linked to: http://stackoverflow.com/q/8479924
answer count: 1
has body: I have been trying to have my JDBC database connection be performed from its own separate class (DB.java) so that whenever I wanted to create a new connection from any of my other multiple classes (eg. CusTab.java) I can just create an instance of DB. After running my first test, which consisted on printing table contents to console I found myself with an error: Something wrong with prepared statement test com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190) at com.microsoft.sqlserver.jdbc.SQLServerConnection.checkClosed(SQLServerConnection.java:388) at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStatement(SQLServerConnection.java:2166) at com.microsoft.sqlserver.jdbc.SQLServerConnection.prepareStatement(SQLServerConnection.java:1853) at marsPackage.CusTab.&lt;init&gt;(CusTab.java:129) Here is my DB.java class, the one that starts the connection to my database KIS_DB it uses windows authentication and for now my GUI connects locally with the DB. package marsPackage; import java.sql.*; public class DB { private Connection dbConn = null; public Connection getConnection(){ //This condition will check if the connection is not already open if (null == dbConn){ //Setup a connection to the database String url = "jdbc:sqlserver://CoT-CIS3365-1\\MSSQLSERVER;databaseName=KIS_DB;integratedSecurity=true"; try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block System.err.println("Class.forName thing is not working here"); e1.printStackTrace(); } try{ dbConn = DriverManager.getConnection(url); PreparedStatement useStmt; try{ useStmt = dbConn.prepareStatement("USE KIS_DB"); useStmt.executeUpdate(); } catch(SQLException e){ e.printStackTrace(); } } catch(SQLException e){ System.err.println("There was a problem connecting to the Database"); e.printStackTrace(); } fi…
accepted answer: http://stackoverflow.com/a/26987163
tagged with: jdbc
has answer: http://stackoverflow.com/a/26987163
has title: JDBC Can't connect to my DB from a separate class. Class DB creates the connection
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26962602
has body: Your main() method is empty. That is the primary entry point into your app, and it doesn't do anything, so the program exits cleanly. Success…?
type: Answer
answers question: http://stackoverflow.com/q/26962569
score: 0

processing
tags question: http://stackoverflow.com/q/26866233
type: Tag
tags question: http://stackoverflow.com/q/26975244
tags question: http://stackoverflow.com/q/26980855
tags question: http://stackoverflow.com/q/26898958
tags question: http://stackoverflow.com/q/26911421
tag name: processing

http://stackoverflow.com/comment/42262893
score: 0
has text: What is it btw that you want to arrange in a circular fashion? Actual SWT `Widget`s? Or is it just text? In that case you could use Draw2d or Zest.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26848345

http://stackoverflow.com/comment/42518502
comment on: http://stackoverflow.com/a/26935647
type: AnswerComment
score: 0
has text: Hi Subh, thanks for the update. The error output in the console now shows the two different handles and is as below "Current handle is: f5ec1357-830a-4ea6-9632-d1da8ac90bda Child handle is: ffe5b144-a6bd-49b4-b034-b0c6e2190280 Exception in thread "main" org.openqa.selenium.NoSuchWindowException: No window found (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 1.59 seconds" Hope this helps :-)
type: Comment

http://stackoverflow.com/comment/42356596
has text: Those were all great sources! Thanks a ton for the help guys! I should hopefully be able to finish this up now.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26902243
score: 0

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

http://stackoverflow.com/q/26848438
has comment: http://stackoverflow.com/comment/42270363
has title: Create a portable Android/Eclipse on Mac/OSX
linked to: http://stackoverflow.com/q/829749
upvote count: 1
answer count: 1
tagged with: macos
has answer: http://stackoverflow.com/a/26854029
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42269634
tagged with: android
linked to: http://stackoverflow.com/q/2841766
downvote count: 0
score: 1
tagged with: java
has body: I'm trying to create a portable environment (USB Flash/Disk) that can be copied from one device to another - and work "out of the box" on a Mac/OSX (10.10.x environment) specifically. My purpose for this, is I'm teaching a "Portable Programming" class next semester, and I want to be able to just copy (or give the student a .zip file), have them expand it on a specifically named volume, and the environment works. This includes the SDK version(s), AVDs, etc. I've got everything apparently working (so far), but have a problem with the AVDs. This is a new install, using latest Eclipse, etc. I'd hoped to find these directories, etc. within an XML/INI file, and use an editor or sed to change the strings, but can't seem to find the directory names of anything I've needed to change so far within an XML/INI file within the unzipped Android directory - but don't see them. I do see a reference within Preferences->Android->Build "Default debug keystore" that references ~./android - but it is not editable. There IS a "custom" debug keystore setting on the same dialog page, but changing it does not seem to have an effect on the AVDs and their location. So far, that's the ONLY reference I've found for my home directory. I've looked at the Eclipse CLI at eclipse.org, but don't seem to see anything relating to this issue (at least not anything that's ringing a bell with me). So - how can I change my default "home" directory (without boogering up the environment, etc.) for Eclipse/Android, so my AVDs (and whatever else I HAVEN'T run into yet), can be installed and used/run from the USB drive/stick? Please - I DO NOT WANT links to other "portable" packages, as I'm not sure what's actually been altered in them (and probably not current, and an update is likely to hose everything anyway), and don't want to pass along anything to students. I'm downloading official packages from official locations, and want to keep it that way. So I'm only looking for things that can be fixed/edited withi…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42260892
type: Question

http
tags question: http://stackoverflow.com/q/26891449
tags question: http://stackoverflow.com/q/26845344
tags question: http://stackoverflow.com/q/26969640
tags question: http://stackoverflow.com/q/26967411
tags question: http://stackoverflow.com/q/26879034
tags question: http://stackoverflow.com/q/26932676
tags question: http://stackoverflow.com/q/26940558
tags question: http://stackoverflow.com/q/26833188
tags question: http://stackoverflow.com/q/26840241
tags question: http://stackoverflow.com/q/26840012
tags question: http://stackoverflow.com/q/26897665
tags question: http://stackoverflow.com/q/26924768
tag name: http
tags question: http://stackoverflow.com/q/26933623
tags question: http://stackoverflow.com/q/26954512
tags question: http://stackoverflow.com/q/26940410
tags question: http://stackoverflow.com/q/26968305
tags question: http://stackoverflow.com/q/26892480
tags question: http://stackoverflow.com/q/26887231
tags question: http://stackoverflow.com/q/26964988
tags question: http://stackoverflow.com/q/26975059
type: Tag
tags question: http://stackoverflow.com/q/26899951
tags question: http://stackoverflow.com/q/26987847
tags question: http://stackoverflow.com/q/26937100
tags question: http://stackoverflow.com/q/26875224
tags question: http://stackoverflow.com/q/26898629
tags question: http://stackoverflow.com/q/26942666
tags question: http://stackoverflow.com/q/26912698
tags question: http://stackoverflow.com/q/26880192

http://stackoverflow.com/q/26934354
possible better answer: http://stackoverflow.com/a/32162213
has title: How to load / insert initial data into database with Ebean in Play Framework?
has answer: http://stackoverflow.com/a/32162213
has body: I need to some initial data (from csv files) into database. I am using Ebean with Play! Framework. I read the doc. It says using YAML files to store the data and call Ebean.save(). And this is done in a Test. My questions: Where should I insert my data? (Test is probably not the ideal place, as this data should be used in production) Can I write my own code to get my data from existing csv files, instead of using YAML files? Any suggestions or doc links will be appreciated. Thanks!
answer count: 2
tagged with: playframework
accepted answer: http://stackoverflow.com/a/26936398
downvote count: 0
favorite count: 0
tagged with: ebean
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26936398
type: Question

http://stackoverflow.com/a/26867752
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/26867697
answers question: http://stackoverflow.com/q/26867697
score: 5
type: AcceptedAnswer
downvote count: 0
has body: object doesn't contain references to these object1 and object2, but contains copied references to these objects. If you do: public static Object[] objects; public static void main(String[] args) { new Class2(); objects = { object1, object2 }; for (Object o : objects) { System.out.println(o); } } i.e. initialize object after you initialize object1 and object2 you will have copies in the array that are not empty.

http://stackoverflow.com/q/26902801
tagged with: java
has title: How to sort HashMap based on property of key object when values of Hashmap are same?
has comment: http://stackoverflow.com/comment/42358358
type: Question
tagged with: hashmap
answer count: 1
has comment: http://stackoverflow.com/comment/42357642
score: 0
has answer: http://stackoverflow.com/a/71195043
type: UnansweredQuestion
has body: I have a HashMap with objects of a class (obj1, obj2, obj3) as keys and java.util.Date (date1, date2, date3)as values. The HashMap is already sorted based on the values, i.e., based on the date objects. The key objects are having property called name. obj1.name = "name1", obj2.name = "name2" etc. Now, When the values of HashMap are same, i.e., when there are same dates as values, I need to check the name of the key object (obj.name) and sort the HashMap based on name propery of key object. Note that I need to sort based on the name property of key object only when the HasHMap has same date as values. For example, I have the below HashMap [obj1=Tue Jul 01 00:00:00 IST 2014,obj2=Thu Jul 03 00:00:00 IST 2014,obj3=Thu Jul 03 00:00:00 IST 2014,obj4=Sun Jul 06 00:00:00 IST 2014] And the name property of each key object is obj1.name = "B"; obj2.name = "D"; obj3.name = "A"; obj4.name = "C"; Then finally I need to sort the HashMap to get the keySet in the order [obj1,obj3,obj2,obj4], since keys obj2 and obj3 have same date values and hence to be sorted based on name property of key objects.
has comment: http://stackoverflow.com/comment/42358548
linked to: http://stackoverflow.com/q/109383

http://stackoverflow.com/comment/42253613
type: Comment
score: 0
type: AnswerComment
has text: I need the sorting if possible in the query (ie. criteria.addOrder or something like setting projection) because the criteria is passed to a "Paging" object(ie. the query should kind of already sorted when it's passed to the paging object")
comment on: http://stackoverflow.com/a/26842724

http://stackoverflow.com/comment/42469391
has text: I have to do this without using maps, as I'm still new to java and am only allowed to do this the "hard" way
score: 1
comment on: http://stackoverflow.com/q/26966091
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26971447
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26936204
accepted answer of: http://stackoverflow.com/q/26936204
type: Answer
has body: I somehow managed to trick the compiler. class CustomModule extends AbstractModule { static class Holder&lt;T&gt; { Class&lt;T&gt; param; Class&lt;IAction&lt;T&gt;&gt; klass; Holder(Class&lt;?&gt; p, Class&lt;IAction&lt;T&gt;&gt; k) { param = (Class&lt;T&gt;) p; klass = k; } } // this would be similar to the result of classpath scanning List&lt;IAction&lt;?&gt;&gt; stuff; public &lt;T&gt; void bindSome(Class&lt;T&gt; typeParameter, Class&lt;IAction&lt;T&gt;&gt; implementation) { Type parameterizedType = Types.newParameterizedType(IAction.class, typeParameter); bind((TypeLiteral&lt;IAction&lt;T&gt;&gt;) TypeLiteral.get(parameterizedType)).to(implementation); } public CustomModule() { stuff = new ArrayList&lt;&gt;(); stuff.add(new StringAction()); stuff.add(new LongAction()); } @Override protected void configure() { for (IAction&lt;?&gt; act : stuff) { System.out.printf("Configuring %s for %s\n", act.getTypeArguments(), act.getClass()); //the following doesn't work because the compiler cannot understand that //the 1st argument T is the same T in 2nd argument Class&lt;T&gt; //bindSome(act.getTypeArguments(), act.getClass()); //w00t? compiler is tricked?? &lt;String&gt; is erased, but the holder preserves proper class? Holder&lt;String&gt; holder = new Holder(act.getTypeArguments(), (Class&lt;IAction&lt;String&gt;&gt;) act.getClass()); bindSome(holder.param, holder.klass); //this is what I want to avoid doing manually //bind(new TypeLiteral&lt;IAction&lt;String&gt;&gt;() {}).to(StringAction.class); } } }

android
tags question: http://stackoverflow.com/q/26942587
tags question: http://stackoverflow.com/q/26901169
tags question: http://stackoverflow.com/q/26910410
tags question: http://stackoverflow.com/q/26840701
tags question: http://stackoverflow.com/q/26841380
tags question: http://stackoverflow.com/q/26989943
tags question: http://stackoverflow.com/q/26939622
tags question: http://stackoverflow.com/q/26912837
tags question: http://stackoverflow.com/q/26854674
tags question: http://stackoverflow.com/q/26885383
tags question: http://stackoverflow.com/q/26987583
tags question: http://stackoverflow.com/q/26947948
tags question: http://stackoverflow.com/q/26966118
tags question: http://stackoverflow.com/q/26930755
tags question: http://stackoverflow.com/q/26940558
tags question: http://stackoverflow.com/q/26933954
tags question: http://stackoverflow.com/q/26906880
tags question: http://stackoverflow.com/q/26955937
tags question: http://stackoverflow.com/q/26845594
tags question: http://stackoverflow.com/q/26990241
tags question: http://stackoverflow.com/q/26869109
tags question: http://stackoverflow.com/q/26940226
tags question: http://stackoverflow.com/q/26955954
tags question: http://stackoverflow.com/q/26897686
tags question: http://stackoverflow.com/q/26850258
tags question: http://stackoverflow.com/q/26874218
tags question: http://stackoverflow.com/q/26963950
tags question: http://stackoverflow.com/q/26898948
tags question: http://stackoverflow.com/q/26946633
tags question: http://stackoverflow.com/q/26929676
tags question: http://stackoverflow.com/q/26976135
tags question: http://stackoverflow.com/q/26875635
tags question: http://stackoverflow.com/q/26842839
tags question: http://stackoverflow.com/q/26836411
tags question: http://stackoverflow.com/q/26989672
tags question: http://stackoverflow.com/q/26853682
tags question: http://stackoverflow.com/q/26858679
tags question: http://stackoverflow.com/q/26944156
tags question: http://stackoverflow.com/q/26844391
tags question: http://stackoverflow.com/q/26861594
tags question: http://stackoverflow.com/q/26948087
tags question: http://stackoverflow.com/q/26895709
tags question: http://stackoverflow.com/q/26943869
tags question: http://stackoverflow.com/q/26947276
tags question: http://stackoverflow.com/q/26853196
tags question: http://stackoverflow.com/q/26973561
tags question: http://stackoverflow.com/q/26980954
tags question: http://stackoverflow.com/q/26921011
tags question: http://stackoverflow.com/q/26883454
tags question: http://stackoverflow.com/q/26945270
tags question: http://stackoverflow.com/q/26895814
tags question: http://stackoverflow.com/q/26945491
tags question: http://stackoverflow.com/q/26880269
tags question: http://stackoverflow.com/q/26951040
tags question: http://stackoverflow.com/q/26957477
tags question: http://stackoverflow.com/q/26965262
tags question: http://stackoverflow.com/q/26904210
tags question: http://stackoverflow.com/q/26915498
tags question: http://stackoverflow.com/q/26833517
tags question: http://stackoverflow.com/q/26952742
tags question: http://stackoverflow.com/q/26920405
tags question: http://stackoverflow.com/q/26915333
tags question: http://stackoverflow.com/q/26959612
tags question: http://stackoverflow.com/q/26971541
tags question: http://stackoverflow.com/q/26963528
tags question: http://stackoverflow.com/q/26845212
tags question: http://stackoverflow.com/q/26969438
tags question: http://stackoverflow.com/q/26939210
tags question: http://stackoverflow.com/q/26971380
tags question: http://stackoverflow.com/q/26881266
tags question: http://stackoverflow.com/q/26958206
tags question: http://stackoverflow.com/q/26902051
tags question: http://stackoverflow.com/q/26972588
tags question: http://stackoverflow.com/q/26943279
tags question: http://stackoverflow.com/q/26848998
tags question: http://stackoverflow.com/q/26933066
tags question: http://stackoverflow.com/q/26961812
tags question: http://stackoverflow.com/q/26852091
tags question: http://stackoverflow.com/q/26925625
tags question: http://stackoverflow.com/q/26953210

http://stackoverflow.com/comment/42240795
has text: @ColinNull can I suggest you start by writing a simpler recursive method to get the idea? Write a method `fact(n)` to calculate n factorial. If n is 0, then return 1; otherwise, return n*fact(n-1).
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/26833700
type: Comment

http://stackoverflow.com/q/26887280
tagged with: session
has comment: http://stackoverflow.com/comment/42329450
has body: Need I care about hibernate session cache while I am doing just insert(write) operations? Ignore what's down, just to meet SO quality standard: BiteMe bite=new BiteMeToo(""); bite=null; bite.letsBite(); //NullPointerException
accepted answer: http://stackoverflow.com/a/26888749
score: 0
answer count: 1
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Hibernate cache while updating
tagged with: caching
type: Question
has answer: http://stackoverflow.com/a/26888749

android-context
tags question: http://stackoverflow.com/q/26912037
tags question: http://stackoverflow.com/q/26895814
tag name: android-context
type: Tag
tags question: http://stackoverflow.com/q/26898049

http://stackoverflow.com/comment/42429033
comment on: http://stackoverflow.com/q/26942681
type: Comment
has text: is this Homework? and ya what your setName function is doing?
type: QuestionComment
score: 1

http://stackoverflow.com/comment/42356785
type: QuestionComment
has text: also check file mytest.xml is in assest folder not in subfolder
type: Comment
comment on: http://stackoverflow.com/q/26902338
score: 0

http://stackoverflow.com/a/26870182
has comment: http://stackoverflow.com/comment/42333162
type: AcceptedAnswer
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/26867689
downvote count: 1
has body: There are many possible solutions to this problem. In general, there are many good strategies you would typically use to solve this: Look for a pattern. Can you find a pattern that can be easily expressed through logic and algebraic operations? Can the problem be broken down into smaller, more manageable parts? Sometimes what appears to be a complex problem can be separated into smaller, very simple problems. When in doubt, work things out on paper. Let's take your example. At a glance, personally, I would divide the output into two halves; the top, consisting of a single triangle, and the bottom, consisting of a two triangles side by side. Further, let's focus on just being able to draw a triangle at all. Let's say we want to produce this, a triangle at an arbitrary location: 11 012345678901 0 x 1 xxx 2 xxxxx We notice the triangle is centered on column 7, and we suspect it will help us if we can draw a triangle in any column, so let's let center be the center column of our triangle. A lot of these types of strategies involve coming up with a way to parameterize the problem. For this approach we want to find the answer to this question: Given row, column, and center, should we draw a character at that location? Let's take a simple algebraic approach first, one row at a time, and see if we notice any patterns: row == 0: Here we output only when column == center. row == 1: Here we output when column &gt;= center - 1 &amp;&amp; column &lt;= center + 1. row == 2: Here we output when column &gt;= center - 2 &amp;&amp; column &lt;= center + 2. Notice a pattern? Think about it for a second. Recognizing that row == 0 isn't actually a special case, the pattern is: Output when column &gt;= center - row &amp;&amp; column &lt;= center + row. Great! Now we can output a triangle very easily: int center = 7; // From our example. for (int row = 0; row &lt; 3; ++ row) { for (int column = 0; column &lt; 11; ++ column) { if (column &gt;= center - row &amp;&amp; column &lt;= center + …
accepted answer of: http://stackoverflow.com/q/26867689
score: 7
has comment: http://stackoverflow.com/comment/42299460

http://stackoverflow.com/comment/42429710
type: QuestionComment
has text: What's line MainActivity.java:54?
score: 0
comment on: http://stackoverflow.com/q/26943195
type: Comment

http://stackoverflow.com/comment/42245419
has text: is there any fault in this portion while((input = in.read(byteArr)) != -1)
comment on: http://stackoverflow.com/q/26837749
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/q/26913898
answer count: 2
has answer: http://stackoverflow.com/a/26913976
downvote count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/26914018
has answer: http://stackoverflow.com/a/26914018
has comment: http://stackoverflow.com/comment/42377280
score: -3
type: AnsweredQuestion
tagged with: recursion
has title: Can't understand the result of recursion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42377059
has body: i have the code: public static void main(String[] args) { System.out.println(f(4)); } public static int f(int n){ if(n == 1) return 1; return n / f(n - 1); } why this code return 4 ?
linked to: http://stackoverflow.com/q/717725
type: Question
accepted answer: http://stackoverflow.com/a/26913976

http://stackoverflow.com/q/26866466
has answer: http://stackoverflow.com/a/28260072
upvote count: 1
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26867034
accepted answer: http://stackoverflow.com/a/26866884
tagged with: spring-transactions
type: Question
has body: I read tons of posts by people with similar problems but I still can't make my code work. The "No Session found for current thread" arises when I moved my @Transactional from the Dao to the service layer. Indeed, I'm convinced that binding a transaction to a single access is a waste of resources. By the way, my web-app configuration is very common: Spring 3.1.2 Hibernate 4 I can't figure out the problem, I checked that the famous <tx:annotation-driven> is in the right place as well as the correct <context:component-scan ...>. My guess is that spring needs that @Transactional is also placed on top of classes having a session factory reference but it seems a little illogical to me. here's the servlet <context:component-scan base-package="com.x.y.controllers" /> <mvc:annotation-driven /> ... here's the context <tx:annotation-driven transaction-manager="transactionManager"/> <context:component-scan base-package="com.x.y.service" /> <context:component-scan base-package="com.x.y.aop" /> <context:component-scan base-package="com.x.y.model" /> ${database.hibernate.dialect} update true org.hibernate.cache.ehcache.EhCacheRegionFactory true false true 0 here's the service package com.x.y.service.initialization; @Component public class Initializer { @Autowired @Qualifier("userDaoImpl") private UserDao userDao; @PostConstruct @Transactional public void init() { ProfiledUser admin = userDao.loadByUsername("Administrator"); ... } } and here's the DAO package com.x.y.model.dao; @Repository(value="userDaoImpl") public class UserDaoImpl implements UserDao{ @Autowired @Qualifier("sessionFactory") protected SessionFactory sessionFactory; public ProfiledUser loadByUsername(String username) { Session session = sessionFactory.getCurrentSession(); Criteria criteria = session.createCriteria(ProfiledUser.class); criteria.add(Restrictions.eq("username", username)); ProfiledUser user = (ProfiledUser) criteria.uniqueResult(); if(user != null) return user; else return null; } } and here's the st…
downvote count: 0
has answer: http://stackoverflow.com/a/26866755
favorite count: 0
possible better answer: http://stackoverflow.com/a/26866719
answer count: 5
has answer: http://stackoverflow.com/a/26866719
has answer: http://stackoverflow.com/a/26866884
has title: No Session found for current thread: Spring 3 and Hibernate 4 (Using @PostConstruct annotation)

http://stackoverflow.com/q/26928774
tagged with: p2p
has body: I want to use peer 2 peer in Java, and I came across this question: Developing Peer to Peer application in Java They advised to use JXSE/JXTA. It was pretty hard just to download the things I needed because the links are dead. I eventually managed to downloaded JXTA and tried to do the tutorial they provide, however, I get the following error message: jxta-jxse-2.5-sources.jar(net/jxta/id/jxta/IDFormat.java):101: warning: [deprecation] URIInstantiator in IDFactory has been deprecated public static final IDFactory.URIInstantiator INSTANTIATOR = new Instantiator(); ^ jxta-jxse-2.5-sources.jar(net/jxta/id/jxta/Instantiator.java):85: warning: [deprecation] URIInstantiator in IDFactory has been deprecated final class Instantiator implements net.jxta.id.IDFactory.URIInstantiator { So basically, a deprecated API. However, the website of JXTA says to use java version +1.4. I have already tried with the java 8,7,6, 1.4 and every single time I get the problem Is JXTA completely outdated or how can I solve this
score: 0
tagged with: jxta
type: UnansweredQuestion
tagged with: deprecated
answer count: 0
linked to: http://stackoverflow.com/q/4920527
tagged with: java
has comment: http://stackoverflow.com/comment/42403330
has comment: http://stackoverflow.com/comment/42403907
type: Question
has comment: http://stackoverflow.com/comment/42403650
linked to: http://stackoverflow.com/q/10333072
has title: Java peer 2 peer - JXTA uses deprecated API

http://stackoverflow.com/comment/42443381
has text: :D right, you had to fix the type to correct the code, already forgot that. But "his" `features` isn't empty :P.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26950912
score: 0

http://stackoverflow.com/a/26860540
answers question: http://stackoverflow.com/q/26860462
type: Answer
score: 1
upvote count: 1
has body: List&lt;Integer&gt; list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Collections.shuffle(list); Problem solved. And it's also more efficient.
downvote count: 0

http://stackoverflow.com/comment/42463864
score: 0
has text: But what if the cards were arranged in the way 8,6,2,4,10. Then the previous card is not always 2 less but that array is still an even straight.
comment on: http://stackoverflow.com/q/26962884
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42411441
type: Comment
type: QuestionComment
has text: You are welcome - it is already much clearer what you trying to archive - hence my upvote to get you back on track. Now where EXACTLY are you stuck at? Like do you have problems generating all different combinations? Or is it that you are able to generate all those combinations but dont know how to dynamicially generate testcases out of it? Or is it that both the combinations as well as the calls are already working but your `myAlgo` method does not work as expected? (in the last case we would have to see the `myAlgo` method while in the other cases its not realy of interest.
comment on: http://stackoverflow.com/q/26932605
score: 0

http://stackoverflow.com/comment/42427950
comment on: http://stackoverflow.com/a/26942082
has text: the table is not working and i don't wanna call it in the main method
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42367813
score: 0
comment on: http://stackoverflow.com/q/26905864
type: Comment
type: QuestionComment
has text: @Nabin, not it doesn't: https://docs.oracle.com/javase/8/docs/api/java/sql/PreparedStatement.html#setClob-int-java.io.Reader-

http://stackoverflow.com/comment/42465576
has text: You've got to increment the list index when putting things in it. You're only placing items in `list[0]`! Use the `numberArray` variable. Increment it inside the loop and use it as the list array index.
type: QuestionComment
comment on: http://stackoverflow.com/q/26963865
type: Comment
score: 2

http://stackoverflow.com/comment/69600597
score: 0
comment on: http://stackoverflow.com/a/41200608
has text: compans: random computer answer
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26966035
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27125879
tagged with: tomcat6
type: Question
has title: OpenbravoERP after login still it shwoing Loading
upvote count: 1
has body: In OpenbravoERP everything I am installed successfully. When I am trying to login it will goes to one loading page and nothing happen after that.When I'm checking tomcat logs in CATALINA.OUT ,no error is there. Next I checked OPENBRAVO.log ,then it showing smothing error. Please give me an answer ..... I'm giving the openbravo.log here.. roney@roney-Satellite-C850:/var/lib/tomcat6/logs$ tail -f openbravo3.log 2014-11-15 14:53:01,802 [Thread-6] INFO org.openbravo.base.OBSchedulerInitializerListener - Quartz Scheduler successful shutdown. 2014-11-17 10:11:14,656 [main] INFO org.openbravo.dal.core.DalLayerInitializer - Initializing in-memory model... 2014-11-17 10:11:14,699 [main] INFO org.openbravo.base.model.ModelProvider - Building runtime model 2014-11-17 10:11:23,998 [main] INFO org.openbravo.dal.core.DalLayerInitializer - Model read in-memory, generating mapping... 2014-11-17 10:11:34,501 [main] INFO org.openbravo.dal.core.DalLayerInitializer - Dal layer initialized 2014-11-17 10:11:34,556 [main] INFO org.openbravo.base.OBSchedulerInitializerListener - Quartz Initializer Servlet loaded, initializing Scheduler... 2014-11-17 10:11:34,623 [main] INFO org.openbravo.base.OBSchedulerInitializerListener - Scheduler will start in 30 seconds. 2014-11-17 10:11:34,623 [main] INFO org.openbravo.base.OBSchedulerInitializerListener - Storing the Quartz Scheduler Factory in the servlet context at key: org.quartz.impl.StdSchedulerFactory.KEY 2014-11-17 10:11:34,623 [main] INFO org.openbravo.base.OBSchedulerInitializerListener - Storing ConfigParameters and ConnectionProvider in Scheduler Context. 2014-11-17 10:11:34,633 [main] INFO org.openbravo.base.OBSchedulerInitializerListener - Initalizing singleton instance of org.openbravo.scheduling.OBScheduler 2014-11-17 10:15:07,065 [DefaultQuartzScheduler_Worker-1] ERROR org.openbravo.scheduling.ProcessRequestData - SQL error in query: UPDATE AD_Process_Request SET Updatedby = ?, AD_User_ID = ?, Status = ?, Channel = ?, Previous_Fire_…
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42739861
tagged with: openbravo

http://stackoverflow.com/comment/42590612
score: 0
type: Comment
has text: @JesseEdwards if your question is solved you can accept 1 answer to let others know it is solved.
type: AnswerComment
comment on: http://stackoverflow.com/a/26988162

http://stackoverflow.com/a/26887049
type: Answer
has comment: http://stackoverflow.com/comment/81142348
answers question: http://stackoverflow.com/q/26886692
has comment: http://stackoverflow.com/comment/81142303
score: 0
has body: The statements rs1.getString(query1) and rs2.getString(query2) cannot work. From a result set object you can retrieve its current row values using column index or column names. In your case you could have written rs1.getString("username") or rs1.getString(1) because in JDBC world indexes begin at one. Anyway a better solution could be this String a,b; a = txtusername.getText(); b = new String(txtpassword.getPassword()); PreparedStatement statement = null; Connection conn = null; try { Class.forName("java.sql.DriverManager"); Connection conn=(Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/project","root","pizza123"); String query = "select * from userdata where username = ? and password = ?"; statement = conn.prepareStatement(query); statement.setString(1, a); statement.setString(2, b); ResultSet rs = statement.executeQuery(); //check if you have found a valid row if(rs.next()) { close(); tickets x= new tickets(); x.setVisible(true); } else { JOptionPane.showMessageDialog(this,"Username or Password is incorrect"); } } catch(ClassNotFoundException | SQLException | HeadlessException e) { JOptionPane.showMessageDialog(this, e.getMessage()); } finally { try { if(statement != null) statement.close(); } catch (SQLException ex) { ex.printStackTrace(); } try { if(conn != null) conn.close(); } catch (SQLException ex) { ex.printStackTrace(); } } } This solution uses PreparedStatement to prevent SQLInjection attacks. Using a finally block you are sure to release the statement and the connection.

http://stackoverflow.com/q/26912996
tagged with: eclipse-m2t-jet
has comment: http://stackoverflow.com/comment/42375467
tagged with: java
has title: Is it possible to call a JET file within another JET file? If so please explain how it can be done
type: Question
has body: I have a JET file generating a C++ file. I want to generate various C++ files out of a single JET file.The single jet file should call other JET files within it. Is it possible?
has comment: http://stackoverflow.com/comment/42376054
answer count: 1
tagged with: eclipse-plugin
score: 0
has answer: http://stackoverflow.com/a/26917250
type: UnansweredQuestion
tagged with: code-generation

http://stackoverflow.com/q/26939111
downvote count: 2
has title: Error: Array index out of bound Java
has comment: http://stackoverflow.com/comment/42422651
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/42422418
type: Question
has body: It compiles but gives an error of Array IndexOutOfBoundsException : -104421 whenever executed with files provided /* HashTable.java Template for a hash table with String elements. You should complete this file with the implementation for part 3. This template includes some testing code to help verify the implementation. To interactively provide test inputs, run the program with java HashTable3 Input data should consist of a list of strings to insert into the hash table, one per line, followed by the token "###" on a line by itself, followed by a list of strings to search for, one per line. To conveniently test the algorithm with a large input, create a text file containing the input data and run the program with java HashTable3 file.txt where file.txt is replaced by the name of the text file. */ import java.util.Scanner; import java.util.Vector; import java.util.Arrays; import java.io.File; public class HashTable3{ /* **************** HASH TABLE METHODS **************** */ //The size of the hash table.`enter code here` //Do not change this value. public static final int TableSize = 225225; //The TableStorage object T represents the array used for the table. //To retrieve the element at index i, use the method T.getElement(i). //To set the element at index i to a value s, use the method T.setElement(i,s). //You must use only the object below to access the table values. //If you access the table by any other means, or use a different data structure //to represent the table, your submission will not be marked. TableStorage T = new TableStorage(TableSize); /* hash(s) Return the hash code for the provided string. The returned value must be in the range [0,TableSize-1] */ public int hash(String s){ int i; long location = 0; int val; for(i = 0; i&lt; s.length(); i++){ val = s.charAt(i); location = location + ((int)Math.pow(2, i)*(val)); if(location &lt; 0){ location *= (-1); } } location = location % TableSize; return (int)location; } /* insert(s) Insert the value s into t…
has comment: http://stackoverflow.com/comment/42422453
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/26939392
has comment: http://stackoverflow.com/comment/42422423
has comment: http://stackoverflow.com/comment/42422405
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26848673
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/26848832
tagged with: ant
downvote count: 0
favorite count: 0
answer count: 3
tagged with: junit
accepted answer: http://stackoverflow.com/a/26852458
has body: I googled for this, but I couldn't find any help. I have a simple JUnit test class. Eclipse provides me with two options to run the test class in Run as JUnit Test in the Run configuration window, I see Test Runner JUnit 3 or JUnit 4. This is working fine. My classes need to use JUnit4 runner. Now I am trying to run this from the Ant JUnit task. However, it seems to me that Ant is using JUnit3 by default. I am not sure how to set it up to use JUnit4 test runner. I have only JUnit4 jar file in the classpath and I copied ant-junit4.jar from ant lib folder to my classpath. That shows [junit] Could not find the main class: org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner. Program will exit. error. I also tried JUnit4 Ant task. It shows there is no Junit4 ant task. Help? Edit: I just left the ant-junit4.jar in the ant/lib folder and just removed incudeantruntime attribute in the junit task. It works, but again it uses Junit3. Edit I tried running from command like following: `java -classpath &lt;myclasspath that has JUnit.jar as well&gt; org.junit.runner.JUnitCore com.my.TestClass` and it works fine. How do I force ant Junit task to use this class org.junit.runner.JUnitCore?
has title: Configure Ant to use JUnit 4
linked to: http://stackoverflow.com/q/635481
has answer: http://stackoverflow.com/a/26848832
has answer: http://stackoverflow.com/a/26852458
linked to: http://stackoverflow.com/q/7796295
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26853270
tagged with: eclipse

http://stackoverflow.com/comment/42400832
has text: :):) No pblm. Just I have recollected my childhood days :)
type: Comment
comment on: http://stackoverflow.com/a/26926741
score: 0
type: AnswerComment

http://stackoverflow.com/q/26962659
has answer: http://stackoverflow.com/a/26963501
tagged with: java
answer count: 2
upvote count: 1
type: UnansweredQuestion
tagged with: duplicates
tagged with: memory
downvote count: 0
score: 1
tagged with: sparse-matrix
favorite count: 0
has title: In a Java Memory game, how do I trigger that 2 unknown has been discovered, and make them stay revealed for the rest of the game?
type: Question
tagged with: letters
has answer: http://stackoverflow.com/a/26962769
has body: I'm currently doing a java memory game that makes the user guess duplicate letters by input the coordinate of either a 2x2, 4x4 or 6x6 square, which have 2 sets of repeating letters ex. for 4x4 it would be A B C D E F G H A B C D E F G H but randomized If they guess correctly the letters would stay revealed, until all are found. I have successfully randomized the square, and cover it with ( * ), and make them reveal based on the input coordinates But I don't know how to make that once the 2 revealed letters are the same, the program will keep them revealed through out the game, until all duplicate letters are revealed. The code right now (You can copy and paste whole thing below, all comments are commented out): import java.util.Scanner; import java.io.IOException; public class a4{ // main method. DO NOT MODIFY public static void main(String args[]) { Scanner keyboard = new Scanner( System.in ); System.out.println("Welcome to Memory Game"); int board_side; //this loop obtains the board size, or more specifically // the length of the side of the board do{ System.out.println("\n For 2x2 board game press 2"+ "\n For 4x4 board game press 4"+ "\n For 6x6 board game press 6"); board_side=keyboard.nextInt(); }while(board_side!=2 &amp;&amp; board_side!=4 &amp;&amp; board_side!=6); char[][] board = createBoard(board_side); // a call the the shuffle method shuffleBoard(board); // a call to the game playing method playGame(board); } // The following method should shuffle the input 2D array caled board public static void shuffleBoard(char[][] board) { // This creates a 1D array whose size is equal to the size of the board int N = board.length*board.length; char[] board1D = new char[N]; // Testing to see the printed square for ( int i = 0; i &lt; board.length; i++) { for ( int j = 0; j &lt; board[i].length; j++) { System.out.print( board[i][j] + " " ); } System.out.println(); } System.out.println(); for (int i =0; i &lt; board1D.length; i++) { System.out.print(board1D[i] + " ");…

http://stackoverflow.com/q/26973090
accepted answer: http://stackoverflow.com/a/27013735
has body: Hmmm .. in some cases I have an Object which needs to do operations on a hazelcast instance. So I implemented the HazelcastInstanceAware interface but this seems not to work with nested classes ... The following core outputs "null" to the console: public class NullError implements Serializable, HazelcastInstanceAware { private transient HazelcastInstance instance1; private transient HazelcastInstance instance2; public static void main(String[] args) throws Exception { //new NullError().test(); new NullError().lala(); } private void lala() throws Exception { instance1 = Hazelcast.newHazelcastInstance(); instance2 = Hazelcast.newHazelcastInstance(); IMap&lt;Object, Object&gt; foo = instance1.getMap("foo"); foo.put("foo", new Foo(instance1)); ((Callable) instance2.getMap("foo").get("foo")).call(); } public static class Foo implements Serializable, Callable { public Bar bar; public Foo(HazelcastInstance instance) { bar = new Bar(instance); } @Override public Object call() throws Exception { return bar.call(); } } public static class Bar implements Callable, Serializable, HazelcastInstanceAware { private transient HazelcastInstance i; public Bar(HazelcastInstance instance) { this.i = instance; } @Override public void setHazelcastInstance(HazelcastInstance instance) { this.i = instance; } @Override public Object call() throws Exception { System.out.println(i); return null; } } } The documentation does not mention HazelcastInstanceAware only be applied to the root object .. any Ideas? Is this a Bug?
score: 1
tagged with: java
type: Question
has title: HazelcastInstanceAware does not work with nested Objects
answer count: 1
downvote count: 0
tagged with: hazelcast
has answer: http://stackoverflow.com/a/27013735
favorite count: 0
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/26968789
has body: file:config/main.properties file:config/database.properties
upvote count: 1
answers question: http://stackoverflow.com/q/26968697
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/q/26951734
has comment: http://stackoverflow.com/comment/42444198
has comment: http://stackoverflow.com/comment/42444226
score: 0
has body: This is the link for the actual problem, here I have submitted my code multiple times, but each time it had a compilation error. The original message was "Main.java:4: error: class Egypt is public, should be declared in a file named Egypt.java public class Egypt { ^ 1 error" I have no idea where I went wrong. I have copied my code for the problem below. please help me with this code: import java.util.Scanner; import java.util.Arrays; public class Egypt { public static void main(String[] args) { Scanner input = new Scanner(System.in); while (true){ int[] arr = new int[3]; for (int i = 0; i &lt; 3; i++) arr[i] = input.nextInt(); if((arr[0]+arr[1]+arr[2])==0) return; Arrays.sort(arr); int d = (int)(Math.pow(arr[0],2) + Math.pow(arr[1], 2)); if(Math.sqrt(d)==arr[2]) System.out.println("right"); else System.out.println("wrong"); } } }
answer count: 1
has title: Compilation error in UVA 11854
tagged with: compiler-errors
has answer: http://stackoverflow.com/a/26951775
accepted answer: http://stackoverflow.com/a/26951775
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/q/26900804
has title: How to place tabs over JInternalFrame title bar in Java Swing?
has answer: http://stackoverflow.com/a/26905673
has comment: http://stackoverflow.com/comment/42360448
upvote count: 1
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42354003
tagged with: jinternalframe
favorite count: 0
tagged with: jtabbedpane
type: UnansweredQuestion
has body: I want to have a JInternalFrame that will be able to handle JTabbedPane much like the Eclipse IDE. I want the tabs to sit on top of the title bar. Each tab should have its own close button. The InternalFrame should also have a close button so that a user can close all the tabs in one go. This is what I have: This is what I want to have (screenshot taken from Eclipse IDE): I don't know how I can achieve this. Can anyone please point me in the right direction? EDIT: Based on a comment to look into UI Delegate, I created a UI delegate subclass that is able to remove the menu, but there are some problems with this: It looks kind of funny in comparison to a normal JInternalFrame, even though I haven't done anything to it but comment out the "createActionMap" and "add(menuBar)" lines. I can't find anywhere in the library code to indicate how the title bar and contentPane positions are set - obviously I want to move the position of the contentPane to overlap the title bar. Here are the codes: public class MyInternalFrameUI extends BasicInternalFrameUI { public MyInternalFrameUI(JInternalFrame b) { super(b); // TODO Auto-generated constructor stub } public static ComponentUI createUI(JComponent b) { return new MyInternalFrameUI((JInternalFrame)b); } protected JComponent createNorthPane(JInternalFrame w) { titlePane = new MyBasicInternalFrameTitlePane(w); return titlePane; } } public class MyBasicInternalFrameTitlePane extends BasicInternalFrameTitlePane { public MyBasicInternalFrameTitlePane(JInternalFrame f) { super(f); } protected void installTitlePane() { installDefaults(); installListeners(); createActions(); enableActions(); //createActionMap(); // This method is package protected and not visible setLayout(createLayout()); assembleSystemMenu(); createButtons(); addSubComponents(); } protected void addSubComponents() { //add(menuBar); // Remove this to disable the menu add(iconButton); add(maxButton); add(closeButton); } }
score: 1
tagged with: java
tagged with: swing
type: Question
tagged with: eclipse

http://stackoverflow.com/comment/42441014
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26870809
has text: "Questions without a clear problem statement are not useful to other readers" - I'm voting to keep closed because of that. What's *wrong* with the code? What's not working? Why would you *think it needs* to be improved upon?

http://stackoverflow.com/q/26921631
has body: I'm a little bit confused as to understanding how recursion works. Basically I have to replace recursive methods with non recursive methods. For example, this is the recursive method: public Key min() { if (isEmpty()) { return null; } return min(root).key; } private Node min(Node x) { if (x.left == null) { return x; } else { return min(x.left); } } public Key max() { if (isEmpty()) { return null; } return max(root).key; } private Node max(Node x) { if (x.right == null) { return x; } else { return max(x.right); } } public Key floor(Key key) { Node x = floor(root, key); if (x == null) { return null; } else { return x.key; } } private Node floor(Node x, Key key) { if (x == null) { return null; } int cmp = key.compareTo(x.key); if (cmp == 0) { return x; } if (cmp &lt; 0) { return floor(x.left, key); } Node t = floor(x.right, key); if (t != null) { return t; } else { return x; } } public Key ceiling(Key key) { Node x = ceiling(root, key); if (x == null) { return null; } else { return x.key; } } private Node ceiling(Node x, Key key) { if (x == null) { return null; } int cmp = key.compareTo(x.key); if (cmp == 0) { return x; } if (cmp &lt; 0) { Node t = ceiling(x.left, key); if (t != null) { return t; } else { return x; } } return ceiling(x.right, key); } And this is my attempt of doing it non-recursively: public Key min() { if (isEmpty()) { return null; } return min(root).key; } private Node min(Node x) { while (x.left !=null){ x = x.left; } return x; } public Key max() { if (isEmpty()) { return null; } return max(root).key; } private Node max(Node x) { while (x.right!=null){ x = x.right; } return x; } public Key floor(Key key) { Node x = floor(root, key); if (x == null) { return null; } else { return x.key; } } private Node floor(Node x, Key key) { if (x == null) { return null; } int cmp = key.compareTo(x.key); if (cmp == 0) { return x; } if (cmp &lt; 0) { while (x.left != null){ x = x.left; if (x ==null){ return null; } } } Node t = x.right; while (x.right != null){ x = …
score: 0
has comment: http://stackoverflow.com/comment/42391149
answer count: 1
has comment: http://stackoverflow.com/comment/42391216
favorite count: 0
has title: writing a recursive method into a non recursive (java)
has comment: http://stackoverflow.com/comment/42391153
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42391151
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26921703
type: Question
tagged with: recursion
tagged with: java
linked to: http://stackoverflow.com/q/159590
has comment: http://stackoverflow.com/comment/42391239
has comment: http://stackoverflow.com/comment/42391240

http://stackoverflow.com/comment/42519436
score: 0
type: Comment
has text: You could have a counter in your `ThreadPool` called `idleWorkers`. On each `Worker.run()` you would decrement it if `workerQueue.poll()` contained a `Runnable` and increment it back up when `run()`finishes. You would then check it in `shutdown()`: `while(isRunning && (idleWorkers < poolSize)) {..}`
type: AnswerComment
comment on: http://stackoverflow.com/a/26989559

http://stackoverflow.com/comment/42291853
comment on: http://stackoverflow.com/q/26866152
score: 0
type: Comment
type: QuestionComment
has text: @MuhammadHijazi , Oops! You're right.

http://stackoverflow.com/q/26963528
has answer: http://stackoverflow.com/a/26963607
has comment: http://stackoverflow.com/comment/42520177
score: 0
has comment: http://stackoverflow.com/comment/42490102
answer count: 2
has comment: http://stackoverflow.com/comment/42465394
has comment: http://stackoverflow.com/comment/42519682
has comment: http://stackoverflow.com/comment/42484733
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42489066
tagged with: android-studio
has comment: http://stackoverflow.com/comment/42465273
has title: How can I ping a range of IP addresses simultaneously in an Android App
has body: Hello and thanks for looking. I would like to be able to ping several IP addresses simultaneously from an android app. I've written the code below and want to be able to call my "Ping Something" method multiple times on different threads. If I do this as is at the moment the results all interfere with each other and basically the thread that runs last overwrites all the others. What is the best way to achieve the objective. I.e. being able to ping multiple IP addresses from an android app without having to wait for the previous result to finish. Many thanks for any help in advance. Nat This would be called from a timer or by pressing a button....... new Thread(new Runnable() { public void run() { PingSomething("www.bbc.co.uk"); } }).start(); new Thread(new Runnable() { public void run() { PingSomething("someotherip"); } }).start(); new Thread(new Runnable() { public void run() { PingSomething("anotherip"); } }).start(); This is the method that I've written simplified somewhat... public void PingSomething (String ahost) { String pingResult; Boolean noresponse, response; String inputLine; InetAddress theaddress; try { theaddress = InetAddress.getByName(ahost); ahost = theaddress.getHostAddress(); } catch (UnknownHostException e) { ahost = "noip"; } String pingCmd = "ping -c 1 -t 5000 -w 1 -W 1 " + ahost; try { Runtime r = Runtime.getRuntime(); Process p = r.exec(pingCmd); BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream())); inputLine = ""; pingResult = ""; while ((inputLine = in.readLine()) != null) { pingResult = pingResult + (inputLine + "\n"); } // Do something with pingResult final String temppingresults = pingResult; runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), temppingresults, Toast.LENGTH_SHORT).show(); } }); }
has answer: http://stackoverflow.com/a/26963738
tagged with: java
has comment: http://stackoverflow.com/comment/42465125
has comment: http://stackoverflow.com/comment/42465250
has comment: http://stackoverflow.com/comment/42501413
type: Question
has comment: http://stackoverflow.com/comment/42491219
has comment: http://stackoverflow.com/comment/42475769
has comment: http://stackoverflow.com/comment/42465244

http://stackoverflow.com/comment/42344531
type: QuestionComment
type: Comment
has text: I added the error above
comment on: http://stackoverflow.com/q/26880491
score: 0

logcat
tags question: http://stackoverflow.com/q/26959446
tags question: http://stackoverflow.com/q/26891707
type: Tag
tags question: http://stackoverflow.com/q/26960493
tag name: logcat
tags question: http://stackoverflow.com/q/26833110

http://stackoverflow.com/comment/42255636
has text: I'm not running it from the command line but I found it now, THX nevertheless :D
type: QuestionComment
comment on: http://stackoverflow.com/q/26846152
type: Comment
score: 0

http://stackoverflow.com/a/57399998
answers question: http://stackoverflow.com/q/26864662
has body: For New version of Java JavaPath folder is located 64 bit OS "C:\Program Files \Common Files\Oracle\Java\javapath\" X86 "C:\Program Files(x86) \Common Files\Oracle\Java\javapath\"
score: 0
type: Answer

http://stackoverflow.com/a/26871324
answers question: http://stackoverflow.com/q/26870988
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42303824
has body: You are getting the MethodNotFoundException, because you wrote crear instead of Create. But the right way to do it, would be to call a save() method without arguments, which is responsible to assemble your object you want to persist. Since you are already binding your input fields to bean properties, all you would need to do is, use a method like this: public String save(){ Ciclista c = new Ciclista(); c.setNombre(this.nombre); c.setNacionalidad(this.nacionalidad); c.setEquipo(this.equipo); create(c); return "Administrador?faces-redirect=true"; } your commandbutton now should target the save() method of your bean. The input values in the form will be inserted into your baking bean properties and the save() method would assemble the instance and finally calls your persist-method. &lt;h:commandButton class="btn" action="#{ciclistaBeanDB.save}" value="Create" /&gt; Usually you should not call the DatabaseBean directly, but kind of a Controller - or how ever one would like to call it. This Bean then should utilize your database-service which should only be responsible for CRUD-Functionality. At least for big applications it would be a mess having the databasemethods and other (view-related) methods mixed in one class.
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26870988
type: AcceptedAnswer

http://stackoverflow.com/comment/42387444
type: Comment
comment on: http://stackoverflow.com/q/26919270
type: QuestionComment
score: 0
has text: file /usr/java/jdk1.8.0_40 is not owned by any package!

http://stackoverflow.com/a/26834581
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26834431
answers question: http://stackoverflow.com/q/26834431
score: 1
type: AcceptedAnswer
downvote count: 0
has body: So, it looks like your rootView is null; Are you sure you are calling setImage() on the instance of your fragment that has had onCreateView called? You could test this by adding a println to both methods and checking the console/LogCat for their order. You could post the code where you call setImage(). If it is indeed that, which is the problem, there are several solutions, some better than others. For starters, you could try passing either the rootView or the imageView1 to the activity where you call setImage() and move setImage() to that activity. Not best practice, but try it and see if it works. (Would have commented, but I don't have enough reputation. Comment back and I'll try to edit the answer according to your comments.)

http://stackoverflow.com/q/26913374
score: 6
tagged with: jdbc
upvote count: 6
type: AnsweredQuestion
tagged with: java
type: Question
has title: oracle.jdbc.ReadTimeout vs. Connection.getNetworkTimeout vs. Statement.setQueryTimeout
has body: Connection.getNetworkTimeout() is number of milliseconds the driver will wait for a database request to complete. Statement.setQueryTimeout() is independent of the timeout value specified in Connection.getNetworkTimeout() and represent the value of specific query timeout. My question is: What is the correlection between those methods and oracle.jdbc.ReadTimeout which can set in connection properties.
has answer: http://stackoverflow.com/a/31537141
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/77323658
favorite count: 0
has answer: http://stackoverflow.com/a/77323658
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/31537141

http://stackoverflow.com/comment/42349245
comment on: http://stackoverflow.com/a/26892266
type: AnswerComment
score: 0
type: Comment
has text: Student ID is correct (System.out.println(student) before merge). It occurs when I fetch the collection with the query I posted, when I fetch only the student it works fine

http://stackoverflow.com/comment/42370168
type: Comment
comment on: http://stackoverflow.com/a/26910282
score: 0
type: AnswerComment
has text: @SagarByali Integer also overrides hashCode and equals.

http://stackoverflow.com/comment/42235688
comment on: http://stackoverflow.com/q/26834785
score: 0
type: Comment
type: QuestionComment
has text: Hmm i am lost oh great expert!! :( i have no clue how to bring my compound and loan out of the zeros! my arguments are passing so i have no clue! My calculations are right too!!

http://stackoverflow.com/comment/42262184
has text: Your code does not even compile; make the prior effort to _at least_ make it compile. By undergoing this effort and reading the appropriate documentation, you'll learn a lot along the way.
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26849787

http://stackoverflow.com/comment/42477267
type: Comment
comment on: http://stackoverflow.com/q/26970601
has text: `setPreferredWidth(360);` given that is wider than the **image** (292px) of the table, how do you expect Swing to honor (use) that width?
score: 0
type: QuestionComment

http://stackoverflow.com/q/26889542
has answer: http://stackoverflow.com/a/26889674
has comment: http://stackoverflow.com/comment/42333274
type: Question
has title: Java Assertion in getter method
score: -2
answer count: 1
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42333312
has comment: http://stackoverflow.com/comment/42333193
has comment: http://stackoverflow.com/comment/42333491
type: UnansweredQuestion
upvote count: 0
tagged with: assertions
has comment: http://stackoverflow.com/comment/42333544
has body: Lets say we have this code: Owner owner; public Owner getOwner(int id) { if (owner == null) owner = Owners.getOwner(id); assert owner != null; return owner; } What will happen if the Owners.getOwner(id) returns null? will the method die or it will still return null if an assertion is added before the return? if getOwner(id) is asserted to null will still throw an NPE if getOwner(id).doSomething(); is called?
favorite count: 0

http://stackoverflow.com/q/26985707
tagged with: binary-search-tree
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42504793
type: Question
downvote count: 0
has title: method to check if a binary search tree is balanced
has comment: http://stackoverflow.com/comment/42505087
favorite count: 0
has body: I am trying to implement a method that checks whether a given binary search tree is balanced or not within a given tolerance. This is the code that I have so far. I have no ideas further than this. Whoever answers this question, could you please provide an explanation as well? That would be very helpful thank you. A balanced tree is balanced if for each node in the tree the depth of each nodes children differs by at most some tolerance. given a link BinaryTreeNode and a tolerance, it returns true if root is balanced and false otherwise. tolerance is the maximum tolerance to decide if the tree is balanced it returns true if the tree is balanced and false if it is not. I want it to throw a nullpointerexception if root is == null and an illegalargumentexception if tolerance is &lt; 0 The problem with my code is that the line if(computeHeight(root) == -1){ the type computeHeight is not applicable for the arguments I have a getDepth() method that returns the level that the node is located on public &lt;T&gt; boolean isBalanced(BinaryTreeNode&lt;T&gt; root, int tolerance) { // TODO Auto-generated method stub if(root == null){ throw new NullPointerException(); } if(tolerance &lt; 0){ throw new IllegalArgumentException(); } if(computeHeight(root) == -1){ return false; } else{ return true; } } public int computeHeight(BinaryTreeNode&lt;T&gt; root){ if(root == null){ return 0; } int leftHeight = computeHeight(root.getLeftChild()); if(leftHeight == -1){ return -1; } int rightHeight = computeHeight(root.getRightChild()); if(rightHeight == -1){ return -1; } int heightDifference = Math.abs(leftHeight - rightHeight); if(heightDifference &gt; 1){ return -1; } else{ return Math.max(leftHeight, rightHeight) + 1; } }

http://stackoverflow.com/a/26872275
type: Answer
has body: Edit: After your edits and comments it is clear that I misunderstood the question. If you just want to check to see if there are no matching adjacent numbers, then you can use a simple loop. This will be O(n) complexity. public static void main(String[] args) { String str = "442213"; System.out.println(permutation(str)); } public static int permutation(String str) { int permutationCount = 0; if (str.length() &gt; 1) { for (int i = 0; i &lt; str.length() - 1; i++) { if (str.charAt(i) != str.charAt(i + 1)) { permutationCount++; } } } return permutationCount; } If you wanted to stick with recursion, you could do something like this: public static void main(String[] args) { String str = "442213"; System.out.println(permutation(str, 0)); } public static int permutation(String str, int currentIndex) { int permutationCount = 0; if (str == null || currentIndex + 1 &gt;= str.length()) { return permutationCount; } if (str.charAt(currentIndex) != str.charAt(currentIndex + 1)) { permutationCount = 1; } return permutationCount + permutation(str, currentIndex + 1); }
answers question: http://stackoverflow.com/q/26872008
score: 0

http://stackoverflow.com/comment/102456751
has text: A general hint (for people like me): Check if you don't need to install LOMBOK.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26935494
type: Comment

http://stackoverflow.com/q/26957663
tagged with: treeset
tagged with: set
downvote count: 1
has title: TreeSets to match lotto numbers?
type: Question
tagged with: tree
tagged with: java
accepted answer: http://stackoverflow.com/a/26957734
score: -1
has body: I'm pretty new to data structures, so I am not 100% sure I am going about this problem the right way. I am trying to compare two nested sets against each other, and store the matching numbers in the set titled 'Intersection'. However, the code below throws a ClassCastException. public class Details { public static void main(String[] args) { Set&lt;Integer&gt; myNums = new TreeSet&lt;Integer&gt;(); myNums.add(1); myNums.add(2); myNums.add(3); myNums.add(4); myNums.add(5); myNums.add(6); Set&lt;Integer&gt; myNums2 = new TreeSet&lt;Integer&gt;(); myNums2.add(7); myNums2.add(8); myNums2.add(3); myNums2.add(10); myNums2.add(11); myNums2.add(12); Set&lt;Set&lt;Integer&gt;&gt; myTicket = new TreeSet&lt;Set&lt;Integer&gt;&gt;(); myTicket.add(myNums); myTicket.add(myNums2); Set&lt;Integer&gt; lottoNums = new TreeSet&lt;Integer&gt;(); lottoNums.add(1); lottoNums.add(2); lottoNums.add(3); lottoNums.add(4); lottoNums.add(5); lottoNums.add(6); Set&lt;Set&lt;Integer&gt;&gt; lottoNums1 = new TreeSet&lt;Set&lt;Integer&gt;&gt;(); lottoNums1.add(lottoNums); // keep only the winning numbers from the user's ticket Set&lt;Set&lt;Integer&gt;&gt; intersection = new TreeSet&lt;Set&lt;Integer&gt;&gt;(myTicket); intersection.retainAll(lottoNums1); // print results System.out.println("Your ticket numbers are " + myTicket); System.out.println("The winning numbers are " + lottoNums1); System.out.println(); System.out.println("You had " + intersection.size() + " matching numbers."); if (intersection.size() &gt; 0) { double prize = 100 * Math.pow(2, intersection.size()); System.out.println("The matched numbers are " + intersection); System.out.println("Your prize is $" + prize); } } }
upvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26957734
tagged with: integer
type: AnsweredQuestion

http://stackoverflow.com/q/26900343
has comment: http://stackoverflow.com/comment/42353304
accepted answer: http://stackoverflow.com/a/26900902
downvote count: 4
has comment: http://stackoverflow.com/comment/42353505
answer count: 1
has body: I have a text file like this : testcaseZ : a, b, c testcaseX : b,d testcaseC : b I want to have a string array like : abcd testcaseZ 1 1 1 0 testcaseX 0 1 0 1 testcaseC 0 1 0 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42354293
linked to: http://stackoverflow.com/q/4716503
score: -4
has comment: http://stackoverflow.com/comment/42353793
type: AnsweredQuestion
tagged with: string-aggregation
has answer: http://stackoverflow.com/a/26900902
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42353489
has title: Java - Input string into array
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/42354254

http://stackoverflow.com/q/26930087
tagged with: sorting
has body: I would like to sort a list of strings with an array of integers as the new indexes: Integer[] newIndexes = {0,2,1}; List&lt;String&gt; fruits = new ArrayList&lt;&gt;(); fruits.add("Apple"); fruits.add("Pear"); fruits.add("Banana"); fruits.sort.... What would be the best way to do this?
accepted answer: http://stackoverflow.com/a/26930194
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42405490
type: Question
has title: Best way to sort list with index array
tagged with: java
possible better answer: http://stackoverflow.com/a/26930187
has answer: http://stackoverflow.com/a/26930194
has answer: http://stackoverflow.com/a/26930187
score: 0
answer count: 2
tagged with: arrays

http://stackoverflow.com/comment/42526198
type: QuestionComment
has text: The StereoRenderer is a class based on AbstractRenderer. It is part of the Commander3D tablet sdk. Find it in the sdk docu on the left side: [link] (http://www.sdeck.org/documentation/) @MohammedAli Now I have exchanged 3dmin with Rajawali but i still get there error, that the activity cannot be started. Thank you very much!
score: 0
comment on: http://stackoverflow.com/q/26974998
type: Comment

http://stackoverflow.com/a/26955409
type: Answer
score: 1
has body: Any other way is only to use native Javascript action to enter the value in the text box: WebDriver driver = new FirefoxDriver(); JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("document.getElementById("textbox_id").value='new value';");
upvote count: 1
has comment: http://stackoverflow.com/comment/42454501
answers question: http://stackoverflow.com/q/26955263
downvote count: 0
has comment: http://stackoverflow.com/comment/42453010
has comment: http://stackoverflow.com/comment/42454213

http://stackoverflow.com/a/26905226
has comment: http://stackoverflow.com/comment/42366503
has comment: http://stackoverflow.com/comment/42362053
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42364956
has comment: http://stackoverflow.com/comment/42362490
type: Answer
accepted answer of: http://stackoverflow.com/q/26904760
answers question: http://stackoverflow.com/q/26904760
has body: If your 3.x views are imported as Shared Elements in the Application.e4xmi, I don't think you'll have a problem with the solution you've posted. The legacy views should be considered as parts. You may also want to try converting some of the old views to e4, because the process is quite fast. Ultimately, have you tried the old way of opening views? @Execute public void execute(final EPartService partService) throws PartInitException { final IWorkbenchWindow activeww = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); IWorkbenchPage activePage = activeww.getActivePage(); activePage.showView("com.sample.application.part.other"); } or even a combination of 3.x/e4 @Execute public void execute(final ExecutionEvent event) throws PartInitException { final IWorkbenchWindow activeww = HandlerUtil.getActiveWorkbenchWindow(event); final IWorkbenchPage activePage = activeww.getActivePage(); activePage.showView("com.sample.application.part.other"); }
has comment: http://stackoverflow.com/comment/42365582
score: 1
upvote count: 1

http://stackoverflow.com/a/26971233
score: 0
has comment: http://stackoverflow.com/comment/42496408
has body: Update your test as below. @Test(expected = IllegalArgumentException.class) public void testRestUserJson() { ... } Note the additional parameter expected which specify the Exception which must be thrown while test execution. Additionally to assert the exception message, error code etc. create a custom exception matcher. Refer my answer for details and pseudo code.
type: Answer
answers question: http://stackoverflow.com/q/26964208

sql
tags question: http://stackoverflow.com/q/26850028
tags question: http://stackoverflow.com/q/26967963
tags question: http://stackoverflow.com/q/26838215
tags question: http://stackoverflow.com/q/26865654
tags question: http://stackoverflow.com/q/26943430
tags question: http://stackoverflow.com/q/26918434
tags question: http://stackoverflow.com/q/26873107
tags question: http://stackoverflow.com/q/26886642
tags question: http://stackoverflow.com/q/26862778
tags question: http://stackoverflow.com/q/26929837
tags question: http://stackoverflow.com/q/26837586
tags question: http://stackoverflow.com/q/26864420
tags question: http://stackoverflow.com/q/26837855
tags question: http://stackoverflow.com/q/26886387
tags question: http://stackoverflow.com/q/26961410
tag name: sql
tags question: http://stackoverflow.com/q/26954994
type: Tag
tags question: http://stackoverflow.com/q/26840090
tags question: http://stackoverflow.com/q/26873970
tags question: http://stackoverflow.com/q/26929199
tags question: http://stackoverflow.com/q/26876594
tags question: http://stackoverflow.com/q/26912255
tags question: http://stackoverflow.com/q/26838219
tags question: http://stackoverflow.com/q/26835610
tags question: http://stackoverflow.com/q/26953789
tags question: http://stackoverflow.com/q/26835934
tags question: http://stackoverflow.com/q/26931787
tags question: http://stackoverflow.com/q/26915321
tags question: http://stackoverflow.com/q/26843776
tags question: http://stackoverflow.com/q/26884486
tags question: http://stackoverflow.com/q/26835548
tags question: http://stackoverflow.com/q/26937732
tags question: http://stackoverflow.com/q/26980437
tags question: http://stackoverflow.com/q/26939050
tags question: http://stackoverflow.com/q/26976448
tags question: http://stackoverflow.com/q/26879252
tags question: http://stackoverflow.com/q/26988677
tags question: http://stackoverflow.com/q/26979369
tags question: http://stackoverflow.com/q/26974366
tags question: http://stackoverflow.com/q/26883457
tags question: http://stackoverflow.com/q/26855003
tags question: http://stackoverflow.com/q/26969228

http://stackoverflow.com/a/27309057
type: Answer
score: 2
has body: You need to Subscribe the message after you completed your old process. ActiveMQ will give away the message when you pick it from the queue.
downvote count: 0
answers question: http://stackoverflow.com/q/26973196
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26973196
type: AcceptedAnswer

http://stackoverflow.com/comment/42400438
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26924768
has text: From the following link, https://www.drupal.org/project/securesite I have given the server address as, admin:admin@localhost and port number as, 9090. Now I am getting error Non HTTP response code: java.net.URISyntaxException
score: 0

http://stackoverflow.com/a/26874304
answers question: http://stackoverflow.com/q/26874218
has body: You are in the inner class AsyncCaller so this refers to that class. You can use e.g. YourActivityClass.this if the outer class is named YourActivityClass to reference the outer class
accepted answer of: http://stackoverflow.com/q/26874218
score: 3
has comment: http://stackoverflow.com/comment/42306460
has comment: http://stackoverflow.com/comment/42306497
type: AcceptedAnswer
upvote count: 3
type: Answer
downvote count: 0

http://stackoverflow.com/q/26928556
tagged with: arraylist
has title: if object collides with the same object
has comment: http://stackoverflow.com/comment/42403315
tagged with: collision
has body: i cant figure out how to make a collision with the same object from the same ArrayList, BUT not itself in lbgdx. Is it even possible? And how do I do that? How I create objects: private static List&lt;Tree&gt; objects = new ArrayList&lt;Tree&gt;(); for (int i = 0; i&lt;400 ; i++ ) { objects.add(new Tree()); } They spawn randomly around the "player" and sometimes they're on top each other. Tree class: public class Tree { public TextureRegion sprite; public Vector2 position; private int x, y, varx, vary; public int size; private Random r; public boolean injunglex, injungley = false; public int myLevel; public Rectangle objrect, objrectUP; public Rectangle playerrect; public boolean active = false; private int random, tolis=700; public Tree() { GameRender.medis++; size = GameRender.tilesize*5; position = new Vector2(x, y); r = new Random(); random = r.nextInt(2); int zenkas = r.nextInt(2); if(AssetLoader.load){ position.y = AssetLoader.getInt("treey"+GameRender.medis); position.x = AssetLoader.getInt("treex"+GameRender.medis); }else{ position.y = getPositionY(); position.x = getPosition(); while(position.y&gt;GameRender.playery-100&amp;&amp;position.y&lt;GameRender.playery+100 &amp;&amp;position.x&gt;GameRender.playerx-100&amp;&amp;position.x&lt;GameRender.playerx+100){ position.y = getPositionY2(); position.x = getPosition2(); } } } public int getPosition() { int x; int zenkasx = r.nextInt(2); int renkam = r.nextInt(2); int renkam2; if(renkam==1){renkam=r.nextInt(50); renkam2=0;} else {renkam=0; renkam2=r.nextInt(50);} if(zenkasx==0){ x = GameRender.playerx+renkam+(r.nextInt(tolis)); }else x = GameRender.playerx-renkam2-(r.nextInt(tolis)); return x; } public int getPosition2() { int x; int zenkasx = r.nextInt(2); int renkam = r.nextInt(2); int renkam2; if(renkam==1){renkam=0; renkam2=+r.nextInt(100);} else {renkam=r.nextInt(100); renkam2=0;} if(zenkasx==0){ x = GameRender.playerx+renkam+(r.nextInt(tolis)); }else x = GameRender.playerx-renkam2-(r.nextInt(tolis)); retur…
has comment: http://stackoverflow.com/comment/42403008
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26930094
type: Question
tagged with: libgdx
tagged with: java
has comment: http://stackoverflow.com/comment/42402926
has comment: http://stackoverflow.com/comment/42403073
answer count: 1

scala
tags question: http://stackoverflow.com/q/26923375
tags question: http://stackoverflow.com/q/26869431
tags question: http://stackoverflow.com/q/26983207
tags question: http://stackoverflow.com/q/26935821
tags question: http://stackoverflow.com/q/26896510
tags question: http://stackoverflow.com/q/26889937
tags question: http://stackoverflow.com/q/26848502
tags question: http://stackoverflow.com/q/26908199
tags question: http://stackoverflow.com/q/26957154
tags question: http://stackoverflow.com/q/26922316
tags question: http://stackoverflow.com/q/26965987
tags question: http://stackoverflow.com/q/26984754
tags question: http://stackoverflow.com/q/26905961
tags question: http://stackoverflow.com/q/26869320
tags question: http://stackoverflow.com/q/26898948
tag name: scala
tags question: http://stackoverflow.com/q/26916081
tags question: http://stackoverflow.com/q/26847199
tags question: http://stackoverflow.com/q/26832697
tags question: http://stackoverflow.com/q/26948026
tags question: http://stackoverflow.com/q/26967252
tags question: http://stackoverflow.com/q/26968737
type: Tag
tags question: http://stackoverflow.com/q/26938642
tags question: http://stackoverflow.com/q/26967047

http://stackoverflow.com/a/26931525
has comment: http://stackoverflow.com/comment/42435822
has body: I wish you'd posted your xml for your spring configuration so I could see if there were any more issues but at the very least you'll need to define all your jndi names in tomcat - in server.xml as a &lt;resource /&gt; in &lt;globalnames /&gt; and context.xml as &lt;resourcelink /&gt; in the &lt;context /&gt; tag. Server.xml will look something like this (you will need to select proper setting for the type of db your using): &lt;GlobalNamingResources&gt; &lt;Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" initialSize="5" maxActive="120" maxIdle="5" maxWait="5000" name="jdbc/web" username="user" password="password" poolPreparedStatements="true" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/dbname" validationQuery="select 1"/&gt; &lt;/GlobalNamingResources&gt; Although don't delete resources already defined. And this in context.xml: &lt;context&gt; &lt;ResourceLink global="jdbc/web" name="jdbc/web" type="javax.sql.DataSource"/&gt; &lt;/context&gt; I don't want to get dunned for including a link but if you search "tomcat jndi datasource how to" I think you'll find at least one thorough example of what's needed. You'll also need to include the jar containing your driver (com.mysql.jdbc.Driver in this example) in tomcat/lib.
has comment: http://stackoverflow.com/comment/42567835
has comment: http://stackoverflow.com/comment/42508482
has comment: http://stackoverflow.com/comment/42624217
type: Answer
accepted answer of: http://stackoverflow.com/q/26903186
has comment: http://stackoverflow.com/comment/42548903
has comment: http://stackoverflow.com/comment/42488294
has comment: http://stackoverflow.com/comment/42522226
has comment: http://stackoverflow.com/comment/42469429
upvote count: 1
has comment: http://stackoverflow.com/comment/42471230
has comment: http://stackoverflow.com/comment/42626170
has comment: http://stackoverflow.com/comment/42702104
score: 1
has comment: http://stackoverflow.com/comment/42654721
has comment: http://stackoverflow.com/comment/42568012
has comment: http://stackoverflow.com/comment/42588924
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26903186

http://stackoverflow.com/q/26836706
has body: Right now I have a save button that I want to show only if all the views inside a viewpager are shown. That means that when the user swipes between views and have seen all views inside a viewpager, then show a save button. I want to show the save button on every view when they have seen all views hereby after. The trouble I am having is how to set up the logic. I started out with setting the save button invisible until the last view of the viewpager. On the last view of the viewpager, show the save button. But the problem is when the user goes to the last view (there's a save button) and then goes back to a previous view, the save button is gone. So, I was wondering how can I show the save button permanently on all views after the user has seen all views? Here's what I have so far: I have this snippet inside my InstantiateItem() : if(isViewed) { save_button.setVisibility(Button.VISIBLE); System.out.println("Is this called? isViewed = true"); }else if (position == numberOfPages.size()-1) { isViewed = true; save_button.setVisibility(Button.VISIBLE); } where @Override public void onPageSelected(int position) { isViewed = true; } EDIT: I tried the following solutions but with no luck. Button save_button = (Button) findViewById(R.id.save); if(isViewed[position]) { save_button.setVisibility(Button.VISIBLE); } if (position == numberOfPages.length-1 &amp;&amp; !isViewed[position]) { isViewed[position] = true; save_button.setVisibility(Button.VISIBLE); } isViewed[position] =true; And isViewed[position] = true; if (isViewed[position] == isViewed[numberOfPages.length-1]) { save_button.setVisibility(Button.VISIBLE); } if (isViewed[position]) { save_button.setVisibility(Button.VISIBLE); } else { save_button.setVisibility(Button.INVISIBLE); }
score: 0
answer count: 2
has title: How can I show a button when all views are viewed in viewpager?
possible better answer: http://stackoverflow.com/a/26836923
has answer: http://stackoverflow.com/a/26836923
tagged with: android
has comment: http://stackoverflow.com/comment/42239374
has comment: http://stackoverflow.com/comment/42239278
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26900653
type: Question
accepted answer: http://stackoverflow.com/a/26900653
tagged with: android-viewpager
has comment: http://stackoverflow.com/comment/42239412

http://stackoverflow.com/comment/42297218
comment on: http://stackoverflow.com/a/26866777
type: AnswerComment
score: 0
type: Comment
has text: You should at least use build 18. http://upstream.rosalinux.ru/java/compat_reports/jdk/1.6.0.17_to_1.6.0.18/src_compat_report.html

http://stackoverflow.com/q/26890822
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/26891175
score: 0
answer count: 1
has body: There were a lot of questions similar to this but none of them hasn't explained this situation: I've created app from Android Studio's templates. App is with Navigation Drawer but, not like everybody else, it uses fragments to cast it. I want to add ImaveView above ListView but I get following error: java.lang.ClassCastException: android.widget.LinearLayout$LayoutParams cannot be cast to android.support.v4.widget.DrawerLayout$LayoutParams activity_main.xml &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"&gt; &lt;FrameLayout android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" /&gt; &lt;LinearLayout android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:orientation="vertical" android:layout_gravity="start"&gt; &lt;ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="3" android:src="@drawable/image"&gt; &lt;/ImageView&gt; &lt;fragment android:id="@+id/navigation_drawer" android:layout_weight="1" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:name="tuksiarz.app.NavigationDrawerFragment" tools:layout="@layout/fragment_navigation_drawer" /&gt; &lt;/LinearLayout&gt; &lt;/android.support.v4.widget.DrawerLayout&gt; fragment_navigation_drawer.xml &lt;ListView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/navigation_drawer_listview" android:layout_width="match_parent" android:layout_height="match_parent" android:choiceMode="singleChoice" android:divider="@android:color/transparent" android:dividerHeight="0dp" android:background="#f7f9f6" tools:context=".NavigationDrawerFragmen…
has answer: http://stackoverflow.com/a/26891175
has title: Image above Navigation Drawer (using fragments)
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42335764
has comment: http://stackoverflow.com/comment/42336075
tagged with: navigation-drawer
type: Question
has comment: http://stackoverflow.com/comment/42335615

http://stackoverflow.com/q/26897496
linked to: http://stackoverflow.com/q/13687799
has answer: http://stackoverflow.com/a/26901201
has comment: http://stackoverflow.com/comment/42360228
type: AnsweredQuestion
has body: I have an xml file with similar tags -> IP 10.1.1.1 Name MyName Environment Production I want to update the default value of the definition with name : Environment. Is it possible to do that using SAX parser? Can you please point me to proper documentation? So far I have parsed the document but when I update defaultValue, it updates all defaultValues. I dont know how to parse the exact default value tag.
score: 1
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26901201
tagged with: saxparser
answer count: 1
has title: Parsing and updating xml using SAX parser in java
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26853456
answers question: http://stackoverflow.com/q/26853023
downvote count: 0
has body: If you already have JavaMail for pulling javax.mail.MimeMessages off some datastore, you can simply call it's getInputSream() method to access the raw content and ignore the fact that getContent() will conveniently provide a MimeMultiPart object. If you don't have JavaMail, you probably want to be more specific on your input. Email is all text, so wherever you get it from doesn't matter much as long as you can get an InputStream or a Reader for that source.
score: 1
has comment: http://stackoverflow.com/comment/42272949
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42259019
comment on: http://stackoverflow.com/a/26848074
score: 0
type: Comment
has text: @Joeblade No I did not. I have monthlyInterest being added to itself. I did not want to introduce the += notation just for fear of confusing Jengo, who I assume is a new programmer.
type: AnswerComment

http://stackoverflow.com/a/26909775
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42369508
answers question: http://stackoverflow.com/q/26909458
upvote count: 2
type: Answer
has body: Smutje gave you the answer how to do this in Java 5 to 7. With Java8 you can make use of the functional interfaces and lambda expressions. So your sorting method would reduce to Arrays.sort(objectArray, Comparator.&lt;YourObject&gt;comparing(YourObject::getDate) .thenComparing(YourObject::getString));

http://stackoverflow.com/a/27093575
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/26888625
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26888625
has body: The connection to the database is done using the configured database inside the RDS instance. You can connect to the "default" database and then configure an explicit defaultCatalog for MySQL. The following example (based on your should do the trick &lt;jdbc:dataSource id="dataSource" db-instance-identifier="myRdsInstance" username="${rdsUsername}" password="${rdsPassword}"&gt; &lt;jdbc:pool-attributes initialSize="1" defaultCatalog="MyDb" testOnBorrow="true" validationQuery="SELECT 1" /&gt; &lt;/jdbc:dataSource&gt; We will provide additional support to explicitly configure the DB in RC1 or maybe RC2.
has comment: http://stackoverflow.com/comment/52166752
type: Answer

http://stackoverflow.com/comment/42476748
comment on: http://stackoverflow.com/q/26969640
score: 0
has text: `arg0` ? What is that?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/47891984
score: 0
type: AnswerComment
has text: Thanks @donfuxx, that's exactly what I did. So lucky guess on my part. It still doesn't work. I'll figure it out eventually. It may even be documented somewhere, but it hasn't jumped out so far. I think the worst part about working with libgdx is that there are almost two major versions. An old version, which is documented all over the place, and a new version, which has different syntax and is not in any tutorial. Basically, I'm doing this the hard way. There's no way I'd get their book, since it is probably outdated.
type: Comment
comment on: http://stackoverflow.com/a/26981032

awt
tags question: http://stackoverflow.com/q/26912360
tags question: http://stackoverflow.com/q/26838424
tags question: http://stackoverflow.com/q/26877474
tags question: http://stackoverflow.com/q/26923282
tags question: http://stackoverflow.com/q/26959864
tags question: http://stackoverflow.com/q/26923873
tag name: awt
tags question: http://stackoverflow.com/q/26979949
tags question: http://stackoverflow.com/q/26894844
tags question: http://stackoverflow.com/q/26947311
tags question: http://stackoverflow.com/q/26988007
tags question: http://stackoverflow.com/q/26873637
tags question: http://stackoverflow.com/q/26957233
type: Tag
tags question: http://stackoverflow.com/q/26955310
tags question: http://stackoverflow.com/q/26897368

http://stackoverflow.com/comment/42294154
has text: @Jens, I've completed the stacktrace (I've changed names and skipped useless parts).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26866759

http://stackoverflow.com/comment/42349392
type: QuestionComment
has text: possible duplicate of [How to define custom exception class in Java, the easiest way?](http://stackoverflow.com/questions/3776327/how-to-define-custom-exception-class-in-java-the-easiest-way)
comment on: http://stackoverflow.com/q/26898171
score: 0
type: Comment

http://stackoverflow.com/comment/42480210
score: 0
has text: See this question: http://stackoverflow.com/questions/20746444/regarding-access-specifiers
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26972363

http://stackoverflow.com/comment/42415153
comment on: http://stackoverflow.com/q/26934147
has text: I tried to start the animation in the AnimationListener End method which resulted in the UI being super buggy and animations not playing at all.
type: QuestionComment
score: 0
type: Comment

sequence-diagram
tags question: http://stackoverflow.com/q/26942372
type: Tag
tag name: sequence-diagram

http://stackoverflow.com/q/26864295
accepted answer: http://stackoverflow.com/a/26864484
has answer: http://stackoverflow.com/a/26864473
tagged with: generics
has body: I'm trying to understand generics, but I block at wildcard bounds and casts. For instance: List&lt;? extends Number&gt; l = new ArrayList&lt;&gt;(); List&lt;PositiveInteger&gt; p = new ArrayList&lt;PositiveInteger&gt;(); p.add(new PositiveInteger(10)); l = p; NegativeInteger ni = (NegativeInteger) l.get(0);// runtime java.lang.ClassCastException: System.out.println(ni); NegativeNumber and PositiveNumber both extend Number. So the question is why there is no warning at compile-time when casting the element from the list into a NegativeNumber ? Is there a way to prevent this type of exception ?
downvote count: 1
type: AnsweredQuestion
score: 3
has title: Java generics unchecked casts - wildcard bounds
tagged with: java
has answer: http://stackoverflow.com/a/26864484
tagged with: warnings
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/26864426
favorite count: 0
linked to: http://stackoverflow.com/q/7526817
has answer: http://stackoverflow.com/a/26864426
answer count: 3

http://stackoverflow.com/a/26988469
answers question: http://stackoverflow.com/q/26987268
score: 0
has comment: http://stackoverflow.com/comment/42515179
type: Answer
has comment: http://stackoverflow.com/comment/42514715
has body: Try following: Change following files: APPLICATION-CONTEXT.xml : &lt;context:component-scan base-package="com.veke.rest" /&gt; &lt;bean name="Impl1" id="calculatorImpl" class="com.veke.calcImpl.CalculatorImpl" autowire="byType"/&gt; &lt;bean name="Impl2" id="calculatorImpl2" class="com.veke.calcImpl.CalculatorImpl2" autowire="byType"/&gt; &lt;/beans&gt; Rest Class : @Component @Path("/calc") public class CalculationService { @Autowired @Qualifier("Impl1"); //&lt;-- qualifier used here. Calculator calculator; @Autowired @Qualifier("Impl2"); //&lt;-- qualifier used here. Calculator calculator2; @GET @Path("/add/{a}/{b}/") @Produces("text/plain") public Response serveAdd(@PathParam("a") int a, @PathParam("b") int b) { int result= calculator.add(a, b); return Response.status(200).entity(String.valueOf(result)).build(); } @GET @Path("/sub/{a}/{b}") public Response serveSub(@PathParam("a") int a, @PathParam("b") int b) { int result= calculator2.add(a, b); return Response.status(200).entity(String.valueOf(result)).build(); } }

http://stackoverflow.com/a/34823996
has comment: http://stackoverflow.com/comment/58286958
upvote count: 103
type: Answer
has comment: http://stackoverflow.com/comment/105213019
downvote count: 0
has comment: http://stackoverflow.com/comment/111103583
has comment: http://stackoverflow.com/comment/58957160
score: 103
has comment: http://stackoverflow.com/comment/97685826
answers question: http://stackoverflow.com/q/26889970
has body: Add Spring annotation @Repository over the repository class. I know it should work without this annotation. But if you add this, IntelliJ will not show error. @Repository public interface YourRepository ... ... If you use Spring Data with extending Repository class it will be conflict packages. Then you must indicate packages directly. import org.springframework.data.repository.Repository; ... @org.springframework.stereotype.Repository public interface YourRepository extends Repository&lt;YourClass, Long&gt; { ... } And next you can autowired your repository without errors. @Autowired YourRepository yourRepository; It probably is not a good solution (I guess you are trying to register repository twice). But work for me and don't show errors. Maybe in the new version of IntelliJ can be fixed: https://youtrack.jetbrains.com/issue/IDEA-137023
has comment: http://stackoverflow.com/comment/116175043

http://stackoverflow.com/comment/42474900
has text: Check my answer @user100. I have added some code which I use.
score: 0
comment on: http://stackoverflow.com/q/26968205
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26923581
has body: By ping we can check the system status String command = "ping -c 3 " + IP; Process p = Runtime.getRuntime().exec(command);
answers question: http://stackoverflow.com/q/26923421
downvote count: 1
has comment: http://stackoverflow.com/comment/42394480
score: -1
upvote count: 0
type: Answer

http://stackoverflow.com/a/26894626
score: 0
has body: The Solution: I packed the content into a Wrapper Pojo and it works.
type: Answer
answers question: http://stackoverflow.com/q/26894241

http://stackoverflow.com/comment/42347757
has text: Remember that your solution works for this case because you are dealing with numbers. As David Conrad stated, the difference (encoding) is academic. Dealing with actual characters is a whole different story. Good luck on your classes!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26897250

http://stackoverflow.com/comment/93747918
comment on: http://stackoverflow.com/q/26948302
score: 0
type: Comment
type: QuestionComment
has text: Still got the same issue, even on android 8.0

http://stackoverflow.com/comment/82796544
type: AnswerComment
has text: I needed to draw the image to the entire rectangle, so basically filling it completely. Syntax slightly varies: `g2d.drawImage(img, 0, 0, copy.getWidth(), copy.getHeight(), null);`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26918760

spring-annotations
tags question: http://stackoverflow.com/q/26946434
tag name: spring-annotations
tags question: http://stackoverflow.com/q/26948261
type: Tag

http://stackoverflow.com/comment/42352552
comment on: http://stackoverflow.com/q/26899923
score: 4
has text: You can't. Handle the exception thrown instead.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26995796
has body: The problem is this bit here: org.apache.poi poi-ooxml 3.10.1 Support for OOXML signatures was only added in Apache POI 3.11 beta 3. 3.10.1 is too old, and doesn't contain the support Your pom dependency therefore needs to instead be: org.apache.poi poi-ooxml 3.11-beta3 (Or a newer one when new versions are released)
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26960729
answers question: http://stackoverflow.com/q/26960729
upvote count: 1

http://stackoverflow.com/q/26969313
has title: JTable row background color not changing for Double or Integer
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26969608
tagged with: java
score: 0
tagged with: swing
tagged with: tablecellrenderer
has comment: http://stackoverflow.com/comment/42475184
type: Question
has comment: http://stackoverflow.com/comment/42475276
has comment: http://stackoverflow.com/comment/42475463
tagged with: jtable
has comment: http://stackoverflow.com/comment/42475479
answer count: 1
has answer: http://stackoverflow.com/a/26969608
tagged with: string
has comment: http://stackoverflow.com/comment/42474951
has body: I am changing the background color of a row in JTable using following code. The color of row gets changed for all the cells which have String values however it does not gets changed for cells with Integer or Double values. private JTable getNewRenderedTable(final JTable table) { table.setDefaultRenderer(Object.class, new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); String status = (String)table.getModel().getValueAt(row, index); if (Constants.seller.equals(status)) { c.setBackground(Color.GRAY); //setForeground(Color.WHITE); } else { c.setBackground(table.getBackground()); c.setForeground(table.getForeground()); } return c; } }); return table; }

http://stackoverflow.com/a/27244752
accepted answer of: http://stackoverflow.com/q/26991414
answers question: http://stackoverflow.com/q/26991414
score: 0
has body: From this url, I got this infomation: Multidex support prior to Android 5.0 Versions of the platform prior to Android 5.0 use the Dalvik runtime for executing app code. By default, Dalvik limits apps to a single classes.dex bytecode file per APK. In order to get around this limitation, you can use the multidex support library, which becomes part of the primary DEX file of your app and then manages access to the additional DEX files and the code they contain. By default, Dalvik limits apps to a single classes.dex bytecode file per APK.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42423411
has text: Please provide the "printing" code
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26939417

http://stackoverflow.com/comment/42514285
has text: @SilentKiller your suggestion is appreciated ! I have added description in code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26991331

http://stackoverflow.com/a/26915512
has body: You must make sure you are calling removeClient in a thread-safe way. I'm guessing but it sounds like perhaps you're calling it from each EchoThread, which is not safe without synchronization, because (a) the threads can trample all over each other's modifications to the list; and (b) there is no guarantee threads will even see each other's modifications to the list. Usually you could just add the synchronized modifier on any methods that modify the ArrayList, which provides both mutual exclusion (preventing multiple threads from modifying it at once and corrupting it) and a happens-before relationship between calls to those methods (making sure threads see each other's changes to the list). However, that won't be enough here, because you are also using the method to modify Swing components. With few exceptions, Swing components must be accessed only from the single event dispatch thread, so if you want to update the frame and you are on a different thread, you must first switch to the event dispatch thread. In Java 8+, modify the beginning of your removeClient method as follows: public static void removeClient(int i) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(() -&gt; removeClient(i)); return; } // ... In old versions of Java: public static void removeClient(final int i) { if (!SwingUtilities.isEventDispatchThread()) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { removeClient(i); } }); return; } // ... Once you are on the correct thread, removing the item from the list and moving the other items down the list really is as simple as calling clients.remove(i);, as the other answerers have said. You don't need that extra for-loop and it won't work. Perhaps your problem is that although the list does move the items down, you have given those items their own index field, so after removing the item, its own index field no longer matches its actual position in the list? You could iterate the items in the list a…
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26897223
accepted answer of: http://stackoverflow.com/q/26897223
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42383522

http://stackoverflow.com/comment/42301968
type: QuestionComment
comment on: http://stackoverflow.com/q/26871358
has text: It's the error that shows up in your console as red; the one that you saw, which informed you that there was a NullPointerException.
score: 0
type: Comment

http://stackoverflow.com/q/26868926
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42297384
answer count: 0
has body: here is my code... I need all the contestants to be ranked according to their votes... as you can see there are seperate arrays for the names and vote count(tally)... I was told that bubble sort would work but i cant see how because bubble sort replaces the insides so if tally[2] is greater than tally[1], it will become the new tally[1] meanwhile the name stays the same as name[1] does not change with name[2]...I would prefer that you use basic codes as i am a total noob with programming and have only recently started...also, any recommendations about how i can write my code better/shorter is appreciated import java.util.*; public class FroshNight { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String dec = "0"; System.out.println("How many blocks?"); int contno = sc.nextInt(); int winner = 0; String winname = "a"; String[] code = new String[contno]; int total = 0; int counter = 0; String[] contname = new String[contno]; int[] tally = new int[contno]; while (counter&lt;contno) { System.out.print("Name of Pair:"); contname[counter]=sc.next(); counter++; } counter=0; while (counter&lt;contno) { System.out.println("Choose a vote code for "+ contname[counter]+"(must not be x)"); code[counter] = sc.next(); counter++; } boolean stop = false; counter=0; while(stop == false){ System.out.println("Input Vote (x to exit): "); dec = sc.next(); if(dec.equals("x")) { stop = true; } counter = 0; while(counter&lt;contno){ if(dec.equals(code[counter])){ tally[counter] +=1; counter = contno; } counter++; } } //&gt;&gt; aft. else counter = 0; while(counter&lt;contno){ total += tally[counter]; counter++; ; } counter=0; while(counter&lt;contno){ if(tally[counter]&gt;winner){ winner = tally[counter]; winname = contname[counter]; } counter++; } System.out.print("The Winner is: "+ winname +" - "+winner ); System.out.println("("+((double)winner/total)*100+"%)"); counter = 0; while (counter&lt;contno) { System.out.print(contname[counter]+" - Score:"); System.o…
tagged with: java
has comment: http://stackoverflow.com/comment/42296946
type: Question
tagged with: arrays
tagged with: sorting
score: 0
has comment: http://stackoverflow.com/comment/42297199
has title: How to arrange an array in descending order alongside a string array

http://stackoverflow.com/comment/42508503
type: QuestionComment
has text: possible duplicate of [permutations and combinations of Arraylists in Java?](http://stackoverflow.com/questions/11485497/permutations-and-combinations-of-arraylists-in-java)
type: Comment
comment on: http://stackoverflow.com/q/26987665
score: 0

http://stackoverflow.com/q/26959555
has comment: http://stackoverflow.com/comment/42457889
upvote count: 0
has comment: http://stackoverflow.com/comment/42458143
answer count: 1
has comment: http://stackoverflow.com/comment/42457708
favorite count: 0
has body: I have a String named s; s="abc|def|ghi"; I have tried to split s using regex "|" so that I get ["abc","def","ghi"]. s.split("|"); But instead I got ["a","b","c","|","d",...]. But when I used "\\|" as regex,that is: s.split("\\|"); and I got desired output. Can anyone please explain the reason behind it? And is it valid (I mean, not a compiler dependent) operation?
has answer: http://stackoverflow.com/a/26959808
score: -2
has comment: http://stackoverflow.com/comment/42457550
has title: Using '|' as delimitting regular expression(regex) in split() method in Java
type: AnsweredQuestion
tagged with: escaping
has comment: http://stackoverflow.com/comment/42457987
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42457632
has comment: http://stackoverflow.com/comment/42457823
type: Question
tagged with: split
accepted answer: http://stackoverflow.com/a/26959808

http://stackoverflow.com/q/26853413
possible better answer: http://stackoverflow.com/a/26853461
tagged with: java
has answer: http://stackoverflow.com/a/26853446
has comment: http://stackoverflow.com/comment/42269598
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26853461
linked to: http://stackoverflow.com/q/6729605
has comment: http://stackoverflow.com/comment/42269393
tagged with: arrays
score: 4
has title: Naming the boolean elements in a Java boolean array
answer count: 3
has comment: http://stackoverflow.com/comment/42269416
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26853720
has body: I'm stuck on a simple thing. I have an array of booleans named "tags." It's important to me to be able to access each element of the array by boolean: public boolean energetic, calming, happy, sad; public boolean[] trackTags = {energetic, calming, happy, sad}; I pass in and assign boolean values to the trackTags array (let's say [true, true, true, false]. So, when I call trackTags[0], I get "true." However, when I print "energetic," - which should be the same as trackTags[0], the value is always false. I know booleans initialize false, but when I switch some values in the trackTags Array for "true," shouldn't the named elements change as well? Second question: what's a good way for me to interact with boolean variable names? Specifically, if I pass in a String[] [happy, sad], and then want to switch only the boolean[] values corresponding to names in my String array, is this feasible? I have no trouble looping through the elements of both arrays, but I obviously can't compare a string to a boolean value. All in all, is there a better way to interact with boolean names? I'm really confused about this.
linked to: http://stackoverflow.com/q/40480
accepted answer: http://stackoverflow.com/a/26853446
type: AnsweredQuestion

http://stackoverflow.com/comment/42469257
type: Comment
has text: Totally answers the question but the explanation and single return statement from Adam Gent I feel is more elegant. Many thanks anyways
comment on: http://stackoverflow.com/a/26965648
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42294801
comment on: http://stackoverflow.com/a/26844493
type: Comment
has text: you might fix it by not supplying the jar file / class file in WEB-INF/classes and only using the one already supplied in common/classes. If you can identify the specific jar file that you are supplying _and_ is present in the common/lib / common/classes you could exclude it form your war file, hopefully
type: AnswerComment
score: 0

http://stackoverflow.com/a/26889487
type: AcceptedAnswer
has body: Oh, for f**k sake! I'm very sorry for taking your time! Problem was that for this specific activity I had typo in my putExtra(). And I presumed that problem is in my method of getting those extras... And naturally, error was NullPointException (or something like that) and reason was that extra I was looking for was not set. Thank you to NSimon for steering me in right direction with comment under question! So, it is correct to get extras in onCreate method. Just to clarify if anybody gets in same dilemma. In end I used solution I already posted in answer (but was getting an error due to typo in putExtra): @Override public Fragment getItem(int position) { // getItem is called to instantiate the fragment for the given page. return therapy_screen_fragment.newInstance(position + 1, getIntent().getExtras().getString("btnId")); }
has comment: http://stackoverflow.com/comment/42333106
type: Answer
accepted answer of: http://stackoverflow.com/q/26888824
answers question: http://stackoverflow.com/q/26888824
score: 0

http://stackoverflow.com/q/26875085
has title: JMenu duplicate
accepted answer: http://stackoverflow.com/a/26875704
tagged with: swing
linked to: http://stackoverflow.com/q/19209650
has comment: http://stackoverflow.com/comment/42309413
tagged with: jmenu
has body: I have a JFrame with a JMenu. When I add a JPanel containing an image on some occasions the menu is duplicated when the program first starts. The duplicated menu disappears on resize. Any suggestions gratefully received. Thanks. Code follows: public class MwE implements ActionListener { private JFrame frame; private String path; public static void main(String[] args) { new MwE(); } public MwE(){ frame=new JFrame(); frame.setLayout(new FlowLayout()); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.setSize(720,590); frame.setTitle("MWE"); frame.setJMenuBar(getMenu()); frame.setSize(new Dimension(720,590)); frame.setVisible(true); File f=new File(""); path=f.getAbsolutePath(); String fn=path.concat("\\1077neuron.jpg"); ImgPanel ip=new ImgPanel(fn); frame.setContentPane(ip); frame.addWindowListener(new MyWindowListener()); frame.validate(); frame.paintComponents(frame.getGraphics()); return; } class ImgPanel extends JPanel{ protected BufferedImage img; public ImgPanel(String F){ try{ img=ImageIO.read(new File(F)); } catch (IOException e){ System.out.println(e.getMessage()); } } @Override public void paintComponent(Graphics g){ super.paintComponent(g); g.drawImage(img,0,0, null); } } private JMenuBar getMenu(){ JMenuBar menuBar=new JMenuBar(); JMenu menu=new JMenu("File"); JMenuItem mi=new JMenuItem("OpenNetwork"); mi.addActionListener(this); menu.add(mi); mi=new JMenuItem("SaveNetwork"); menuBar.add(menu); menu=new JMenu("Help"); mi=new JMenuItem("About"); mi.addActionListener(this); menu.add(mi); menuBar.add(menu); return menuBar; } @Override public void actionPerformed(ActionEvent arg0) { if(arg0.getActionCommand()=="About"){ JOptionPane.showMessageDialog(frame, "MWE"); } } class MyWindowListener extends WindowAdapter { public void windowClosing(WindowEvent e) { frame.setVisible(false); frame.dispose(); } } } Here is what the problem looks like: https://drive.google.com/file/d/0BxEMTvXHiBACNVZ0blZyMHBma3c/view?usp=sharing The problem is not image spe…
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/26875431
has answer: http://stackoverflow.com/a/26875704
has answer: http://stackoverflow.com/a/26875431
score: 0
answer count: 2

http://stackoverflow.com/q/26845344
upvote count: 1
tagged with: web-services
tagged with: http
type: Question
tagged with: java
score: -1
tagged with: get
has comment: http://stackoverflow.com/comment/42254525
has answer: http://stackoverflow.com/a/26848757
answer count: 3
possible better answer: http://stackoverflow.com/a/26845463
has comment: http://stackoverflow.com/comment/42254211
has body: I am trying to access HTTP GET from Java client: public String getStreetAddressFromGeometry(String eventX, String eventY) { String streetName = ""; try { URL url = new URL("http://www.onemap.sg/API/services.svc/revgeocode?token=qo/s2TnSUmfLz+32CvLC4RMVkzEFYjxqyti1KhByvEacEdMWBpCuSSQ+IFRT84QjGPBCuz/cBom8PfSm3GjEsGc8PkdEEOEr&amp;location='"+eventX+"','"+eventY+"'"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Accept", "application/json"); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String responseString; while ((responseString = br.readLine()) != null) { try { JSONObject rawObj = new JSONObject(responseString); JSONArray searchResults = rawObj.getJSONArray("GeocodeInfo"); for (int i = 0; i &lt; searchResults.length(); i++) { if(searchResults.getJSONObject(i).getString("BLOCK").equals("")){ streetName = searchResults.getJSONObject(i).getString("ROAD"); }else if (!searchResults.getJSONObject(i).getString("BLOCK").equals("")){ streetName = searchResults.getJSONObject(i).getString( "BLOCK") + " " + searchResults.getJSONObject(i).getString("ROAD") + " SINGAPORE " + searchResults.getJSONObject(i).getString( "POSTALCODE"); } } } catch (Exception ex) { return "Error"; } } conn.disconnect(); } catch (IOException e) { e.printStackTrace(); } return streetName; } } I am calling the one map API here under reverse geocode. I tried the URL with the current coordinates I've now and it's working fine on the test URL. But when I put it into my codes and printed out the address returned. Instead of showing the address, it just state "Error" with no explanation or error message. I wonder which part I did wrongly? Thanks in advance.
has comment: http://stackoverflow.com/comment/42254771
favorite count: 0
has answer: http://stackoverflow.com/a/26845675
accepted answer: http://stackoverflow.com/a/26845675
has comment: http://stackoverflow.com/comment/42253912
has comment: http://stackoverflow.com/comment/42254901
has title: Access HTTP GET from Java Client
has comment: http://stackoverflow.com/comment/42260419
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42253837
has comment: http://stackoverflow.com/comment/42254488
has answer: http://stackoverflow.com/a/26845463
has comment: http://stackoverflow.com/comment/42254314
downvote count: 2

http://stackoverflow.com/comment/42628658
score: 0
has text: Yes I have tried but it didn't worked
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26894316

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

http://stackoverflow.com/q/26988108
tagged with: java
tagged with: image
has body: What I have is a code that acts as an image processor. The code has a bunch of methods but what I want to know is how do I call the methods so that when the user runs the program (from CMD) instead of just entering java imageprocessor, they instead would type java -imageprocessor –ascii image.jpg image.txt. What that means is the program reads that image and produces an ascii version of it which saves it in a file called image.txt. To call the methods the user would type in something like -writeGrayscaleImage which would call the method writeGrayscaleImage. So how would I implement it so the user calls the method? Here's my code so far: import java.awt.Color; import java.awt.image.BufferedImage; import java.io.*; import javax.imageio.ImageIO; public class ImageProcessor { public static int[][] readGrayscaleImage(String filename) { int [][] result = null; //create the array try { File imageFile = new File(filename); //create the file BufferedImage image = ImageIO.read(imageFile); int height = image.getHeight(); int width = image.getWidth(); result = new int[height][width]; //read each pixel value for (int x = 0; x &lt; width; x++) { for (int y = 0; y &lt; height; y++) { int rgb = image.getRGB(x, y); result[y][x] = rgb &amp; 0xff; } } } catch (IOException ioe) { System.err.println("Problems reading file named " + filename); System.exit(-1); } return result; } public static void writeGrayscaleImage(String filename, int[][] array) { int width = array[0].length; int height = array.length; try { BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); //create the image for (int x = 0; x &lt; width; x++) { for (int y = 0; y &lt; height; y++) { int rgb = array[y][x]; rgb |= rgb &lt;&lt; 8; rgb |= rgb &lt;&lt; 16; image.setRGB(x, y, rgb); } } File imageFile = new File(filename); ImageIO.write(image, "jpg", imageFile); } catch (IOException ioe) { System.err.println("Problems writing file named " + filename); System.exit(-1); } } }
has answer: http://stackoverflow.com/a/26988217
has answer: http://stackoverflow.com/a/26989420
tagged with: processor
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42508532
has answer: http://stackoverflow.com/a/26989455
has title: How do I call the method in this java program?
linked to: http://stackoverflow.com/q/17601420
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42508581
tagged with: methods
type: Question

http://stackoverflow.com/comment/42444564
has text: Yes, this is what I meant Richard. Thanks for the clarification, I am guessing my question wasn't clear enough.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26951894

http://stackoverflow.com/comment/42478723
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26971380
score: 1
has text: if suggesting this coz u r still using the old slow way. use viewholder pattern . also ur if(ischecked) doesnt make sense

http://stackoverflow.com/a/26946210
has comment: http://stackoverflow.com/comment/42435078
score: 1
has comment: http://stackoverflow.com/comment/42435496
has comment: http://stackoverflow.com/comment/42435539
has comment: http://stackoverflow.com/comment/42435363
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26946159
has body: private static void printLoToHi(int n){ if(n&lt;1){ // This is the base case that terminates the recursion. return; // You'll always have one - sometimes more. } printLoToHi(n-1); // This is where the recursion takes place. printMany(n); // But when n &lt; 1 it returns to here and continues on. } So you see it does indeed get called; only after the base case (n &lt; 1) is reached. An easy example would be if you called it with printLoToHi(1)... It will pass the if condition. It calls itself with n - 1 (0) as an argument. This time it fails the condition and returns. n == 1 in our original method. printMany(1) is called.
has comment: http://stackoverflow.com/comment/42435534
has comment: http://stackoverflow.com/comment/42435489
answers question: http://stackoverflow.com/q/26946159
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42435379
type: Answer
has comment: http://stackoverflow.com/comment/42435416

http://stackoverflow.com/a/26989412
type: Answer
answers question: http://stackoverflow.com/q/26980773
has body: I found solution (I used wrong encoding): serializer.setOutput(outputStream, "UTF-8"); Now all works fine
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/comment/42381160
comment on: http://stackoverflow.com/q/26915949
score: 0
type: QuestionComment
has text: @MatiCicero who are you?
type: Comment

http://stackoverflow.com/a/71722197
has body: The DynamoDB Gradle dependency already includes the SQLite libraries. You can pretty easily instruct the Java runtime to use it in your Gradle build script. Here's my build.gradle.kts as an example: import org.apache.tools.ant.taskdefs.condition.Os plugins { application } repositories { mavenCentral() maven { url = uri("https://s3-us-west-2.amazonaws.com/dynamodb-local/release") } } dependencies { implementation("com.amazonaws:DynamoDBLocal:[1.12,2.0)") } fun getSqlitePath(): String? { val dirName = when { Os.isFamily(Os.FAMILY_MAC) -> "libsqlite4java-osx" Os.isFamily(Os.FAMILY_UNIX) -> "libsqlite4java-linux-amd64" Os.isFamily(Os.FAMILY_WINDOWS) -> "sqlite4java-win32-x64" else -> throw kotlin.Exception("DynamoDB emulator cannot run on this platform") } return project.configurations.runtimeClasspath.get().find { it.name.contains(dirName) }?.parent } application { mainClass.set("com.amazonaws.services.dynamodbv2.local.main.ServerRunner") applicationDefaultJvmArgs = listOf("-Djava.library.path=${getSqlitePath()}") } tasks.named<JavaExec>("run") { args("-inMemory") }
answers question: http://stackoverflow.com/q/26901613
score: 0
type: Answer

http://stackoverflow.com/comment/47852291
has text: @Bludream it's not about it being shorter or more meaningful, it's about introducing a new paradigm to Java - functional programming. This allows you to do things in a very different way to previous iterations of Java. Functional programming comes into its own when you need to abstract _behaviour_ rather than _data_. Further, this above could be a slightly long one-liner; it was certainly not possible to do this in one line previously.
comment on: http://stackoverflow.com/a/26905402
type: AnswerComment
type: Comment
score: 4

http://stackoverflow.com/q/26910819
has body: I'm using Spring-Batch to read csv files sequentially with MultiResourceItemReader. I want to create a reader that reads the chunksize from file 1 reads the chunksize from file 2 compare both what has been read and create some kind of "patch" object write the patch object to database Now the problem with MultiResourceItemReader is that it will first read the full file1 in chunks, and when the file is finished, it will continue with file2. How can I create batch steps that will switch between the files based on the chunksize?
type: AnsweredQuestion
tagged with: spring-batch
type: Question
has title: How to read multiple files in chunks using Spring-Batch?
has answer: http://stackoverflow.com/a/26912178
possible better answer: http://stackoverflow.com/a/57892113
answer count: 2
has answer: http://stackoverflow.com/a/57892113
tagged with: spring
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26912178

http://stackoverflow.com/a/26923738
type: Answer
has comment: http://stackoverflow.com/comment/42436006
score: 2
answers question: http://stackoverflow.com/q/26923666
downvote count: 0
has body: If by "check if the calling object is null" you mean "check if the result of the get() call is null", then the answer is, "it depends on your use case." For your use case, your value from name will never be null, so there's little gain in checking for it. Normally, getters are just that - getters. They only get data, even null. If you're going to use that value and you have an expectation of it being non-null, then you most certainly should check for null in the method that uses it.
upvote count: 2
has comment: http://stackoverflow.com/comment/42444548

http://stackoverflow.com/a/26867434
has body: You can't access that data in php through POST because it is being sent on the android application through the HTTP header and not over application/x-www-form-urlencoded. Here's a thread that explains how you can do it: How to retrieve Request Payload
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26867282

http://stackoverflow.com/comment/42438221
type: AnswerComment
has text: i see, thanks so much. it was the last part i had to do for my project
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26948146

http://stackoverflow.com/q/26977548
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42489751
has body: I think this method should work, but I keep getting nullpointer exceptions when I try to use the remove method. I have added 8 things to the heap, and then print them off one by one by using the remove() method. On the second one every time I get a null pointer exception, but I have no idea why? So, I tried System.out.println(example.remove()); in a for loop, but it would print one thing then give me a null pointer exception. My IDE says the null pointer comes from the remove, then from the percolate, then originating at the compare. How can I fix this problem? public class GenericHeap&lt;E&gt; { private int size; int capacity = 10; public E[] heap; Comparator mycomparator; public GenericHeap(Comparator c) { this.size = 0; heap = (E[]) new Object[capacity]; mycomparator = c; } public E remove() { E returnval = heap[1]; heap[1] = heap[size]; size--; this.pop(); this.percolatedown(1); return returnval; } private void pop() { E[] temp = (E[]) new Object[capacity]; System.arraycopy(heap, 0, temp, 0, size); heap = temp; } private void percolatedown(int i) { while (i * 2 &lt;= size) { int kid = minchild(i); if (mycomparator.compare(this.heap[i], this.heap[kid]) == 1) { E temp = this.heap[i]; this.heap[i] = this.heap[kid]; this.heap[kid] = temp; } i = kid; } } private int minchild(int i) { if ((i * 2) + 1 &gt;= size) { return i * 2; } else { if (mycomparator.compare(heap[i * 2], heap[(i * 2) + 1]) == -1) { return i * 2; } else if (mycomparator.compare(heap[i * 2], heap[(i * 2) + 1]) &gt;0) { return i * 2 + 1; } } return i*2; } } The comparator class: public class StringComparator implements Comparator &lt;String&gt; { @Override public int compare(String t, String t1) { if (t.length() &gt; t1.length()) { // null pointer here return 1; } else if (t.length()&lt;t1.length()){ return -1; } if (t.compareTo(t1)&lt;0) { return 1; } if(t1.compareTo(t1)&gt;0) { return -1; } return 0; } } and I get this exception: Exception in thread "main" java.lang.NullPointerException at hw10.Stri…
has comment: http://stackoverflow.com/comment/42490033
has title: NullPointerException while comparing two strings
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26977818
has comment: http://stackoverflow.com/comment/42490096
has comment: http://stackoverflow.com/comment/42490171
score: -1
has comment: http://stackoverflow.com/comment/42489913
upvote count: 0
answer count: 1
tagged with: string-comparison
favorite count: 0

http://stackoverflow.com/comment/42478908
has text: You are hardcoding the user id, are you doing it for testing purposes ?
type: QuestionComment
comment on: http://stackoverflow.com/q/26966886
score: 0
type: Comment

http://stackoverflow.com/q/26844324
has body: I'm doing an application that performs a REST web service query. I need to set the following headers: application / vnd.sdmx.structure + xml; version = 2.0 in: webRequest.Accept but webRequest.Accept is a property of .NET how can I set this in Android / Java? I tried doing this: getRequest.setHeader("webRequest.Accept", "application/vnd.sdmx.structure+xml;version=2.0"); but don't work.
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42252160
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42252335
type: Question
has title: HttpWebRequest.Accept in java/Android
tagged with: .net
has comment: http://stackoverflow.com/comment/42251828
has comment: http://stackoverflow.com/comment/42251909
score: 0
has comment: http://stackoverflow.com/comment/42252086
has comment: http://stackoverflow.com/comment/42251864

http://stackoverflow.com/comment/42275837
type: Comment
type: QuestionComment
has text: @ollaollu What MadProgrammer means is that a primitive `double` value (the lowercase version, if you will) cannot be null. Primitive values are initialized to a 0.0 (floats and doubles) and 0 (integers, longs, etc). The object version `Double` (note the uppercase), can be null. If your `getValue2` field is of type `Double` as opposed to `double`, and it is null, then you would be getting a NPE. Otherwise, you'll get back `0.0`.
comment on: http://stackoverflow.com/q/26856897
score: 0

http://stackoverflow.com/comment/46909462
type: AnswerComment
comment on: http://stackoverflow.com/a/27070780
type: Comment
score: 1
has text: *Otto dispatches events* **synchronously** *in the* **same thread** *, in which they were posted.* This is very important.

http://stackoverflow.com/comment/42405050
has text: the values from the double array are not getting declared with the string values from the string array
score: 0
comment on: http://stackoverflow.com/q/26929676
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26876594
has comment: http://stackoverflow.com/comment/42310889
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42310590
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42311381
answer count: 1
accepted answer: http://stackoverflow.com/a/26877382
has title: read text file content and insert it into a mysql database
has comment: http://stackoverflow.com/comment/42311332
has comment: http://stackoverflow.com/comment/42310734
has comment: http://stackoverflow.com/comment/42311418
score: 0
tagged with: sql
linked to: http://stackoverflow.com/q/26883877
has body: Good day . I've the following code which i'm trying to make work . I have to read the content of a text file , which contains questions and save it to the database testsystem . The main problem that i'm facing is that it's not inserted in the database. and i'm not sure whether it is reading the textfile or not. any help will be glady appreciated JFrame and main public class StudentTestSystems { public static void main(String[] args) { try { Lecturer panel = new Lecturer(); panel.setVisible(true); panel.setLocationRelativeTo(null); panel.setResizable(false); } catch (Exception ex) { ex.printStackTrace(); } } } Lecturer class public class Lecturer extends JFrame implements ActionListener { Font font = null; private JTextField fileField; private JButton uploadBtn; private JLabel message; private JPanel panel; public Lecturer() { super("LECTURE MENU"); this.setSize(500, 270); this.setResizable(false); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); font = new Font("Times New Roman", Font.BOLD, 14); panel = new JPanel(); panel.setLayout(null); panel.setOpaque(true); fileField = new JTextField(); fileField.setFont(font); fileField.setBounds(130, 110, 200, 25); Font font2 = new Font("Times New Roman", Font.BOLD + Font.ITALIC, 12); message = new JLabel("Type in the file name with it's extension. eg: File.txt"); message.setFont(font2); message.setBounds(130, 140, 280, 25); message.setOpaque(true); uploadBtn = new JButton("UPLOAD"); uploadBtn.setFont(font); uploadBtn.setBounds(340, 110, 95, 21); panel.add(fileField); panel.add(uploadBtn); panel.add(message); add(panel); /////// register event uploadBtn.addActionListener(this); exit.addActionListener(this); } public void actionPerformed(ActionEvent ev) { String file = fileField.getText(); SetGetQuestionFileName setGet = new SetGetQuestionFileName(file); FileInputStream fis = null; PreparedStatement preparedStmt = null; try { String myUrl = "jdbc:mysql://localhost:3306/testsystem"; Connection conn = DriverManager.getConnec…
has answer: http://stackoverflow.com/a/26877382

http://stackoverflow.com/comment/42243202
has text: Visibility/protection level issues?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26839352

http://stackoverflow.com/q/26852445
has answer: http://stackoverflow.com/a/26869663
favorite count: 0
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26869663
has body: I want to be able to add custom params in the client for the handshake. In the html client I am doing this var socket = io('http://192.168.1.120:3000/socket', {query: user}); where user is an json object with data I want to be able to do the same in java, I am using the library nkzawa socket.io-client Thank you
tagged with: socket.io
type: Question
has title: Add custom params on nkzawa socket.iO-client for the handshake
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/42319185
type: Comment
type: QuestionComment
has text: @PM2Ring I didn't asked to write code for me. If such function already exist, that is acceptable.
comment on: http://stackoverflow.com/q/26880953
score: 0

http://stackoverflow.com/a/33714414
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26931220
answers question: http://stackoverflow.com/q/26931220
has body: Don't set any values in your constructor. The constructor is called when the topology is first built by the driver and before the topology is submitted to the cluster. That's why any instance variables you set, whether by class initialization or in the constructor, must be serializable. Instead, simply leave those instance variables null and set them in the prepare() method. When you do that you won't need to serialize any values, so this works for non-serializable instance variables, too.
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26973118
tagged with: android
has answer: http://stackoverflow.com/a/26973913
upvote count: 1
has title: Special Characters issue in server response
score: 1
tagged with: java
tagged with: character-encoding
tagged with: fileoutputstream
has body: When I'm request(GET) to server for content, I'm able to get response as: K?? But actual content is: KòÉ In order to fix this issue, I'm trying to use UTF-8 format while saving and reading content from file, like below: //Saving content OutputStreamWriter sout = new OutputStreamWriter (new FileOutputStream(new File(path)),Charset.forName("UTF-8")); BufferedWriter buff_out= new BufferedWriter(sout); int line = 0; while((line = buff_in.read()) != -1) buff_out.write(line); //Reading content InputStream inputStreamRead = new FileInputStream(path); StringBuilder stringBuilder = null; InputStreamReader inputStreamReader = new InputStreamReader(inputStreamRead, Charset.forName("UTF-8")); BufferedReader buffReader= new BufferedReader(inputStreamReader); String line; stringBuilder = new StringBuilder(); try { while (( line = buffReader.readLine()) != null) { stringBuilder.append(line); stringBuilder.append('\n'); } Log.d("Main", "Test:: "+stringBuilder.toString()); } With help of above logic, I'm not albe to get the actual content as KòÉ. I have tried reading bytes too. Can any one help me out of this. Thanks in advance.
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26973944
tagged with: unicode
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26862289
has body: Edit: This code actually works correctly. The problem was un-related and was due to a conflicting Entity which was creating a foreign key constraint and stopping me from inserting into the DataFile table. I'm having some real trouble with some JPA mappings for a simple @OneToMany mapping. I'm using EclipseLink and DerbyDB. @Entity( name = "study2" ) @Access( AccessType.FIELD ) public class Study2 extends EntityBaseItem { private List&lt;DataFile&gt; datafiles = new ArrayList&lt;DataFile&gt;(); public Study2() { } @OneToMany( cascade = CascadeType.ALL, orphanRemoval = true ) @JoinColumn( name="STUDY_ID", referencedColumnName = "ID" ) @Access( AccessType.PROPERTY ) public List&lt;DataFile&gt; getDatafiles() { return this.datafiles; } public void setDatafiles( List&lt;DataFile&gt; dfList ) { this.datafiles = dfList; } DataFile.java @Entity( name = "DataFile" ) public class DataFile extends EntityBaseItem&lt;DataFile&gt; { private String filename; private long filesize; private String fileStatus; private String fileType; private String fileSubType; public DataFile() { } } This is my EntityBaseItem.java where the @Id resides: @MappedSuperclass public abstract class EntityBaseItem { @Id @GeneratedValue( strategy = GenerationType.TABLE ) protected Integer id; protected EntityBaseItem() {} public Integer getId() { return id; } public void setId( Integer id ) { this.id = id; } @Override public int hashCode() { int hash = 0; hash += ( this.getId() != null ? this.getId().hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (this == object) return true; if (object == null) return false; if (getClass() != object.getClass()) return false; EntityBaseItem other = (EntityBaseItem)object; if (this.getId() != other.getId() &amp;&amp; (this.getId() == null || !this.id.equals(other.id))){ return false; } return true; } } The problem is that when I create a Study2 object with some DataFile objects and try to persist it to my DB then I get the error UPDATE o…
has title: Violation of foreign key constraint JPA
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42288639
has comment: http://stackoverflow.com/comment/42289864
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42289823
has comment: http://stackoverflow.com/comment/42289945
score: 2
has comment: http://stackoverflow.com/comment/42288436
downvote count: 0
has comment: http://stackoverflow.com/comment/42288782
has answer: http://stackoverflow.com/a/26864643
tagged with: java
has comment: http://stackoverflow.com/comment/42289523
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42288955
tagged with: jpa
has comment: http://stackoverflow.com/comment/42336887
tagged with: derby

http://stackoverflow.com/q/26898995
has answer: http://stackoverflow.com/a/26902928
upvote count: 2
type: UnansweredQuestion
has body: In the past 2 hours i was looking for a deep insight on how JSF works. I read many good explanations, but every story was only about the JSF lifecycle on the SERVER, however i'm curious about the client side. Better spoken, i'm curious how the client browser will create the appropriate http request when the user interacts with the app. Btw JSF noobie here, so as far as i understand the picture, JSF is a server side MVC framework, OK. when the client enters a url in the browser, like somedomain.com/landingpage the server side framework accross some "building" steps produces html out of JSF pages. That's clear. So the end user will be served with a html page with optionally css and/or javascript. then the user is able to make some interaction, say, to fill up a form and submit it. When he/she submits the form the browser is creating a POST request to the server with the data. The request here was made by the browser because of the implementation/specification of a html form. The server gets this requests, bakes something and responds with a view (a.t.m i doesn't care about the server part) Anther example: We have a button, and i want this button to generate some dynamic content on the page, say clicking on the button should create two new divs on the page. So in the browser, clicking on the button a click event has been created. I'm curious in what will trigger here the request to the server to serve back a new page/view with the new content? (I know AJAX could do the job, but i'm asking for the default behavior here). I asked one of my friends, and he said, that on JSF side we provide an actionListener on that button, and in the actionListener we define a bean method to be triggered for execution upon the click event. That's clear again. But what will create the request on client side? Some hidden JavaScript code? Or what? So generally, i don't understand JSF's client side request-triggering methods. And i'm curious about them. Thanks.
score: 2
tagged with: jsf
tagged with: java
type: Question
tagged with: jakarta-ee
has title: Explanation needed on "client side" JSF
tagged with: jsf-2
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26908306
favorite count: 0

http://stackoverflow.com/comment/43540263
type: AnswerComment
type: Comment
has text: In this case, I believe that `<? extends Sentence>` is more correct because, it retains type safety. The more specific generic restricts references to `Sentence` and its subtypes.
comment on: http://stackoverflow.com/a/26875952
score: 0

http://stackoverflow.com/q/26876137
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44741564
tagged with: spring
has title: Hibernate @ManyToOne @JoinColumn is always null
score: 2
has comment: http://stackoverflow.com/comment/42461872
tagged with: java
tagged with: hibernate
tagged with: h2
type: Question
has answer: http://stackoverflow.com/a/29393254
answer count: 2
has comment: http://stackoverflow.com/comment/42309841
downvote count: 0
has comment: http://stackoverflow.com/comment/42309906
has body: I'm trying to implement One-to-Many relation between two tables using hibernate. Here is my code: @Entity public class Board { @Id @Column(name = "board_id") @GeneratedValue private long id; @Column private String owner; @Column private String title; @Column private String refresh; @Column private Timestamp createDate; @Column private Timestamp modifyDate; @OneToMany(mappedBy="board", cascade=CascadeType.ALL) private List&lt;Item&gt; items; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getRefresh() { return refresh; } public void setRefresh(String refresh) { this.refresh = refresh; } public Timestamp getCreateDate() { return createDate; } public void setCreateDate(Timestamp createDate) { this.createDate = createDate; } public Timestamp getModifyDate() { return modifyDate; } public void setModifyDate(Timestamp modifyDate) { this.modifyDate = modifyDate; } public List&lt;Item&gt; getItems() { return items; } public void setItems(List&lt;Item&gt; items) { this.items = items; } } and second table: @Entity public class Item { public enum Type { link, image, presentation; } public enum JavaScript { enable, disable; } @Id @Column @GeneratedValue private long id; @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "board_id") private Board board; @Column private Type type; @Column(length = 10000) private String link; @Column private String image; @Column private String presentation; @Column private String time; @Column private JavaScript javaScript; @Column private String first; @Column private String last; @Transient private MultipartFile imageFile; @Transient private MultipartFile presentationFile; public long getId() { return id; } public void setId(long id) { this.id = id; } public Board getBoard() { return board; } pub…
has answer: http://stackoverflow.com/a/30081634
favorite count: 0
tagged with: one-to-many

http://stackoverflow.com/comment/42514228
comment on: http://stackoverflow.com/q/26986718
type: QuestionComment
has text: And my RestTest didn't work too: localhost:8080/ejbtest/test/ep
type: Comment
score: 0

http://stackoverflow.com/comment/42473174
comment on: http://stackoverflow.com/q/26968213
score: 0
has text: @SotiriosDelimanolis I'm basically trying to preapre a String to be used to call a web service. my requirement is to add _"abc"_ (including the double quotes) as a part of my soap request. I have tried it by '\"abc\"' but when the request is sent it is converted to '"abc"'
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26863447
score: 1
answers question: http://stackoverflow.com/q/26863241
upvote count: 1
type: Answer
downvote count: 0
has body: The documentation for getAttributeValue with the namespace parameter says you need to enable namespace processing. Try enabling it at the beginning of the processing as in the example for setFeature setFeature(FEATURE_PROCESS_NAMESPACES, true)

http://stackoverflow.com/comment/42273171
has text: Ok, I just posted it so I'll keep trying different things and wait to hear from them. Thanks jewelsea.
score: 0
comment on: http://stackoverflow.com/q/26855128
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42536668
type: AnswerComment
has text: tried both those suggestions - still get the exact same error in the stacktrace - org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation
type: Comment
comment on: http://stackoverflow.com/a/26980306
score: 0

http://stackoverflow.com/q/26887182
score: 0
tagged with: rest
answer count: 3
has body: How to write REST api in spring application? I am getting this error: The resource identified by this request is only capable of generating responses with characteristics not acceptable according to the request "accept" headers. I tried a lot. My code looks like this: mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"> <context:component-scan base-package="com.mkyong.common.controller" /> <mvc:annotation-driven /> /WEB-INF/pages/ .jsp </beans> web.xml Spring Web MVC Application mvc-dispatcher org.springframework.web.servlet.DispatcherServlet 1 mvc-dispatcher /movie/* Controller class file package com.mkyong.common.controller; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.mkyong.common.model.UserBean; @Controller @RequestMapping("/movie") public class MovieController { @RequestMapping(value="/response", method = RequestMethod.GET) public @ResponseBody List<UserBean> getMovie() { UserBean bean = new UserBean(); List<UserBean> list = new ArrayList<UserBean>(); bean.setId("xx"); bean.setFirstname("xxx"); bean.setLastname("xxx"); bean.setSal("xxxx"); list.add(bean); return list; } } UserBean class package com.mkyong.common.model; public class UserBean { private String id; private …
accepted answer: http://stackoverflow.com/a/29299875
has comment: http://stackoverflow.com/comment/42330151
has answer: http://stackoverflow.com/a/29299875
has comment: http://stackoverflow.com/comment/42368480
tagged with: spring
has answer: http://stackoverflow.com/a/26914866
has comment: http://stackoverflow.com/comment/45883299
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42367079
has title: How to solve this springmvc / json response error
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/26914866
has answer: http://stackoverflow.com/a/26927591
type: Question
has comment: http://stackoverflow.com/comment/42331275
has comment: http://stackoverflow.com/comment/42333918

http://stackoverflow.com/a/26933496
answers question: http://stackoverflow.com/q/26933286
has comment: http://stackoverflow.com/comment/42527897
has comment: http://stackoverflow.com/comment/43179734
upvote count: 8
accepted answer of: http://stackoverflow.com/q/26933286
has comment: http://stackoverflow.com/comment/43192628
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42420322
has comment: http://stackoverflow.com/comment/42457384
downvote count: 2
type: Answer
has body: Use @DependsOn annotation to control beans initialization order.
has comment: http://stackoverflow.com/comment/42412932
has comment: http://stackoverflow.com/comment/42419889
score: 6

http://stackoverflow.com/comment/42539899
comment on: http://stackoverflow.com/a/26981692
score: 0
type: Comment
type: AnswerComment
has text: Then post another question about the exceptions raised... When you'll fix that, you will see that this question is already answered ;)

http://stackoverflow.com/q/26865787
has answer: http://stackoverflow.com/a/27030439
has body: I want to get Bitmap from ImageView. I have used following code, but getDrawable() returns null. How to get whole Bitmap from ImageView. Bitmap bitmap; if (mImageViewer.getDrawable() instanceof BitmapDrawable) { bitmap = ((BitmapDrawable) mImageViewer.getDrawable()).getBitmap(); } else { Drawable d = mImageViewer.getDrawable(); bitmap = Bitmap.createBitmap(d.getIntrinsicWidth(), d.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); d.draw(canvas); } storeImage(bitmap,"final.jpeg");
has answer: http://stackoverflow.com/a/26865906
tagged with: android-layout
has answer: http://stackoverflow.com/a/39349741
tagged with: java
type: Question
tagged with: imageview
score: 60
has answer: http://stackoverflow.com/a/68922201
has title: Get Bitmap from ImageView in Android L
upvote count: 61
has comment: http://stackoverflow.com/comment/42791454
tagged with: android
linked to: http://stackoverflow.com/q/4715044
favorite count: 0
linked to: http://stackoverflow.com/q/5566758
has answer: http://stackoverflow.com/a/45823721
has comment: http://stackoverflow.com/comment/136851300
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/136851306
tagged with: bitmap
downvote count: 1

http://stackoverflow.com/q/26907962
has answer: http://stackoverflow.com/a/26911053
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/26911053
has body: I need to run project tests both locally and automatically on TeamCity server. Local test execution must use local database connection, and when run on TeamCity, tests must use a remote connection to the database. So I need to tell my tests, when to use local connection and when to use remote and pass URL, username and password in this case. To tell that I decided to use java system properties. I found built-in support in Gradle for that systemProperty 'some.prop', 'value' The question is, how can I create a standard test task for local test run, that will not pass any properties, and a custom test task, that will set system properties before run? I tried something like task teamCityTest(type : Test) { scanForTestClasses = false includes = ['**/*Test.class'] systemProperty 'some.prop', 'value' } but it failed with NPE, that means I'm doing something wrong.
downvote count: 0
has title: Create a copy of Gradle Test task
tagged with: build.gradle
favorite count: 0
tagged with: teamcity
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: gradle

http://stackoverflow.com/a/26912695
upvote count: 1
score: 1
has body: use a file which contains the user information. For a bank application which contains multiple attributes for a user, i recommend use an excel sheet since you are nt concerning about security. ApachePOI library will work great in editing excel documents.
downvote count: 0
answers question: http://stackoverflow.com/q/26912539
type: Answer

http://stackoverflow.com/q/26851697
has answer: http://stackoverflow.com/a/26851904
favorite count: 0
score: 0
accepted answer: http://stackoverflow.com/a/26851867
has answer: http://stackoverflow.com/a/26851935
possible better answer: http://stackoverflow.com/a/26851855
has body: I'm trying to do is figure out how to see if data from a for loop meets a certain criteria. I want to use an if statement to do so (unless there's a better way), but the trouble I'm having is that the data is inside a for loop, and the code doesn't want me to use the values outside of that loop. Here is the code: //Create an array called schoolEnrollment of length numberOfStudents Student[] myArray = new Student[numberOfStudents]; //Create enough objects of type Student to fill the array above for (int i = 0; i &lt; numberOfStudents; i++) { //Uses the instance of RandomNames to assign first and last names to each student //First names String[] firstNames1 = {"John", "Roxanne", "Dean", "Mary", "Shawn", "Sara", "Peter", "Susie", "Jerry", "Juliet"}; int idx = new Random().nextInt(firstNames1.length); String random = (firstNames1[idx]); String NextFirstName = random; //Last names String[] lastNames1 = {"Smith", "Brown", "Baker", "Doe", "Poe", "Allen", "Black", "Frederick", "Hunter", "Spencer"}; int idx1 = new Random().nextInt(lastNames1.length); String random1 = (lastNames1[idx1]); String NextLastName = random1; //Randomly assign house locations to each student int houseLocation = (int) (0 + (Math.random() * (3 - 0))); //Randomly assign distance from school to each student int distanceFromSchool = (int) (0 + (Math.random() * (30 - 0)));; myArray[i] = new Student(NextFirstName, NextLastName, houseLocation, distanceFromSchool); } for (int i = 0; i &lt; numberOfStudents; i++) { // display toString for each object System.out.println(myArray[i].toString()); } //Create 4 other arrays of length numberOfStudents of type Student with the names //ridersOfNorthBus, ridersOfWestBus, ridersOfSouthBus, and ridersOfEastBus Student[] ridersOfNorthBus = new Student[numberOfStudents]; Student[] ridersOfWestBus = new Student[numberOfStudents]; Student[] ridersOfSouthBus = new Student[numberOfStudents]; Student[] ridersOfEastBus = new Student[numberOfStudents]; So, what I'm trying to do is…
has answer: http://stackoverflow.com/a/26851845
has answer: http://stackoverflow.com/a/26851867
answer count: 5
downvote count: 2
type: AnsweredQuestion
tagged with: if-statement
has title: Find out if data from a for loop meets a certain criteria
tagged with: java
type: Question
upvote count: 2
tagged with: random
tagged with: for-loop
has answer: http://stackoverflow.com/a/26851855
tagged with: variables

http://stackoverflow.com/comment/42356169
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26883293
has text: What you mean by double click on image in jar? You may be reading images wrong in java application.

http://stackoverflow.com/q/26871081
tagged with: amazon-ec2
has comment: http://stackoverflow.com/comment/42305963
tagged with: amazon-web-services
favorite count: 0
score: 1
tagged with: amazon-elastic-beanstalk
tagged with: amazon-cloudfront
has comment: http://stackoverflow.com/comment/42310547
type: UnansweredQuestion
has body: I have a java application running on tomcat that deployed on beanstalk. I'm not finding much information out there on this topic, so I'm wondering if someone could tell me the pros and cons to using cloudfront in front of beanstalk. I understand it makes sense with an s3 bucket, but I'm not clear on EBS. One benifit I see is it's ability to automatically handle http to https redirection without the need to setup a rewriter on the ec2 instance, however I'm not sure the extra cost is worth that. If anybody knows anything about this, I'd really like to know.
upvote count: 1
has title: Cloudfront in front of Beanstalk
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42306426
type: Question
downvote count: 0

http://stackoverflow.com/comment/42237786
comment on: http://stackoverflow.com/a/26835824
has text: Again be careful of overflow if that is important to your use case.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/45919452
type: Answer
score: 1
upvote count: 1
has body: You should you use withNewSession(). According to the documentation it is available since prehistorical Grails 1.2.0. Short recap: withSession() - makes current Hibernate session available (if it exists, otherwise you get "No Session found for current thread") withNewSession() - creates new Hibernate session without starting a transaction (I believe the best solution for you) withTransation() - starts and commits a transaction (not exactly the best choice for a simple read-only operation) (tested on Grails 3.1.13)
answers question: http://stackoverflow.com/q/26933458
downvote count: 0

http://stackoverflow.com/comment/42339257
type: AnswerComment
comment on: http://stackoverflow.com/a/26892738
type: Comment
has text: thanks for the answer, but if happens the scenario described, how the jvm works on it?
score: 0

http://stackoverflow.com/a/26939711
type: Answer
has comment: http://stackoverflow.com/comment/42423595
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42423775
has body: public static double calcAverage(double heights) your method is expecting a double parameter, not double[]. So you cannot pass your double array to the method. The 2nd method: public static double heightAverage(double average) needs a return value(double), but you didn't return anything.
answers question: http://stackoverflow.com/q/26939663
upvote count: 2

http://stackoverflow.com/comment/42287393
score: 0
has text: gl-Errors are not reported to console unless you query them by glGetError() and write them to console. What is the result you get at the moment? Is everything overdrawn by the hud or is the hud not drawn?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26861665

http://stackoverflow.com/q/26865985
type: AnsweredQuestion
tagged with: java
tagged with: nutch
type: Question
has body: I wonder how could I find the original url after it hits a redirection. They're actually found on seedlist but I can not guarantee which url is redirected to which url. In Fetcher phase I expect to read it from Nutch.WRITABLE_REPR_URL_KEY, but it is overriden by redirected url. Any suggestion how to read them from crawldb, segments or linkdb? PS: I only crawl first-level pages (depth:1) on seedlist. Best, Tugcem.
has answer: http://stackoverflow.com/a/26866904
score: 0
accepted answer: http://stackoverflow.com/a/26866904
answer count: 1
has title: Nutch 1.6 find original url of redirected ones
tagged with: http-redirect

http://stackoverflow.com/comment/42410194
type: AnswerComment
type: Comment
has text: Sorry, did not take that point, just try to use recursive on this point. 'return getRandomStringWithExclusion(array_id, exclude)' should be working fine, instead of 'return ""'
comment on: http://stackoverflow.com/a/26931458
score: 0

http://stackoverflow.com/q/26987269
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42507337
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42507467
has title: Program only seems to be reading every other line of .txt file
score: 0
tagged with: file-io
has answer: http://stackoverflow.com/a/26987356
answer count: 1
has body: I'm working on an assignment in which I use scanners to read lines and tokens of a .txt file. I need to do some conversions and rearrange a few strings, which I have done using some helper methods. The problem is that the code is only working for every other line that it reads from the file. I think I may have messed something up somewhere in the beginning of the code. Any hints or tips on what I would need to modify? Here's what I have thusfar: public static void main(String[] args) throws FileNotFoundException { Scanner input = new Scanner(new File("PortlandWeather2013.txt")); while (input.hasNextLine()) { String header = input.nextLine(); System.out.println(header); Scanner input2 = new Scanner(header); while (input2.hasNextLine()){ String bottomHeader = input.nextLine(); System.out.println(bottomHeader); String dataLines = input.nextLine(); Scanner linescan = new Scanner(dataLines); while (linescan.hasNext()){ String station = linescan.next(); System.out.print(station+ " "); String wrongdate = linescan.next(); String year = wrongdate.substring(0,4) ; String day = wrongdate.substring(6); String month = wrongdate.substring(4,6); System.out.print(month + "/" + day + "/" + year); double prcp = linescan.nextDouble(); System.out.print("\t "+prcpConvert(prcp)); double snwd = linescan.nextDouble(); System.out.print("\t " + snowConvert(snwd)); double snow = linescan.nextDouble(); System.out.print("\t" + snowConvert(snow)); double tmax = linescan.nextDouble(); System.out.print("\t" + tempConvert(tmax)); double tmin = linescan.nextDouble(); System.out.println("\t" + tempConvert(tmin)); } } } } public static double prcpConvert(double x){ double MM = x/1000; double In = MM * 0.039370; double rounded = Math.round(In * 10)/10; return rounded; } public static double snowConvert(double x){ double In = x * 0.039370; double rounded = Math.round(In * 10)/10; return rounded; } public static double tempConvert(double x){ double celsius = x/10; double fahrenheit = (celsius *9/5)+32; d…

http://stackoverflow.com/a/26906279
has body: To avoid possible effect of what @jwalker has pointed to, you need to stop console logging (log.screen) which is only useful while you're developing. To achieve this you can set apt CherryPy environment, like cherrypy.config.update({'environment': 'production'}). It always better use your tools, not fight them like @Isa suggested. When you see "left-spinning wheel", it indicates that CherryPy has received your request but can't handle it at the moment. It maybe a session lock, if you use sessions and send concurrent requests, like @Isa wrote. But it also may be the case that your Python app you proxying with CherryPy, blocks, and because CherryPy is a threaded-server you run out of available worker-threads. Whatever reason is, you can leverage logging to understand your problem. Look at access and error logs for correspondence to your requests. Log an entry when your Python app starts and ends processing a request. You can also do it at CherryPy side, like: #!/usr/bin/env python # -*- coding: utf-8 -*- import time import cherrypy config = { 'global' : { 'server.socket_host' : '127.0.0.1', 'server.socket_port' : 8080, 'server.thread_pool' : 8, 'log.access_file' : 'access.log', 'log.error_file' : 'error.log', } } def logStartFinish(fn): def wrap(*args, **kwargs): cherrypy.log('Start') try: return fn(*args, **kwargs) finally: cherrypy.log('Finish') return wrap class App: @cherrypy.expose @logStartFinish def index(self): time.sleep(4) # Call to Python app you wrap return 'Some result' if __name__ == '__main__': cherrypy.config.update({'environment': 'production'}) cherrypy.quickstart(App(), '/', config)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26882910

http://stackoverflow.com/a/26947966
has body: In your activity class you defined CatModel as: private CategoryModel catModel; Which would initialize catModel with null. Then you don't initialize it in your Activity class and you try to use it like: catModel.setSelectedCategory(selectedCategory); Which is the reason for NullPointerException. If you initialize it or inject it (whatever your business need is), you should be able to resolve the issue.
answers question: http://stackoverflow.com/q/26947846
score: 0
type: Answer

http://stackoverflow.com/comment/42443297
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26951144
score: 1
has text: are you adding permissions to your manifest? if answer is yes, then post your code!

http://stackoverflow.com/a/26922358
answers question: http://stackoverflow.com/q/26922306
has comment: http://stackoverflow.com/comment/42392422
has comment: http://stackoverflow.com/comment/42392376
has comment: http://stackoverflow.com/comment/42392398
score: 0
has body: You are iterating inputs, but testing clients. This is why I prefer to use a for-each loop and I suggest you use a StringBuilder to build a single message and then display it once. Something like, public static void printA(ABC[] inputs) { StringBuilder sb = new StringBuilder(); for (ABC input : inputs) { if (input instanceof A) { sb.append(input).append(System.lineSeparator()); } } JOptionPane.showMessageDialog(null, sb.toString().trim()); } Edit The output you're getting ("LClient;@20d9896e") is because you are displaying inputs.toString(). Array doesn't override toString(), you can use Arrays.toString(Object[]) like String msg = Arrays.toString(inputs); But you'll get all of the items in the array. Also, make sure Client overrides toString().
has comment: http://stackoverflow.com/comment/42392346
type: Answer
has comment: http://stackoverflow.com/comment/42392484

http://stackoverflow.com/q/26836955
type: Question
has body: This is bit of a long winded question so stick with me... I'm trying to read a binary file that has the layout of a database with rows of records. There is a two byte integer that indicates the start of a new row/record. What I know about the file is: It has the following labels with their maximum length associated with it NAME_LENGTH = 32; LOCATION_LENGTH = 64; SPECIALTIES_LENGTH = 64; SIZE_LENGTH = 6; RATE_LENGTH = 8; OWNER_LENGTH = 8; There is also a header which occupies the first 72 bytes (identified this with a hex editor but we skip this, so I start reading at byte 72). With this in mind it was my limited understanding that I could read the total number of bytes each value can contain into a variable. If for example the name was "John" the first four bytes would represent the name John and the remainder would be white space. I then assumed I could go on to read the next chunk of bytes getting the next value. I put together a method to do just that private Contract retrieveContract(long locationInFile) throws IOException { final byte[] input = new byte[Contract.RECORD_LENGTH]; synchronized (database) { database.seek(locationInFile); database.readFully(input); } class RecordFieldReader { private int offset = 0; String read(int length) throws UnsupportedEncodingException { String str = new String(input, offset, length, "UTF-8"); offset += length; return str.trim(); } } RecordFieldReader readRecord = new RecordFieldReader(); String name = readRecord.read(Contract.NAME_LENGTH); String location = readRecord.read(Contract.LOCATION_LENGTH); String specialties = readRecord.read(Contract.SPECIALTIES_LENGTH); String size = readRecord.read(Contract.SIZE_LENGTH); String rate = readRecord.read(Contract.RATE_LENGTH); String owner = readRecord.read(Contract.OWNER_LENGTH); return "DELETED".equals(name) ? null : new Contract(name, location, specialties, size, rate, owner); } With the values of Contract.x being as described below in a separate class (The overall goal here is to…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26837104
accepted answer: http://stackoverflow.com/a/26837104
upvote count: 1
answer count: 1
tagged with: randomaccessfile
favorite count: 0
has title: Making sense of binary files
type: AnsweredQuestion
tagged with: binary
downvote count: 0

http://stackoverflow.com/comment/42355071
has text: This link should help you. http://rcs34-android.blogspot.com/2012/09/memory-leak-when-setting-drawable-from.html
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26899169

http://stackoverflow.com/comment/42463255
type: Comment
comment on: http://stackoverflow.com/q/26962569
score: 1
has text: u should start by practicing with "hello world" program
type: QuestionComment

http://stackoverflow.com/comment/42396891
type: AnswerComment
comment on: http://stackoverflow.com/a/26858179
type: Comment
has text: OK, you can do that, And please accept this answer, if it helps you.
score: 0

http://stackoverflow.com/q/26961513
answer count: 1
tagged with: websocket
accepted answer: http://stackoverflow.com/a/26969673
tagged with: java-8
has body: I consider if it's possible to replace Oracle JDK with OpenJDK to build and run my application. It uses Java 8 WebSocket communination. Does OpenJDK / OpenJFX VM fully support WebSockets as Oracle JVM does?
type: AnsweredQuestion
tagged with: java
has title: does openjdk/openjfx fully support WebView (WebSockets)?
tagged with: webview
type: Question
has answer: http://stackoverflow.com/a/26969673
score: 0

http://stackoverflow.com/q/26924799
type: Question
type: AnsweredQuestion
score: 7
tagged with: sorting
tagged with: date
possible better answer: http://stackoverflow.com/a/26924921
tagged with: jtable
answer count: 3
accepted answer: http://stackoverflow.com/a/26925965
has answer: http://stackoverflow.com/a/26924921
has title: Invalid sorting on Date in JTable
downvote count: 0
favorite count: 0
has body: Please have a look at the below code import java.awt.*; import java.awt.event.*; import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.table.*; public class TableBasic extends JFrame { public TableBasic() { String[] columnNames = {"Date", "String", "Long", "Boolean"}; Object[][] data = { {getJavaDate("13-11-2020"), "A", new Long(1), Boolean.TRUE }, {getJavaDate("13-11-2018"), "B", new Long(2), Boolean.FALSE}, {getJavaDate("12-11-2015"), "C", new Long(9), Boolean.TRUE }, {getJavaDate("12-11-2015"), "D", new Long(4), Boolean.FALSE} }; final JTable table = new JTable(data, columnNames); table.setPreferredScrollableViewportSize(table.getPreferredSize()); table.setAutoCreateRowSorter(true); table.getColumnModel().getColumn(0).setCellRenderer(tableCellRenderer); // DefaultRowSorter has the sort() method DefaultRowSorter sorter = ((DefaultRowSorter)table.getRowSorter()); ArrayList list = new ArrayList(); list.add( new RowSorter.SortKey(0, SortOrder.DESCENDING) ); sorter.setSortKeys(list); sorter.sort(); JScrollPane scrollPane = new JScrollPane( table ); getContentPane().add( scrollPane ); } private TableCellRenderer tableCellRenderer = new DefaultTableCellRenderer() { SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy"); public Component getTableCellRendererComponent(JTable table,Object value, boolean isSelected, boolean hasFocus,int row, int column) { if( value instanceof Date) { value = f.format(value); } return super.getTableCellRendererComponent(table, value, isSelected,hasFocus, row, column); } }; private Date getJavaDate(String s) { try { SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy"); Date d = sdf.parse(s); return d; } catch (ParseException ex) { Logger.getLogger(TableBasic.class.getName()).log(Level.SEVERE, null, ex); return null; } } public static void main(String[] args) { TableBas…
has answer: http://stackoverflow.com/a/26926012
tagged with: java
has answer: http://stackoverflow.com/a/26925965
tagged with: swing
upvote count: 7

http://stackoverflow.com/comment/42305490
has text: That has worse complexity than @Makoto's. Each `List.contains()` is `O(n)`, and you perform `O(m)` of them, so that's `O(nm)`. It should get the right answer, though, modulo order of elements.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26873723
type: Comment

http://stackoverflow.com/a/26938832
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26936150
answers question: http://stackoverflow.com/q/26936150
has body: Based on your question, I assume you are not using Spring. Commonly, you would configure CXF web services as part of the Spring context. Given this, you will want to use the CXF servlet transport and then publish the endpoint in a class that extends the CXF class CXFNonSpringServlet. In that class, you will need to write code similar to the following for publishing the endpoint: @Override public void loadBus(ServletConfig servletConfig) throws ServletException { super.loadBus(servletConfig); // You could add the endpoint publish codes here Bus bus = cxf.getBus(); BusFactory.setDefaultBus(bus); Endpoint.publish("/Greeter", new GreeterImpl()); // You can als use the simple frontend API to do this ServerFactoryBean factory = new ServerFactoryBean(); factory.setBus(bus); factory.setServiceClass(GreeterImpl.class); factory.setAddress("/Greeter"); factory.create(); } I retrieved this from the following link on CXF's website: http://cxf.apache.org/docs/servlet-transport.html
type: Answer

http://stackoverflow.com/q/26867013
favorite count: 0
has title: Hiveserver2 not responding
has comment: http://stackoverflow.com/comment/42293538
linked to: http://stackoverflow.com/q/15415904
upvote count: 2
has answer: http://stackoverflow.com/a/27126748
type: UnansweredQuestion
has body: I have a hiveserver(hiveserver2) running on port 10000. If I run command: netstat -nl | grep 10000 I get: tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN so the server is up and running. My hive-site.xml settings: hive.server2.thrift.port 10000 My code: public class ThriftAgent { private static final String HOST = "localhost"; private static final int PORT = 10000; public static void main(String[] args) throws Exception { TSocket transport = new TSocket(HOST, PORT); transport.open(); TBinaryProtocol protocol = new TBinaryProtocol(transport); Client client = new ThriftHive.Client(protocol); client.execute("show tables"); final List<String> results = client.fetchAll(); for (String result : results) { System.out.println(result); } transport.close(); } } I have tried different URL combos but it freezes at client.execute() and does not go any further than that. It does not throw any exceptions either. I have also tried to disable authentication but that did not help either as per thread Requests hang when using Hiveserver2 Thrift Java client If I connect through JDBC to same host it works. Also if I start HiveServer (not hiveserver2) it works so something is fishy with hiveserver2.
tagged with: hive
type: Question
tagged with: java
tagged with: thrift
tagged with: hadoop
answer count: 2
score: 2
has answer: http://stackoverflow.com/a/26997105
downvote count: 0

http://stackoverflow.com/q/26857601
has body: I Have run into a brickwall and I'm not sure how to continue. Quick Rundown: My code is suppose to turn 4 Strings of Hexadecimals(ramError1-4) to Binary, manually. I Want to be able to loop 4 times and each time create a unique StringBuilder to continue to the next step. I have tried over and over again the past two days to get it to work without success. Any advice would be appreciated. This is my code without my failed loops. Hex2 works as a test, but I want to be able to loop through HexCodes 1-4(ramError1-4) So how do I loop through Hex1-4 while creating a StringBuilder? Note: ramErrors1-4 do have strings in them I added earlier in the code by reading a file. String Hex1=ramError1; String Hex2=ramError2; String Hex3=ramError3; String Hex4=ramError4; StringBuilder hexstring1 = new StringBuilder(); StringBuilder hexstring2 = new StringBuilder(); StringBuilder hexstring3 = new StringBuilder(); StringBuilder hexstring4 = new StringBuilder(); for (int x = 0; x &lt;= 8; x++) { if (Hex2.charAt(x) == 'A') { hexstring1.append("1010"); } else if (Hex2.charAt(x) == 'B') { hexstring1.append("1011"); } else if (Hex2.charAt(x) == 'C') { hexstring1.append("1100"); } else if (Hex2.charAt(x) == 'D') { hexstring1.append("1101"); } else if (Hex2.charAt(x) == 'E') { hexstring1.append("1110"); } else if (Hex2.charAt(x) == 'F') { hexstring1.append("1111"); } else if (Hex2.charAt(x) == '0') { hexstring1.append("0000"); } else if (Hex2.charAt(x) == '1') { hexstring1.append("0001"); } else if (Hex2.charAt(x) == '2') { hexstring1.append("0010"); } else if (Hex2.charAt(x) == '3') { hexstring1.append("0011"); } else if (Hex2.charAt(x) == '4') { hexstring1.append("0100"); } else if (Hex2.charAt(x) == '5') { hexstring1.append("0101"); } else if (Hex2.charAt(x) == '6') { hexstring1.append("0110"); } else if (Hex2.charAt(x) == '7') { hexstring1.append("0111"); } else if (Hex2.charAt(x) == '8') { hexstring1.append("1000"); } else if (Hex2.charAt(x) == '9') { hexstring1.append("1001"); } else { …
tagged with: charat
has title: Java - Looping and StringBuilders
score: 0
answer count: 2
type: UnansweredQuestion
tagged with: append
has answer: http://stackoverflow.com/a/26857666
tagged with: java
tagged with: loops
type: Question
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/26857671

http://stackoverflow.com/a/26922748
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26921011
score: 1
answers question: http://stackoverflow.com/q/26921011
has body: First of all, I understand that the goal for this project is to start a service in the background without starting an activity. To do this you have a few options. Create a custom Application class and call startService() from there. Link to example. Create a broadcastReciever, which gets called when certain events occur, for example you can create a broadcastReciever that gets called when the phone is turned on. Link to example.
type: AcceptedAnswer

http://stackoverflow.com/a/26915505
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26915167
score: 0
type: Answer
has body: Your first problem is that you have a variable and a method named the same, this will confuse you on usage. It isn't a technical problem for the code, but it is a problem for anyone reading the code. I think you probably intend something like this. You need to call the method and pass the arguments it requires. Since you have methods for obtaining the other values, you should gather those first. This will make your code function, but could be better structured. public static void run (Scanner input) { int row = lengthRow(input); int column = lengthColumn(input); int result = maxValue(userMatrix(input, row, column)); System.out.println("The largest value in the given Matrix is: " + result); } I'll leave it as an exercise for the reader to make it even better.
has comment: http://stackoverflow.com/comment/42412492
accepted answer of: http://stackoverflow.com/q/26915167

selenium-chromedriver
tags question: http://stackoverflow.com/q/26975743
tags question: http://stackoverflow.com/q/26852924
tag name: selenium-chromedriver
type: Tag

http://stackoverflow.com/comment/43195862
score: 0
has text: If any of the below answers solves your problem, please accept it. This way the correct answer floats up and you and the answerer are awarded with some reputation that can let you use SO more effectively.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26858239

http://stackoverflow.com/q/26860011
answer count: 4
tagged with: jira-rest-java-api
tagged with: java
has body: I am writing a Java service to access JIRA. And I am using jira-rest-java-client. But I am unable to resolve the error in the pom file for the jira-rest-java-client dependency. So I added the JAR explicitly in the build path but the error in pom file exists. Also, my maven settings are such that it is trying to download the artifacts from my org's artifact repository but looks like it is not having any JIRA/Atlassian dependencies there. Can someone please tell what is it I am doing wrong? How can I fix this?
tagged with: jira
type: Question
score: 0
has answer: http://stackoverflow.com/a/55412493
has answer: http://stackoverflow.com/a/37982989
tagged with: jira-rest-api
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/39093280
has answer: http://stackoverflow.com/a/27037995
has title: Unable to resolve jira-rest-java-client dependency

http://stackoverflow.com/a/26941714
answers question: http://stackoverflow.com/q/26941544
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26941544
has body: Then how can the variable be resolved on those older devices when the app runs this code? Simple: there is no variable. Build.VERSION_CODES.LOLLIPOP is a static final int. The javac-generated bytecodes will inline the int value when you reference Build.VERSION_CODES.LOLLIPOP, rather than doing the lookup for that value at runtime. Since the bytecodes contain the int, your APK contains the int, and therefore you are not dependent upon the device's edition of the framework to supply the int to you. Build.VERSION.SDK_INT is not a static final int, and therefore that value is looked up at runtime.
has comment: http://stackoverflow.com/comment/42431680
type: Answer
score: 13
upvote count: 13
downvote count: 0

http://stackoverflow.com/comment/42432248
comment on: http://stackoverflow.com/q/26944681
type: Comment
type: QuestionComment
has text: echo $PATH shows /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/andrew/globals/bin
score: 0

http://stackoverflow.com/comment/42466077
type: Comment
comment on: http://stackoverflow.com/a/26962097
score: 0
type: AnswerComment
has text: I do not see a case when it will not give me 0. Only exception will be zero for which we should always check the condition

http://stackoverflow.com/a/26974079
has comment: http://stackoverflow.com/comment/42527803
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/74450178
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42525077
score: 1
answers question: http://stackoverflow.com/q/26973871
downvote count: 0
has body: As Peter mentioned, jars are not ignored due to your .gitignore file; I guess the jars are ignored due to a .gitignore file located in a parent directory of your project directory. Can that be the case ? Anyhow, if that is the case, you can try using a negation in your .gitignore file, something like: !**/*.jar In that way, you override rules from a .gitignore file in one of the parent dirs.
accepted answer of: http://stackoverflow.com/q/26973871
has comment: http://stackoverflow.com/comment/74450207

http://stackoverflow.com/comment/42459244
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26959666
score: 0
has text: `equals("19")`. It will equal `equals("\n19")`.

http://stackoverflow.com/comment/42353918
score: 1
has text: Yes, but you shouldn't do it, it's bad design and difficult to follow. Instead focus on how you might be able to re-use the functionality you are trying to achieve...
comment on: http://stackoverflow.com/q/26900743
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42266846
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26847749
has text: Thank you, it worked. Why lower case hh and what is kk?

http://stackoverflow.com/comment/42569088
type: AnswerComment
type: Comment
score: 0
has text: Thank you very much Alex i used your update above in the environment list and it worked. thank you very much :)
comment on: http://stackoverflow.com/a/26977561

http://stackoverflow.com/a/26870742
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26870577
type: Answer
has body: Either the passed in instance is of type A&lt;E&gt;, in which case you can copy it, or it's not, in which case you can't copy it into an instance of type A&lt;E&gt;. There's therefore no point in allowing A&lt;?&gt; as the type of the input: you should restrict it to A&lt;E&gt;. Actually you might restrict it to A&lt;? extends E&gt;, because these are still compatible with E. Trying to replicate anything else into here isn't meaningful, any more than a HashSet constructor can take a copy parameter of type int[].
accepted answer of: http://stackoverflow.com/q/26870577
upvote count: 5
score: 5

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

http://stackoverflow.com/comment/42470903
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26966960
has text: Can you post the two blocks of code? Do they yield values?

http://stackoverflow.com/comment/127516413
type: Comment
comment on: http://stackoverflow.com/a/30468962
score: 3
has text: It is a bad design decision, we have made a [different design decision for Java Card](https://docs.oracle.com/javacard/3.0.5/api/javacardx/crypto/AEADCipher.html) (where buffering is of course even more expensive, and it also removed over 30% of the code when I tried it on Bouncy Castle code (!)). Couldn't have written a better answer myself.
type: AnswerComment

http://stackoverflow.com/a/26931513
answers question: http://stackoverflow.com/q/26930651
score: 0
has body: I believe you would have the beginnings of this from Netbeans, correct? /** * @param args the command line arguments */ public static void main(String args[]) { ... some stuff here automatically created by Netbeans (leave it). /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { //enter initialization code here Main mainWindow = null; try { //enter more initialization code here mainWindow = new Main(); } catch (IOException ex) { System.exit(1); } //enter even more initialization code here mainWindow.setVisible(true); } }); } Of course, edit as you like. I would highly recommend that you DO use Netbeans automated features, especially if you're new at creating your own GUIs. Copy and paste your code from your command line app right into this automated main. Hope that helps.
type: Answer

http://stackoverflow.com/a/26843248
score: 10
upvote count: 10
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/67406125
accepted answer of: http://stackoverflow.com/q/26841349
downvote count: 0
answers question: http://stackoverflow.com/q/26841349
has body: First of all, the name for the feature is not "hot deploy" but HotSwap. It is a feature of JVM and not of an IDE. IDEs just automate the process and trigger the HotSwap of the changed class automatically when there's a new version of the class available. HotSwap is limited only to the changes that can be made to a body of an existing method. In IntelliJ, go to Settings->Debugger->HotSwap and check the settings: Enable Reload classes in background checkbox and then you can choose the behaviour, should the IDE ask you about hotswapping the classes, hotswap silently, or never hotswap the classes. You do have to compile manually. But, if the application is deployed from an "artifact", then "Make project automatically" works for the running application even though it says the opposite (Settings -> Compiler). The inconvenience though is that automatic compilation triggers with a delay, so it is not as instant as one would expect. Compiling manually is just as simple as pressing CTRL+S in Eclipse, just CTRL+F9/CMD+F9 to make the project (which is actually incremental) or CTRL+SHIFT+F9/CMD+SHIFT+F9 if you want to compile a single file. I'd still recommend JRebel for improving the experience since it goes far beyond what HotSwap can do and it integrates with a large number of Java frameworks to eliminate redeploys. And yes, I'm biased - I work for ZeroTurnaround and I'm involved with JRebel development. UPDATE: The initial question was rather more about the automatic redeployment of the web app in Tomcat/IntelliJ In Run configuration, you can configure, what should be done for the 'Update' action: The 'Update' action is invoked manually. CTRL+SHIFT+A/CMD+SHIFT+A, and search for 'Update': So, redeployment is a rather "one-click" manual process in IntelliJ.

http://stackoverflow.com/q/26845769
tagged with: java
has title: Error "Source file does not exist" during building build.xml
has comment: http://stackoverflow.com/comment/42255488
type: Question
has comment: http://stackoverflow.com/comment/42265905
has body: I am running ant and get error: build.xml:1004: Source file does not exist! on 1004 string I see: <macrodef name="run-sql-file"> <attribute name="file.name"/> <attribute name="user"/> <attribute name="password"/> //it's 1004 string How can I understand what file needs for ant? Thanks. edit1. 1045 string: <target name="sql" depends="drop-all-tables, drop-all-sequences"> <echo message="Purging 10g recyclebin"/> <sql-query sql="PURGE RECYCLEBIN" user="${ds_username}" password="${ds_password}"/> <run-sql-file file.name="${data}/ddl/tables.jdbc.sql" user="${ds_username}" password="${ds_password}"/> //1045
tagged with: ant
score: 0
has comment: http://stackoverflow.com/comment/42256738
has comment: http://stackoverflow.com/comment/42255854
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26922756
type: Answer
answers question: http://stackoverflow.com/q/26920650
has body: Try this double[] sfAttributes = new double[3]; double[] simLinksAttributes = {0.1, 0.5, 0.8}; // array with values double sfClass = 0.0d; double simLinkClass = 1.0d; // the double variable! int iter = 3; // amout of iterations // set the first iteration value for (int i = 0; i &lt; simLinksAttributes.length; i++) { sfAttributes[i] = simLinksAttributes[i] + (simLinkClass * 0.333); // here, sum all values of the simLinkAttributes[i] // and put the results in sfClass variable sfClass += simLinksAttributes[i]; } double[] sfNewAttributes = sfAttributes; sfClass = (sfClass + simLinkClass); System.out.println(sfClass); // here starts the iterations. for (int i = 0; i &lt; iter; i++) { for (int j = 0; j &lt; simLinksAttributes.length; j++) { sfNewAttributes[j] = sfNewAttributes[j] + (sfClass * 0.333); } for (int k =0 ; k &lt; sfNewAttributes.length; k++) { sfClass += sfNewAttributes[k]; } System.out.println(sfClass); }
score: 0

http://stackoverflow.com/q/26854204
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42271054
tagged with: gradle
has title: Gradle: How to remove class files after compilation
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42272034
favorite count: 0
tagged with: android
has body: I am trying to figure out how to remove java class files that I only needed for compile time in Gradle. In other words, I only want a certain class to be used for the compilation step, but to not be included in the jar package. In this case, I'm talking about a BuildConfig.java class that I need to remove from my library project because I have another one defined in my application project with the same namespace. Thanks in advance!
has answer: http://stackoverflow.com/a/57236260
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/42270947
has answer: http://stackoverflow.com/a/26856983

http://stackoverflow.com/q/26833707
has body: While studying from the pdf presentation of the lesson, i usually try and compile a lot of the examples given, often i rewrite all of it by myself, so it's also a memorization exercise. However in this case, i don't seem able to compile something that i copy-pasted; then i proceeded to rewrite it all by myself and it worked. I don't know if it's a bug or something that i'm missing. i'll leave the code here and the terminal error. btw i'm on osx lion and i'm using textwrangler as an editor and the terminal for compiling. import java.lang.Math; public class Radice { public static void main(String[] args) { double r = Math.sqrt(2); double x = r * r; if (x==2) System.out.println("OK"); else System.out.println("Non ci credevi?"); } } ￼ import java.lang.Math; public class Radice2 { public static void main(String[] args) { double r = Math.sqrt(2); double x = r * r; if (x==2) System.out.println("OK"); else System.out.println("Non ci credevi?"); } } only Radice2 work. here's the log iMac-di-alessio:~ alessiobogesso$ cd Desktop/ iMac-di-alessio:Desktop alessiobogesso$ java Radice2 Non ci credevi? iMac-di-alessio:Desktop alessiobogesso$ javac Radice.java Radice.java:16: error: illegal character: \65532 ^ Radice.java:16: error: reached end of file while parsing ^ 2 errors iMac-di-alessio:Desktop alessiobogesso$ thanks for your help
has comment: http://stackoverflow.com/comment/42235417
type: Question
has title: Two identical programs, only one compiles (java7)
tagged with: copy
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42233793
has answer: http://stackoverflow.com/a/26833730
has comment: http://stackoverflow.com/comment/42233767
type: UnansweredQuestion
tagged with: paste
tagged with: java

http://stackoverflow.com/comment/42269598
type: QuestionComment
has text: `shouldn't the named elements change as well?` No, they shouldn't. `boolean` is a primitive java type. It means that a boolean variable does not store a reference to the boolean value, but the value itself. When you make this: `{energetic, calming, happy, sad}` you are copying the value of these four boolean variables to the array, but no the reference to them. So, they are different. If you were handling with *objects*, instead of a *primitive type*, then the reference would not be lost and your code would work.
comment on: http://stackoverflow.com/q/26853413
score: 3
type: Comment

http://stackoverflow.com/a/26934810
score: -1
has body: for (int k = 0; k&lt;3, k++){ for (int i = 0; i&lt; 10; i++) { for (int j = 0; j &lt; 3;j++) { System.out.println(i); } } System.out.println("")}; } }
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/26934678
upvote count: 0
has comment: http://stackoverflow.com/comment/42414656

junit
tags question: http://stackoverflow.com/q/26836448
type: Tag
tags question: http://stackoverflow.com/q/26833139
tags question: http://stackoverflow.com/q/26864305
tags question: http://stackoverflow.com/q/26883497
tags question: http://stackoverflow.com/q/26873120
tags question: http://stackoverflow.com/q/26889501
tags question: http://stackoverflow.com/q/26884309
tags question: http://stackoverflow.com/q/26983926
tags question: http://stackoverflow.com/q/26844722
tags question: http://stackoverflow.com/q/26932778
tags question: http://stackoverflow.com/q/26857448
tags question: http://stackoverflow.com/q/26842914
tags question: http://stackoverflow.com/q/26868226
tags question: http://stackoverflow.com/q/26916117
tags question: http://stackoverflow.com/q/26932394
tags question: http://stackoverflow.com/q/26854277
tags question: http://stackoverflow.com/q/26965683
tags question: http://stackoverflow.com/q/26882936
tag name: junit
tags question: http://stackoverflow.com/q/26896688
tags question: http://stackoverflow.com/q/26873889
tags question: http://stackoverflow.com/q/26865828
tags question: http://stackoverflow.com/q/26871881
tags question: http://stackoverflow.com/q/26945427
tags question: http://stackoverflow.com/q/26844501
tags question: http://stackoverflow.com/q/26856094
tags question: http://stackoverflow.com/q/26931705
tags question: http://stackoverflow.com/q/26865253
tags question: http://stackoverflow.com/q/26876237
tags question: http://stackoverflow.com/q/26857885
tags question: http://stackoverflow.com/q/26870177
tags question: http://stackoverflow.com/q/26920040
tags question: http://stackoverflow.com/q/26916997
tags question: http://stackoverflow.com/q/26901613
tags question: http://stackoverflow.com/q/26890878
tags question: http://stackoverflow.com/q/26869641
tags question: http://stackoverflow.com/q/26924372
tags question: http://stackoverflow.com/q/26848673
tags question: http://stackoverflow.com/q/26865292
tags question: http://stackoverflow.com/q/26980182
tags question: http://stackoverflow.com/q/26864944
tags question: http://stackoverflow.com/q/26906186
tags question: http://stackoverflow.com/q/26908684
tags question: http://stackoverflow.com/q/26887556
tags question: http://stackoverflow.com/q/26914417
tags question: http://stackoverflow.com/q/26945891
tags question: http://stackoverflow.com/q/26847237
tags question: http://stackoverflow.com/q/26864477
tags question: http://stackoverflow.com/q/26965947
tags question: http://stackoverflow.com/q/26979620

http://stackoverflow.com/a/26852769
type: Answer
answers question: http://stackoverflow.com/q/26852140
has comment: http://stackoverflow.com/comment/42268158
has body: your problem is your constructor: public TrueFalseQuestion(String qu, boolean b){ super(qu); } You don't set the field CorrectB so it defaults to its default value which in java is false the fix is public TrueFalseQuestion(String qu, boolean b){ super(qu); CorrectB = b; }
accepted answer of: http://stackoverflow.com/q/26852140
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/26963894
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26963673
answers question: http://stackoverflow.com/q/26963673
score: 2
upvote count: 2
has body: The issue is with the structure of the program. You are calling UserGuess(); UserHighGuess(); UserLowGuess(); UserEquals(); What if the number was 50, and the user guessed 30? We'd be in the body of UserLowGuess(). Then imagine the user entered 55. The UserLowGuess() would be broken out of as the userNumber is greater than the compNumber. So then, you would be in UserEquals. But since 55 is not equal to 50, the if statement will not be entered and the program will exit.
type: AcceptedAnswer

http://stackoverflow.com/q/26933411
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26933654
tagged with: java
has answer: http://stackoverflow.com/a/26933654
type: Question
has answer: http://stackoverflow.com/a/26934134
tagged with: jpanel
score: 0
has body: I have been working on this program and I am having a hard time getting the result to show on the window that pops up. I have the correct output showing in the console when the program is ran but I need it to show up in the window under the radio buttons when the radio button is selected. Thanks in advance, any help is greatly appreciated. import TrySource.TryWindow; import java.awt.BorderLayout; import java.awt.Color; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.Arrays; import java.util.Random; import javax.swing.*; public class TrySomethingNew extends JFrame { // Radio buttons for selecting colors private JRadioButton jrbMexican, jrbItalian; JLabel jlblResult; // Declare a panel for displaying message private TryWindow TryWindow; // Main method public static void main(String[] args) { TrySomethingNew frame = new TrySomethingNew(); frame.pack(); frame.setSize(500,500); frame.setTitle("Try Something New"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); // Center the frame frame.setVisible(true); } public TrySomethingNew() { // Create a MovingMessageCanvas instance and set colors TryWindow = new TryWindow("Let's try this."); TryWindow.setBackground(Color.WHITE); // Panel to hold radio buttons JPanel jpRadioButtons = new JPanel(); jpRadioButtons.setBorder(new javax.swing.border.TitledBorder("Select A Food Genre")); jpRadioButtons.add(jrbMexican = new JRadioButton("Mexican")); jpRadioButtons.add(jrbItalian = new JRadioButton("Italian")); // Group radio buttons ButtonGroup btg = new ButtonGroup(); btg.add(jrbMexican); btg.add(jrbItalian); //Panel to hold result JPanel jpResultPanel = new JPanel(); jpResultPanel.setBorder(new javax.swing.border.TitledBorder("Result")); // Place panels in the frame setLayout(new BorderLayout()); add(TryWindow, BorderLayout.CENTER); add(jpRadioButtons, BorderLayout.NORTH); add(jpResultPanel, BorderLayout.CENTER); // Register listeners with the buttons jrbMex…
answer count: 2
has comment: http://stackoverflow.com/comment/42411714
has title: How to pass list string to JLabel and show in JFrame
accepted answer: http://stackoverflow.com/a/26934134
tagged with: jlabel
tagged with: jframe

http://stackoverflow.com/a/26858924
accepted answer of: http://stackoverflow.com/q/26858316
answers question: http://stackoverflow.com/q/26858316
type: AcceptedAnswer
score: 0
type: Answer
has body: You should have a main method to run your program, so change the signature of the method to this: public static void main(String[] args)throws IOException As the method signature has changed you have to modify the method call to this main method in your methods read() and write() like this: main(null) By doing these changes your program works without any issues. Finally, just a suggestion, the read() method is actually doing write operation where as the write() is performing read operation. So change the name of the methods and also similarly change the code in your main() method so that it calls read and write methods properly.

http://stackoverflow.com/comment/42416131
score: 0
has text: The code I have is Irrelevant, and the second suggestion I'm checking.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26935595

http://stackoverflow.com/comment/42517501
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26990902
type: Comment
has text: so, i wonder is a heap buffer of 17MB too much for some devices to handle? do i have to split the bytes and handle them seperately?

sfml
tag name: sfml
tags question: http://stackoverflow.com/q/26986983
type: Tag

http://stackoverflow.com/a/26978301
type: Answer
answers question: http://stackoverflow.com/q/26975967
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26975967
score: 3
type: AcceptedAnswer
downvote count: 0
has body: I found the cause of the problem. The problem was that this was not supproted from android if the hardware accelaration was enabled. After disabling the hardware accelaration the scaling was working fine. view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); For more information about this, see the google site: http://developer.android.com/guide/topics/graphics/hardware-accel.html

http://stackoverflow.com/comment/42257842
type: QuestionComment
comment on: http://stackoverflow.com/q/26847457
score: 1
type: Comment
has text: Instead of getView().findViewById try to use rootView.findViewById

http://stackoverflow.com/q/26935903
has answer: http://stackoverflow.com/a/26935951
accepted answer: http://stackoverflow.com/a/26935951
favorite count: 0
has comment: http://stackoverflow.com/comment/42416209
linked to: http://stackoverflow.com/q/513832
tagged with: http://stackoverflow.com/tag/html
tagged with: jdbc
has comment: http://stackoverflow.com/comment/42416296
has comment: http://stackoverflow.com/comment/42416253
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42451945
possible better answer: http://stackoverflow.com/a/26938299
tagged with: java
has answer: http://stackoverflow.com/a/26938299
score: -1
tagged with: mysql
has title: String Comparison not working in Java
type: Question
answer count: 2
downvote count: 2
upvote count: 1
has body: Here is my code : Why is the if ((rs.getString("order_status")) != ordstat) not working? String sql = "select order_id, order_dt, order_status, prod_name from orders where user_id = '"+user+"'"; try{ s = con.createStatement(); rs = s.executeQuery(sql); String ordstat = "Pending"; %> <% while( rs.next() ){ if ((rs.getString("order_status")) != ordstat){ %> Select Order ID Name Date Status <%= rs.getString("order_id") %> <%= rs.getString("prod_name") %> <%= rs.getString("order_dt") %> <%= rs.getString("order_status") %> <% } } %> <% }
has comment: http://stackoverflow.com/comment/42416138

http://stackoverflow.com/a/26844863
answers question: http://stackoverflow.com/q/26844411
type: Answer
accepted answer of: http://stackoverflow.com/q/26844411
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42253157
upvote count: 2
has body: Instead of Response holding a Collection you could change that to Object. Then you could have different classes for each of your collection types. @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Transactions { @XmlElement(name="transaction") private List&lt;Transaction&gt; transactions; }
type: AcceptedAnswer

http://stackoverflow.com/q/26892799
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42339599
linked to: http://stackoverflow.com/q/2649213
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26893975
has body: public class Sample{ public static void main(String args[]){ System.out.println("/n Say hi 2 me"); } public class Hello{ public static void main(String args[]){ System.out.println("/n Hello!"); } } } I have run this code using Command Prompt but I was able to notice that modifier 'static' is used for only constant variable Declarations why????? please help me out in understanding this???
has answer: http://stackoverflow.com/a/26893048
tagged with: java
has comment: http://stackoverflow.com/comment/42339332
has title: what does the error statement define in the case of main method Overloading
type: Question

http://stackoverflow.com/a/41876106
has body: I had the same problem and I found one issue. I will try to explain in detail if someone else need it: First of all you have to check if your object 'dataSource' is typed = SQLiteDatabase, just like that : private SQLiteDatabase dataSource; and initialize your object before use it, like that : dataSource = this.getWritableDatabase();
type: Answer
answers question: http://stackoverflow.com/q/26855660
score: 0

http://stackoverflow.com/comment/42253650
type: QuestionComment
has text: `$> ./test.sh -t some.comman -extraswitch '"some addtional info"'` should do it
comment on: http://stackoverflow.com/q/26845314
type: Comment
score: 2

http://stackoverflow.com/comment/42299731
score: 0
type: AnswerComment
has text: If you want *"real time"* simulation, you just need to reassign X and Y values to same rectangle to redraw it and simulate animation.
comment on: http://stackoverflow.com/a/26870030
type: Comment

http://stackoverflow.com/q/26956815
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jframe
has answer: http://stackoverflow.com/a/26957559
has title: Java JFrame window is not updating
has comment: http://stackoverflow.com/comment/42453571
has comment: http://stackoverflow.com/comment/42452898
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42452956
has comment: http://stackoverflow.com/comment/42452929
score: 1
tagged with: java
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/42454040
has body: I've tried a lot of things but I still cannot figure it out. I have a List that contains "entities". I'm going trought all of these and rendering them. This works perfectly fine. The problem is that when I remove one object (entity) in this List from different thread. In this case the square (entity) won't disappear until I resize the window. private List&lt;Entity&gt; entities = new ArrayList&lt;Entity&gt;(); public void render(Graphics g, ImageObserver obs) { //This function is called from my game loop (few hundred times per second..) for (int i = 0; i &lt; entities.size(); i++) { entities.get(i).render(); //Calling the render function in the entity class } } public void removeEntity(int index) { //This function is called from different thread entities.remove(index); //Removing entity from the list }
type: Question
accepted answer: http://stackoverflow.com/a/26957559
has comment: http://stackoverflow.com/comment/42453735
has comment: http://stackoverflow.com/comment/42453391

http://stackoverflow.com/comment/42488588
has text: Okay, the problem was solved by following this example http://stackoverflow.com/a/6329560/2804903
score: 0
comment on: http://stackoverflow.com/q/26974354
type: Comment
type: QuestionComment

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

php
tags question: http://stackoverflow.com/q/26929673
tags question: http://stackoverflow.com/q/26904342
tags question: http://stackoverflow.com/q/26854564
tags question: http://stackoverflow.com/q/26836798
tags question: http://stackoverflow.com/q/26973339
tags question: http://stackoverflow.com/q/26948591
tags question: http://stackoverflow.com/q/26859554
tags question: http://stackoverflow.com/q/26972343
tags question: http://stackoverflow.com/q/26936025
tag name: php
tags question: http://stackoverflow.com/q/26904540
tags question: http://stackoverflow.com/q/26922991
tags question: http://stackoverflow.com/q/26978666
tags question: http://stackoverflow.com/q/26955595
tags question: http://stackoverflow.com/q/26833551
tags question: http://stackoverflow.com/q/26929352
tags question: http://stackoverflow.com/q/26883601
tags question: http://stackoverflow.com/q/26933954
tags question: http://stackoverflow.com/q/26953634
tags question: http://stackoverflow.com/q/26918803
tags question: http://stackoverflow.com/q/26841247
tags question: http://stackoverflow.com/q/26909541
tags question: http://stackoverflow.com/q/26867282
type: Tag

http://stackoverflow.com/comment/42276615
type: QuestionComment
has text: What IDE are you utilizing?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26857487

apache-camel
tags question: http://stackoverflow.com/q/26840213
tags question: http://stackoverflow.com/q/26900282
tags question: http://stackoverflow.com/q/26847993
tags question: http://stackoverflow.com/q/26838803
tags question: http://stackoverflow.com/q/26936150
tags question: http://stackoverflow.com/q/26926805
tags question: http://stackoverflow.com/q/26842909
tag name: apache-camel
tags question: http://stackoverflow.com/q/26865113
tags question: http://stackoverflow.com/q/26975394
tags question: http://stackoverflow.com/q/26972590
tags question: http://stackoverflow.com/q/26972021
tags question: http://stackoverflow.com/q/26914255
type: Tag

http://stackoverflow.com/q/26947911
has comment: http://stackoverflow.com/comment/42437715
has comment: http://stackoverflow.com/comment/42437892
accepted answer: http://stackoverflow.com/a/26947968
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42437686
has answer: http://stackoverflow.com/a/26948468
upvote count: 1
has comment: http://stackoverflow.com/comment/42437671
downvote count: 7
type: Question
has answer: http://stackoverflow.com/a/26948079
tagged with: java
has comment: http://stackoverflow.com/comment/42437987
has comment: http://stackoverflow.com/comment/42437634
has body: The Student Union is organising a student trip and they are determining how many cars are required. Prompt the user to enter the total number of students going on the trip. Then determine how many cars are required (5 to a car) and how many students are left without transport. import java.util.Scanner; class P2Trip { public static void main(String []args) { Scanner input = new Scanner(System.in); int students; int space = 5; int sum; System.out.println("How many students are going today?: "); students = input.nextInt(); sum =(students / space); System.out.println("Ammount of cars needed: " + sum); } }//code works fine, but im not sure how to get a remainder of students without a lift.
has answer: http://stackoverflow.com/a/26947968
possible better answer: http://stackoverflow.com/a/26947961
has comment: http://stackoverflow.com/comment/42437959
has answer: http://stackoverflow.com/a/26947961
has title: How to get a remainder in java
score: -6
favorite count: 0

http://stackoverflow.com/comment/42319229
comment on: http://stackoverflow.com/a/26881626
score: 0
type: Comment
has text: Important for you is "Classes are loaded on demand" , see some reasons behind this at http://mindprod.com/project/noclassdeffounderror.html
type: AnswerComment

http://stackoverflow.com/comment/42245449
has text: IMHO, the question is off-topic here. It fits better in http://networkengineering.stackexchange.com/
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26840514
score: 0

http://stackoverflow.com/comment/42506288
type: QuestionComment
comment on: http://stackoverflow.com/q/26986587
has text: It is not possible to get the object that way. It makes sense since two different objects can have the same hashcode but may not be equal. Hashset internally compares two objects with the equals method if their hashcode matches.
score: 0
type: Comment

http://stackoverflow.com/comment/42396969
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26924800
has text: This will print out "it doesn't exist" for *each* file that isn't the one the OP is looking for. It should print out "it exists" once, but it's still very misleading.
score: 0

jar-signing
tags question: http://stackoverflow.com/q/26942297
tag name: jar-signing
type: Tag

http://stackoverflow.com/comment/42371649
comment on: http://stackoverflow.com/q/26911003
has text: They do different things: one amends the list, another one returns another list. You can't compare them that way.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/101091566
has text: How would this work for local testing? I shouldn't have to force every poor developer to install docker and have the DynamoDBLocal image running and meticulously configured.
comment on: http://stackoverflow.com/a/53583725
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42633444
has text: So it turns out the XML file is too big for programs like XMLspy to create a schema out of it :( any other ideas?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26960505
type: Comment

http://stackoverflow.com/q/26964741
answer count: 1
has answer: http://stackoverflow.com/a/26965000
tagged with: arraylist
tagged with: android
linked to: http://stackoverflow.com/q/26966752
has body: I have a fragments that builds a songs ArrayList, i want to pass that ArrayList to the framgment's activity . I know i can use interface, but not sure how i could do it public class SongsListFragment extends Fragment { public interface passArrayList { public void onArticleSelected(Uri articleUri); // from android guide i don't know what to do } } Here is what i have so far, please let me know why im getting NullPointer on MainActivity @Override public void onFragmentSetSongs(ArrayList&lt;Song&gt; songs){ songsArrayList = songs; } @Override public void onSongListItemClick(int position) { musicService.setSong(position); Song playSong = songsArrayList.get(position); txtCurrentSongTitle.setText(playSong.getTitle()); txtCurrentSongTitle.requestFocus(); musicService.playSong(); btnPlayPause.setImageDrawable(getResources().getDrawable(R.drawable.ic_action_pause)); if (playbackPaused) { playbackPaused = false; } //setDownloaded(); } on Fragment OnFragmentInteractionListener songsCallBack; OnFragmentInteractionListener songsItemClick; public interface OnFragmentInteractionListener { public void onFragmentSetSongs(ArrayList&lt;Song&gt; s); public void onSongListItemClick(int position); } @Override public void onAttach(Activity activity) { super.onAttach(activity); // This makes sure that the container activity has implemented // the callback interface. If not, it throws an exception try { songsCallBack = (OnFragmentInteractionListener) getActivity(); songsItemClick = (OnFragmentInteractionListener) getActivity(); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnHeadlineSelectedListener"); } } @Override public void onDetach() { super.onDetach(); songsCallBack = null; songsItemClick= null; } listView = (ListView) root.findViewById(R.id.listViewSongs); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { songs…
type: AnsweredQuestion
has title: Pass Arraylist from fragment to its own Activity
tagged with: android-fragments
tagged with: java
accepted answer: http://stackoverflow.com/a/26965000
tagged with: listview
type: Question
score: 0

http://stackoverflow.com/comment/42492008
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26974875
has text: `ServletContextListener` only executed twice per app: when deployed and when undeployed. That's not the right tool. And a Filter is more suited to do this job since it allows you to review the data per request. Still, if you want to do this on less times, use `HttpSessionListener` instead.

http://stackoverflow.com/q/26976135
type: Question
has comment: http://stackoverflow.com/comment/42519308
tagged with: android-layout
tagged with: imageview
has title: Display TextView over ImageView in android
answer count: 2
has body: I want to display a text over an Image View. I do it like Alesqui suggested here: Android Text over image The preview in Android studio looks fine: But my actual result looks like this with the text unwantedly above: I have to add the following XML dynamically to a LinearLayout during the execution: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;ImageView android:id="@+id/myImageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/myImageSouce" /&gt; &lt;TextView android:id="@+id/myImageViewText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/myImageView" android:layout_alignTop="@+id/myImageView" android:layout_alignRight="@+id/myImageView" android:layout_alignBottom="@+id/myImageView" android:layout_margin="1dp" android:gravity="center" android:text="Hello" android:textColor="#000000" /&gt; &lt;/RelativeLayout&gt; I add it the following way: LinearLayout ll = (LinearLayout) findViewById(R.id.layout_story_covers); LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); for (int i = 0; i &lt; stories.size(); i++) { // add imageView RelativeLayout coverLayout = (RelativeLayout) inflater.inflate(R.layout.fragment_cover, null); ImageView imageView =(ImageView) coverLayout.findViewById(R.id.imageViewCover); TextView textView = (TextView) coverLayout.findViewById(R.id.textViewCover); textView.setText(stories.get(i).title); imageLoader.displayImage(stories.get(i).cover.fileUrl, imageView); ll.addView(coverLayout); } This must have something to do with that parent LinearLayout. What is the proper way to do get the result?
downvote count: 0
tagged with: textview
linked to: http://stackoverflow.com/q/5242951
has answer: http://stackoverflow.com/a/26976566
favorite count: 0
has answer: http://stackoverflow.com/a/26976190
linked to: http://stackoverflow.com/q/19995007
tagged with: android
score: 6
possible better answer: http://stackoverflow.com/a/26976566
has comment: http://stackoverflow.com/comment/42495183
upvote count: 6
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26976190

http://stackoverflow.com/comment/42595008
score: 0
type: Comment
has text: I already have test data in an excel csv file which I extract into the program. The 'testList' data is similar to a test review/log for each test, hence why it is created dynamically
comment on: http://stackoverflow.com/a/26944777
type: AnswerComment

http://stackoverflow.com/comment/42386397
type: QuestionComment
comment on: http://stackoverflow.com/q/26919013
has text: Should be of same type if you want to use `removeAll()`...
score: 0
type: Comment

http://stackoverflow.com/comment/42448959
comment on: http://stackoverflow.com/q/26954527
has text: Fixed it, that was just an error when i retyped it, not the actual problem, thanks.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26991207
tagged with: android
has body: Whenever I presses the button, it should change text, and also change boolean value, yet this is not working. Any help? Thnks Before onCreate: public boolean status = false; Button Click: case R.id.saveButton: if (status != true) { currentStatus.setText("Current status: In need of help!"); status = true; } if (status != false) { currentStatus.setText("Current status: Fine."); status = false; } break;
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42513891
tagged with: onclick
has comment: http://stackoverflow.com/comment/42514020
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42514299
has answer: http://stackoverflow.com/a/26991320
has comment: http://stackoverflow.com/comment/42514093
type: Question
has answer: http://stackoverflow.com/a/26991324
possible better answer: http://stackoverflow.com/a/26991419
has answer: http://stackoverflow.com/a/26991419
has comment: http://stackoverflow.com/comment/42513865
tagged with: boolean
tagged with: button
accepted answer: http://stackoverflow.com/a/26991320
has comment: http://stackoverflow.com/comment/42513907
has answer: http://stackoverflow.com/a/26991448
has title: Status not changing on button press
answer count: 5
has answer: http://stackoverflow.com/a/26991331

http://stackoverflow.com/a/26937538
upvote count: 1
has comment: http://stackoverflow.com/comment/42419356
downvote count: 1
has comment: http://stackoverflow.com/comment/42419792
has comment: http://stackoverflow.com/comment/42419377
has comment: http://stackoverflow.com/comment/42420191
score: 0
has comment: http://stackoverflow.com/comment/42419701
type: Answer
answers question: http://stackoverflow.com/q/26937409
has comment: http://stackoverflow.com/comment/42419714
has body: You need to change PrintWriter writer = new PrintWriter(newFileLocation); to PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(newFileLocation, true))) Little explanation: append meant to write it additively, on the contrary write overrides the existing file. In your code you are creating a new file including one of your wonders, but on next iteration the file is recreated. So the content of previous wonder is gone. With the change PrintWriter object is not recreating the file, instead it writes content to a BufferedWriter which also transfers the stream to an append able FileWriter object. Little suggest: do not create a PrintWriter object on each iteration. Second little suggest: You don't need PrintWriter. BufferedWriter itself is good enough as far as I see.

http://stackoverflow.com/comment/42472600
has text: You need to set your classpath.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26967975

http://stackoverflow.com/a/26874841
upvote count: 1
downvote count: 1
has body: In the for loop, you are checking if bytesRead != 1; in the while loop, you are checking if bytesRead != -1.
answers question: http://stackoverflow.com/q/26874776
type: Answer
score: 0

http://stackoverflow.com/q/26922774
has body: this must be a stupid question, but how to deserialize this? (using Gson) {"Requisitions":[129,127,124,46,40,39,38,37,36,35,34,33]}
score: 0
linked to: http://stackoverflow.com/q/18188364
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/42393042
has answer: http://stackoverflow.com/a/26923074
type: AnsweredQuestion
has title: Deserialize array of integers using gson
tagged with: java
accepted answer: http://stackoverflow.com/a/26923074
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42393298
type: Question
has comment: http://stackoverflow.com/comment/42393190

http://stackoverflow.com/a/26956077
answers question: http://stackoverflow.com/q/26955829
has body: in java an array is an object and objects are passed by reference so when you make change to the array in the method it will also effect the actual array
score: 0
type: Answer

http://stackoverflow.com/a/26873715
has comment: http://stackoverflow.com/comment/42305585
has body: You seem to be doing things the hard way. Here's about the shortest way to do what you asked: public void compararArrays(){ List&lt;String&gt; toAdd = new ArrayList&lt;String&gt;(viejo1); toAdd.removeAll(nuevo1); nuevo1.addAll(toAdd); } Note that that adds elements from viejo1 that are not initially present in nuevo1, but it may add such elements multiple times if there are duplicates in viejo1. To add at most one of each group of equal elements of viejo1, this should do the trick: public void compararArrays(){ for (String s : viejo1) { if (!nuevo1.contains(s)) { nuevo1.add(s); } } } Edited to add: To do this with O(n) efficiency, without removing any elements of nuevo1, putting all added elements at the end, and preserving their relative order, you can do this: public void compararArrays(){ LinkedHashSet&lt;String&gt; toAdd = new LinkedHashSet&lt;String&gt;(viejo1); toAdd.removeAll(nuevo1); nuevo1.addAll(toAdd); }
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42305785
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42305630
has comment: http://stackoverflow.com/comment/42305491
has comment: http://stackoverflow.com/comment/42305844
answers question: http://stackoverflow.com/q/26873105

http://stackoverflow.com/comment/42364071
score: 0
type: QuestionComment
has text: am using tomcat server and this is the url am using http://localhost:8080/Spring4MVCHelloWorld/WEB-INF/views/index.jsp
type: Comment
comment on: http://stackoverflow.com/q/26906789

http://stackoverflow.com/comment/42294631
has text: no, you're right of course in your answer. my 2 cents of code will work but the explanation isn't right. see here: http://stackoverflow.com/questions/40480/is-java-pass-by-reference-or-pass-by-value
type: Comment
comment on: http://stackoverflow.com/a/26867611
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42378412
type: Comment
comment on: http://stackoverflow.com/a/26890202
score: 0
has text: Well, if you have a set number of seats, you can do a regular array instead and declare the items all at once. To set a value, let's assume inside your class you have a `setIsTaken(boolean taken)` method (or something like it), you can call this to set the first seat to not taken: `myArrayList.get(0).setIsTaken(false);`
type: AnswerComment

http://stackoverflow.com/q/26910098
has comment: http://stackoverflow.com/comment/42370236
has body: I have two fields in my bean String key, String value, When field key="A" , "value" should follow a particular Regex for other "key" - it can be anything. How would I define this validation on value based on key.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26910732
has comment: http://stackoverflow.com/comment/42370194
tagged with: java
has comment: http://stackoverflow.com/comment/42369990
has comment: http://stackoverflow.com/comment/42370810
type: Question
tagged with: bean-validation
has title: JSR 303 Bean validation
answer count: 1
tagged with: javabeans
score: 0
has comment: http://stackoverflow.com/comment/42370458

http://stackoverflow.com/q/26877246
has answer: http://stackoverflow.com/a/26878644
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/26878644
tagged with: javascript
score: 4
upvote count: 4
downvote count: 0
answer count: 1
favorite count: 0
tagged with: resteasy
tagged with: angularjs
has body: I'm trying to use AngularJS in front end and Resteasy as a Rest API. My problem is that my @FormParam are always null when sending params with AngularsJS. Here is how my JS : $scope.addPerson = function(newFirstName, newLastName) { $http({ method: 'POST', url: "rest/persons/savePerson", data: {firstName: 'newFirstName', lastName: 'newLastName'}, headers: {'Content-Type': 'application/json'} }) .success(function(data) { alert("DATA : " + data); }).error(function(data, status, headers, config) { alert("Could not save new person"); }); }; And this is my code server side : @POST @Path("/savePerson") @Produces("application/json") @Secured({ "ROLE_USER" }) public PersonBean savePerson(@FormParam("firstName") String firstName, @FormParam("lastName") String lastName) { if (firstName== null || lastName== null) { return null; } PersonBean person = personDao.savePerson(firstName, lastName); return person ; } Any help is appreciated.
has title: Resteasy @FormParam null when passing params with AngularJS
type: AnsweredQuestion

http://stackoverflow.com/q/26920264
has answer: http://stackoverflow.com/a/47179632
has body: I fresh on spring technology and hibernate. Some days ago i create query getting all rows from table using repository. Today i was try get 2 fields from database. When i try read data form result list i getting Ljava.lang.Object; cannot be cast. This is my enity @Entity @Table(name = "cms") public class Cms implements Serializable{ private static final long serialVersionUID = 1759832392332242809L; @Id @GeneratedValue private Long id_page; @Column(nullable = false) private String title; private String content; @Temporal(TemporalType.DATE) private Date createDate; @Temporal(TemporalType.DATE) private Date modifyDate; @Column(nullable = true) private int createBy; @Column(nullable = true) private int modifedBy; @Column(nullable = false) private Boolean inMenu; public Cms(Long id_page, String title, String content, Date createDate, Date modifyDate) { this.id_page = id_page; this.title = title; this.content = content; this.createDate = createDate; this.modifyDate = modifyDate; this.createBy = 1; this.modifedBy = 1; this.inMenu = true; } //getters setters to string } Repository public interface CmsRepository extends Repository&lt;Cms, Long&gt;{ @Query("Select u.id_page,u.title from Cms u") List&lt;Cms&gt; getMenu(); } And takie this on controller List&lt;Cms&gt; menus= cmsservice.menuAll(); System.out.println(menus.get(0).toString()); //error Some one can explain me on example what is bad and how can fix this, this will helpfull for me.
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/26920691
possible better answer: http://stackoverflow.com/a/47179632
tagged with: spring
tagged with: java
tagged with: hibernate
type: AnsweredQuestion
score: 2
downvote count: 0
favorite count: 0
type: Question
has title: Ljava.lang.Object; cannot be cast when getting multipile fields Hibernate Repository
has answer: http://stackoverflow.com/a/26920691

http://stackoverflow.com/q/26941773
has comment: http://stackoverflow.com/comment/42427821
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26942334
has answer: http://stackoverflow.com/a/26942033
has comment: http://stackoverflow.com/comment/42427498
type: UnansweredQuestion
tagged with: deployment
tagged with: java
has comment: http://stackoverflow.com/comment/42427553
has comment: http://stackoverflow.com/comment/42427355
type: Question
has title: Java Deployment, what exactly is it?
has body: I have developed a simple Java application as an assignment. There is a next step to this assignment, which I do not understand clearly. Develop a script to deploy both client and server in automated way When you say "develop a script to deploy" in Java, does it mean to create a script that builds executable .jar file from your package? Or does it mean to actually have my application somewhere in the web so everyone can access it? What exactly does automated deployment mean in general when it comes to Java?

http://stackoverflow.com/q/26988413
has comment: http://stackoverflow.com/comment/42509059
linked to: http://stackoverflow.com/q/13795236
linked to: http://stackoverflow.com/q/18686199
has body: I read many other posts regarding this and I learned that the frame is set to BorderLayout by default. I added one shape to the west and one shape to the center of the frame. But still, only one shape comes up on the frame. The shape that comes up on the frame is the one whose location is at center. Here is the code: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.*; public class ShapeMover { private static final int FRAME_WIDTH = 400; private static final int FRAME_HEIGHT = 400; private static final int SHAPE_WIDTH = 50; private static final int INITIAL_X = 30; private static final int INITIAL_Y = 100; private static final int rec_x = 200; private static final int rec_y = 200; private static final int rec_height = 30; private static final int rec_width = 50; private boolean recToggle = true; private boolean circleToggle = true; private JFrame frame; private CircleComponent myShape; private RectangleComponent recShape; private JButton circle, rectangle; private JPanel panel, panel2; private void initialSetUp() { frame = new JFrame(); myShape = new CircleComponent(INITIAL_X, INITIAL_Y, SHAPE_WIDTH); recShape = new RectangleComponent(rec_x, rec_y,rec_height, rec_width); circle = new JButton("Click for circle"); event c = new event(); circle.addActionListener(c); rectangle = new JButton("Click for rectangle"); event2 r = new event2(); rectangle.addActionListener(r); panel = new JPanel(); panel.add(circle); panel.add(rectangle); frame.add(panel, BorderLayout.NORTH); frame.add(myShape, BorderLayout.WEST); frame.add(recShape,BorderLayout.CENTER); myShape.setVisible(false); recShape.setVisible(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setVisible(true); } //method public class event implements ActionListener{ @Override public void actionPerformed(ActionEvent e) { if(circleToggle == true){ myShape.setVisible(true); circleToggle = false; } else{ m…
tagged with: java
has comment: http://stackoverflow.com/comment/42509108
has comment: http://stackoverflow.com/comment/42509295
has comment: http://stackoverflow.com/comment/42542872
has comment: http://stackoverflow.com/comment/42509223
has answer: http://stackoverflow.com/a/27008114
answer count: 1
has title: Adding 2 shapes at the same time on a jFrame
has comment: http://stackoverflow.com/comment/42512109
has comment: http://stackoverflow.com/comment/42508982
tagged with: java-2d
score: 0
type: UnansweredQuestion
tagged with: jcomponent
tagged with: swing
has comment: http://stackoverflow.com/comment/42524894
type: Question
has comment: http://stackoverflow.com/comment/42544329

http://stackoverflow.com/comment/42268371
has text: Then what's the point of having the chrone driver?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26852924
score: 0

http://stackoverflow.com/q/26940784
tagged with: android
answer count: 0
tagged with: parse-platform
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42425579
has comment: http://stackoverflow.com/comment/42425594
has comment: http://stackoverflow.com/comment/42425553
has body: I am trying to see if an objects relation is null, if not then continue on. It keeps crashing on this line throwing a NullPointerException. How would I resolve this? I'm trying to see if this is null or not to begin with, but it just crashes saying NullPointerException? if (currentObject.getRelation("interested") != null) where currentObject is the ParseObject.
score: 1
tagged with: java
type: Question
has title: How to check if a ParseRelation is null prior fetching it
upvote count: 1
linked to: http://stackoverflow.com/q/218384
favorite count: 0
tagged with: relational-database

http://stackoverflow.com/a/26969098
has comment: http://stackoverflow.com/comment/42476405
has body: Edited. Try this: int[] range = { 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 6}; for (int i = 0; i &lt; range.length; i++) { int j = i + 1; for (; j &lt; range.length &amp;&amp; range[i] == range[j]; j++) { // do nothing } if (j &gt;= i + 2) { System.out.println(range[i]); i = j; } } } The problem in your solution is int this part for (int i = 0; i &lt; range.length; i++) { for (int j = i + 1; j &lt; range.length; j++) { For every element in array you are checking is there element with same value, and index is greater than index of element. For example, for element with index 2 (value 2) it's checking all (indexes: 3, 4, 5, 6, ...). And there are two matches (elements with index 3 and 4). Edit: (After @FabianBarney comment) Solution: String uni = "Uniques: "; String dup = "Duplicates: "; int[] range = { 1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 6}; for (int i = 0; i &lt; range.length; i++) { if (i + 1 &lt; range.length &amp;&amp; range[i + 1] == range[i]) { dup += range[i] + " "; int j = i + 1; while (j &lt; range.length &amp;&amp; range[i] == range[j]) { j++; } i = j - 1; } else { uni += range[i] + " "; } } System.out.println(uni); System.out.println(dup);
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42476218
has comment: http://stackoverflow.com/comment/42474887
has comment: http://stackoverflow.com/comment/42479282
accepted answer of: http://stackoverflow.com/q/26968958
downvote count: 1
has comment: http://stackoverflow.com/comment/42477073
has comment: http://stackoverflow.com/comment/42476740
answers question: http://stackoverflow.com/q/26968958
has comment: http://stackoverflow.com/comment/42478735
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42475946
score: 0

http://stackoverflow.com/comment/42435246
type: Comment
has text: Your method `insertDataToDB` is called from the main Thread in which you cannot perform any network operations (`NetworkOnMainThreadException`). Using an `AsyncTask` is the easiest way to solve your issue.
comment on: http://stackoverflow.com/a/26940477
type: AnswerComment
score: 0

http://stackoverflow.com/q/26858038
has title: Generic class references
tagged with: java
score: -1
type: Question
answer count: 2
upvote count: 0
has body: Please look into following code. Why this error is thrown even though Integer is inherited from Number and why the same case of error is not there when '? extends Number' is used. public class testGeneric { public static void main(String[] args) { Class&lt;Integer&gt; classint = int.class; Class&lt;Number&gt; classnum1 = int.class;// Error Type mismatch: cannot convert from // Class&lt;Integer&gt; to Class&lt;Number&gt; Class&lt;? extends Number&gt; classnum2 = int.class; } }
favorite count: 0
has answer: http://stackoverflow.com/a/26858231
has answer: http://stackoverflow.com/a/26858134
linked to: http://stackoverflow.com/q/2745265
type: UnansweredQuestion
downvote count: 1
duplicate of: http://stackoverflow.com/q/2745265
has comment: http://stackoverflow.com/comment/42277631

http://stackoverflow.com/comment/42358623
comment on: http://stackoverflow.com/a/26888169
score: 0
type: AnswerComment
type: Comment
has text: Thanks @OO7. It makes quite clear to me.. Just to add some more, Can you explain how we can set positional parameters in case of multiple positional parameters. i.e. if my query is like this select * from menu where parent = :parent_Name and menu_item_id=?

http://stackoverflow.com/q/26899559
tagged with: java
possible better answer: http://stackoverflow.com/a/26949384
has body: When I want to export my Android app from Eclipse, the export process starts normally but after a few seconds (when the whole process should actually take a minute) it fails. The following error message appears: Failed to export application That's all Eclipse is telling me. I'm using Ecliipse 4.4.1 with the Android Development Toolkit 23.0.4.1468518. When I then right-click the app, choose "Android Tools" and then "Export Unsigned Application Package", it fails again, but with more verbose error messages: As you can see, it says: 'Android Release Export' has encountered a problem. Failed to export application And strangely, it lists a file bin/$1$1.class which apparently cannot be found. There's no obvious reason why this file shouldn't be found, however. Only when I delete folders bin and gen and then clear the project, it works. But only once -- and after every successful run on the device or export to an APK, I have to repeat the step described before. Any ideas why this happens? Thanks a lot in advance!
tagged with: eclipse
answer count: 7
has answer: http://stackoverflow.com/a/26949384
has answer: http://stackoverflow.com/a/26949534
has answer: http://stackoverflow.com/a/27037412
upvote count: 4
has title: "Failed to export application" in Eclipse 4.4.1 for Android with ADT 23.0.4
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26949534
tagged with: android
has answer: http://stackoverflow.com/a/27075774
has answer: http://stackoverflow.com/a/27015416
has answer: http://stackoverflow.com/a/31821289
score: 4
has answer: http://stackoverflow.com/a/26900088

http://stackoverflow.com/comment/42342853
comment on: http://stackoverflow.com/q/26894590
has text: First look, you might need to change a lot to static.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26924654
has answer: http://stackoverflow.com/a/26924949
downvote count: 0
has answer: http://stackoverflow.com/a/26926073
favorite count: 0
has answer: http://stackoverflow.com/a/26924751
has title: Change listView row backgroundcolor based on item parsed from Json
answer count: 5
has body: Hi i fairly know programming but the issue here is that i am parsing data from json. Therefore my goal is to set the background color of each row based on the condition that when the item is either; Dog or Cat or Elephant or Rhino or Lion their respective list view background color should be blue, red, yellow, green { "pets" : { "dog_id" : 1, "dog_name" : "Dave", "cat_id" : 2, "cat_name" : "Prudie" "elephant_id" : 3, "elephant_name" : "Poncho", "lion_id ": 4 "lion_name" : "King" } } Kindly help, I can parse this JSON but I want the listView to show different colors. So far I can change the whole background of the listView, text of each item but failed to do the row colors conditionally.
tagged with: android
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26924775
has answer: http://stackoverflow.com/a/26924704
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: getview
tagged with: listview
type: Question

http://stackoverflow.com/a/26975989
has body: Here's a rough implementation based solely on your example. I suggest testing against other examples. public boolean hasDependencies(Map&lt;String, Set&lt;String&gt;&gt; objectAndItsDependentsMap) { for (String node : objectAndItsDependentsMap.keySet()) { final Set&lt;String&gt; directNeighbors = objectAndItsDependentsMap.get(node); for (String directNeighbor : directNeighbors) { Set&lt;String&gt; next = objectAndItsDependentsMap.get(directNeighbor); while (next != null) { for (String n : next) { next = objectAndItsDependentsMap.get(n); if (next != null &amp;&amp; (next.contains(n) || next.contains(node))) { return true; } } } } } return false; }
answers question: http://stackoverflow.com/q/26970996
has comment: http://stackoverflow.com/comment/42506315
upvote count: 0
accepted answer of: http://stackoverflow.com/q/26970996
type: AcceptedAnswer
type: Answer
score: -1
has comment: http://stackoverflow.com/comment/42530144
downvote count: 1

http://stackoverflow.com/q/26857827
upvote count: 2
type: Question
has body: I need to configure DST time for some application running in a server which is in Fiji. OS level time has configured properly : Tue Nov 11 17:28:51 **FJST** 2014 (FJST - Fiji Summer Time) I have changed the log4j.xml configuration as follow and tried: &lt;layout class="org.apache.log4j.EnhancedPatternLayout"&gt; &lt;param name="ConversionPattern" value="%d{ISO8601}{GMT+13} %-5p %c{1} [%x] [%t] - %m%n" /&gt; This works bit fine, but this can be a workaround only, can't be a solution. Following two issues are there: Need to restart all the application two times. During every DST changes service interruption will be there. It's not possible for production. We can't say, every day the time change will be exactly +/- 1 hour. Some days it can be like 50 mins. So in that case, log won't be updated with proper time. Is there any patch available for following java version to fix this ? - "1.7.0_09-icedtea" Else is there any way to change the log4j time as OS time? If so that will be a great solution since there won't be much service interruption.
has title: Configure DST(Daylight Savings Time) in log4j
tagged with: java
has answer: http://stackoverflow.com/a/27024738
downvote count: 0
answer count: 1
tagged with: log4j
favorite count: 0
tagged with: dst
type: UnansweredQuestion
score: 2

http://stackoverflow.com/a/26915538
score: 0
type: Answer
has body: In the query are this parameters: hash AND date_time_terminate Change : Query query = session.getNamedQuery("User.findByHash"); query.setString("hash", hash); query.setDate("hash", new Date()); By: Query query = session.getNamedQuery("User.findByHash"); query.setString("hash", hash); query.setDate("date_time_terminate", new Date());
answers question: http://stackoverflow.com/q/26915409
has comment: http://stackoverflow.com/comment/42380844

http://stackoverflow.com/q/26881296
linked to: http://stackoverflow.com/q/48674198
upvote count: 54
tagged with: unauthorized
tagged with: java
has answer: http://stackoverflow.com/a/30676336
answer count: 8
has answer: http://stackoverflow.com/a/66149133
has comment: http://stackoverflow.com/comment/104642177
linked to: http://stackoverflow.com/q/42181318
tagged with: spring-security-oauth2
has answer: http://stackoverflow.com/a/26917381
score: 53
has title: Spring-Security-Oauth2: Full authentication is required to access this resource
has answer: http://stackoverflow.com/a/61220664
has answer: http://stackoverflow.com/a/73880101
downvote count: 1
has answer: http://stackoverflow.com/a/53813551
favorite count: 0
linked to: http://stackoverflow.com/q/48806722
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33289305
tagged with: oauth-2.0
type: Question
has body: I am trying to use spring-security-oauth2.0 with Java based configuration. My configuration is done, but when i deploy application on tomcat and hit the /oauth/token url for access token, Oauth generate the follwoing error: <error_description>Full authentication is required to access this resource</error_description> unauthorized My configuration is on Git hub, please click on link The code is large, so refer to git. I am using chrome postman client for send request. follwing is my request. POST /dummy-project-web/oauth/token HTTP/1.1 Host: localhost:8081 Cache-Control: no-cache Content-Type: application/x-www-form-urlencoded grant_type=client_credentials&client_id=abc%40gmail.com&client_secret=12345678 The error is just like, the URL is secure by Oauth, but in configuration, i give the all permission for access this URL. What actual this problem is?
has answer: http://stackoverflow.com/a/26884315

http://stackoverflow.com/q/26923326
has comment: http://stackoverflow.com/comment/42629198
has answer: http://stackoverflow.com/a/59599494
has title: PDF PrinterJob get Job status
score: 7
tagged with: java
has body: I have an issue to print a PDF using java. I know that Java doesn't support print PDF natively cause java doesn't have a PDF renderer. So to solve this problem I'm using a PDFRenderer library and here is an example for printing with it: File f = new File("myfile.pdf"); FileInputStream fis = new FileInputStream(f); FileChannel fc = fis.getChannel(); ByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()); PDFFile pdfFile = new PDFFile(bb); PDFPrintPage pages = new PDFPrintPage(pdfFile); PrinterJob pjob = PrinterJob.getPrinterJob(); PageFormat pf = PrinterJob.getPrinterJob().defaultPage(); pjob.setJobName(f.getName()); pjob.setPrintService(mPrintService); Book book = new Book(); book.append(pages, pf, pdfFile.getNumPages()); pjob.setPageable(book); pjob.print(); It works fine, but I need some way to get status of my printer job. I need to know when my printer job was finished that I can start another. Java API has a good solution with DocPrintJob and PrintJobListener but I need to use PrinterJob for my PDF printing. So how I can listen the job status from my PrinterJob like it does in DocPrintJob?
answer count: 2
tagged with: printing
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
has answer: http://stackoverflow.com/a/27042509
has comment: http://stackoverflow.com/comment/42702248
tagged with: pdfrenderer
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27042509
upvote count: 7
possible better answer: http://stackoverflow.com/a/59599494
type: Question

http://stackoverflow.com/comment/116051983
type: Comment
type: AnswerComment
has text: @Manius - Singletons can be a bad thing too. They can make testing a lot more complicated. How do you run unit tests that involve lots of different configs if the config object is an immutable singleton? (OK, there are ways ...) These days Dependency Injection is thought to be the best way, in a lot of contexts.
comment on: http://stackoverflow.com/a/26908977
score: 0

http://stackoverflow.com/comment/42349560
type: AnswerComment
score: 0
type: Comment
has text: Why the down-vote? I added an edit addressing exactly this situation.
comment on: http://stackoverflow.com/a/26895386

http://stackoverflow.com/comment/42264444
score: 0
type: AnswerComment
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64649/discussion-between-kala-j-and-piyush).
comment on: http://stackoverflow.com/a/26847749

http://stackoverflow.com/comment/42465673
score: 1
has text: You have `String op_1_to_digit = null;` then you try to access it's length a couple lines later with `op_1_to_digit.length()`. This throws NPE because you explicitly set it to null right before this.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26963920

http://stackoverflow.com/comment/42483176
comment on: http://stackoverflow.com/q/26973876
type: QuestionComment
type: Comment
has text: you tried using class<?> type?
score: 0

http://stackoverflow.com/a/26946443
score: 1
has comment: http://stackoverflow.com/comment/42439274
has body: ButterKnife by Jake Wharton seems a good solution for your problem.
upvote count: 1
answers question: http://stackoverflow.com/q/26946150
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/42453950

http://stackoverflow.com/comment/42394096
has text: You can create countMap map which will store gameName as key and number of occurange as value. And then iterate through games map and its all inner list and set value in countMap. After this it will be easier for you to tackle your problem.
score: 0
comment on: http://stackoverflow.com/q/26923155
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42377724
comment on: http://stackoverflow.com/q/26914209
score: 0
type: QuestionComment
type: Comment
has text: You have two declarations of ArrayList<String> categories;

http://stackoverflow.com/a/26959876
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Use Enum when: Pre-defined list of values (Objects) Can't use a value that is not listed in the pre-defined list of values ( Can be validated - Safe type) JVM only create fixed number of Object instances for Enum values. Use Static when: List of values (objects) is can be used is not Fixed Considered as not safe method because the method parameter can be passed by any instance of the class. Your case: If you want to LIMITED / Validate Color that Caller can pass to 'aMethod' function -- Use ENUM If you want Caller can pass ANY Color instance to 'aMethod' --- Use Static definition
type: Answer
accepted answer of: http://stackoverflow.com/q/26959443
answers question: http://stackoverflow.com/q/26959443
score: 1

http://stackoverflow.com/q/26917597
answer count: 5
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26917701
has answer: http://stackoverflow.com/a/26917729
has answer: http://stackoverflow.com/a/26917643
has body: Trying to look through array and want it to return true if name is in the array and false if it isn't. public boolean ifInArray(String name) { for ( Dog breed: breeds) { if (breed.equals(name)) { return true; } else { return false; } } }
has comment: http://stackoverflow.com/comment/42384422
has answer: http://stackoverflow.com/a/26917687
downvote count: 1
has comment: http://stackoverflow.com/comment/42383877
has answer: http://stackoverflow.com/a/26917651
favorite count: 0
has title: Error: Missing return statement in Java
tagged with: compiler-errors

http://stackoverflow.com/a/26935401
upvote count: 1
answers question: http://stackoverflow.com/q/26935052
has comment: http://stackoverflow.com/comment/42437145
accepted answer of: http://stackoverflow.com/q/26935052
type: Answer
has body: You need to use SwingWorker thread. All swing related things like window paintings and events will execute on EDT. And you will perform background tasks like requesting and retrieving web page in background thread (SwingWorker). API: https://docs.oracle.com/javase/7/docs/api/javax/swing/SwingWorker.html Information: http://en.wikipedia.org/wiki/SwingWorker
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26947482
has body: For a quick fix, try wrapping your AnchorPane in a simple layout, such as an HBox, and set the alignment of the HBox to Pos.CENTER. However, AnchorPane is probably not the best layout pane to use here. You should read through the layout tutorial and figure out a different strategy: probably you want a BorderPane as the overall structure with HBoxs and/or GridPanes inside.
answers question: http://stackoverflow.com/q/26944499
type: Answer
has comment: http://stackoverflow.com/comment/42439991
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42439782
has comment: http://stackoverflow.com/comment/45214156
has comment: http://stackoverflow.com/comment/42439242
has comment: http://stackoverflow.com/comment/42438861
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26944499
has comment: http://stackoverflow.com/comment/45214084

http://stackoverflow.com/a/26968373
downvote count: 0
score: 3
accepted answer of: http://stackoverflow.com/q/26968205
answers question: http://stackoverflow.com/q/26968205
upvote count: 3
has comment: http://stackoverflow.com/comment/42474162
has body: You can use the java.util.Calendar class. public static void main(String args[]) { Calendar x = new GregorianCalendar(2014, 10, 10); Date date = x.getTime(); Calendar cal = new GregorianCalendar(); cal.setTime(date); cal.add(Calendar.DAY_OF_MONTH, 25); Date newDate = cal.getTime(); System.out.println(newDate); }
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42474759

http://stackoverflow.com/a/26925359
answers question: http://stackoverflow.com/q/26906438
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: I have prepared this demo to find the association type between two hibernate entity classes. It may help other community users so posting this answer. import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.Map; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import org.hibernate.metadata.ClassMetadata; import org.hibernate.metadata.CollectionMetadata; import org.hibernate.persister.collection.BasicCollectionPersister; import org.hibernate.persister.collection.OneToManyPersister; import org.hibernate.service.ServiceRegistryBuilder; import org.hibernate.type.ManyToOneType; import org.hibernate.type.OneToOneType; import org.hibernate.type.Type; /** * * @author shruti */ public class RelationDemo { public static void main(String[] args) throws Exception { Configuration configuration = new Configuration().configure(); ServiceRegistryBuilder builder = new ServiceRegistryBuilder().applySettings(configuration.getProperties()); SessionFactory sessionfactory = configuration.buildSessionFactory(builder.buildServiceRegistry()); //1. Read class names System.out.println("Enter first class names (make sure you enter fully qualified name): "); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); String class1 = bufferedReader.readLine(); System.out.println("Enter second class names (make sure you enter fully qualified name): "); String class2 = bufferedReader.readLine(); ClassMetadata classMetadata = null; //2. Create ClassMetaData for the first class name and check that both the classes exists. try { classMetadata = sessionfactory.getClassMetadata(Class.forName(class1)); Class.forName(class2); } catch (ClassNotFoundException classNotFoundException) { System.err.println("Invalid class name.\nHint: Enter fully qualified class names for eg. packagename.Classname"); classNotFoundException.printStackTrace(System.err); return; } //3. Retrieve all collection metada for collection type properties @Sup…
type: Answer
accepted answer of: http://stackoverflow.com/q/26906438

http://stackoverflow.com/a/62037307
type: Answer
has comment: http://stackoverflow.com/comment/135976941
score: 13
upvote count: 13
answers question: http://stackoverflow.com/q/26889970
downvote count: 0
has body: Have you checked that you have used @Service annotation on top of your service implementation? It worked for me. import org.springframework.stereotype.Service; @Service public class UserServiceImpl implements UserServices {}

http://stackoverflow.com/a/26864064
has comment: http://stackoverflow.com/comment/42302161
has comment: http://stackoverflow.com/comment/42299059
score: 2
has comment: http://stackoverflow.com/comment/42297949
downvote count: 0
has body: if you want to (quote from your Q.) control the variable involved in the loop then you can use an infinite while loop and count inside the loop. Use the control flow operators break and continue to exit or to shorten an iteration accordingly, for example var counter, j, x: Integer; counter := 0; while(true) do begin inc(counter) // if counter &gt; 10 then break; // if somethingelse then break/continue // etc. end;
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42294815
answers question: http://stackoverflow.com/q/26863868

string
tags question: http://stackoverflow.com/q/26866785
tags question: http://stackoverflow.com/q/26959765
tags question: http://stackoverflow.com/q/26980427
tags question: http://stackoverflow.com/q/26989943
tags question: http://stackoverflow.com/q/26924957
tags question: http://stackoverflow.com/q/26940395
tags question: http://stackoverflow.com/q/26983457
tags question: http://stackoverflow.com/q/26883273
tags question: http://stackoverflow.com/q/26849263
tags question: http://stackoverflow.com/q/26964729
tags question: http://stackoverflow.com/q/26957359
tags question: http://stackoverflow.com/q/26962867
tags question: http://stackoverflow.com/q/26983841
tags question: http://stackoverflow.com/q/26863738
tags question: http://stackoverflow.com/q/26958591
tags question: http://stackoverflow.com/q/26848972
tags question: http://stackoverflow.com/q/26834746
tags question: http://stackoverflow.com/q/26878111
tags question: http://stackoverflow.com/q/26958917
tags question: http://stackoverflow.com/q/26890948
tags question: http://stackoverflow.com/q/26838711
tags question: http://stackoverflow.com/q/26876390
tags question: http://stackoverflow.com/q/26930034
tags question: http://stackoverflow.com/q/26959140
tags question: http://stackoverflow.com/q/26959566
tags question: http://stackoverflow.com/q/26940731
tags question: http://stackoverflow.com/q/26931249
tags question: http://stackoverflow.com/q/26940539
tags question: http://stackoverflow.com/q/26922009
tags question: http://stackoverflow.com/q/26865090
tags question: http://stackoverflow.com/q/26978319
tags question: http://stackoverflow.com/q/26946301
tags question: http://stackoverflow.com/q/26950755
tags question: http://stackoverflow.com/q/26985089
tags question: http://stackoverflow.com/q/26888335
tags question: http://stackoverflow.com/q/26867134
tags question: http://stackoverflow.com/q/26940342
tags question: http://stackoverflow.com/q/26929015
tags question: http://stackoverflow.com/q/26944148
tags question: http://stackoverflow.com/q/26949218
tags question: http://stackoverflow.com/q/26920114
tags question: http://stackoverflow.com/q/26921289
tags question: http://stackoverflow.com/q/26980798
tag name: string
tags question: http://stackoverflow.com/q/26969313
tags question: http://stackoverflow.com/q/26883037
tags question: http://stackoverflow.com/q/26860173
tags question: http://stackoverflow.com/q/26955708
tags question: http://stackoverflow.com/q/26953900
tags question: http://stackoverflow.com/q/26838245
tags question: http://stackoverflow.com/q/26930758
tags question: http://stackoverflow.com/q/26948563
tags question: http://stackoverflow.com/q/26960089
tags question: http://stackoverflow.com/q/26984246
type: Tag
tags question: http://stackoverflow.com/q/26915707
tags question: http://stackoverflow.com/q/26881891
tags question: http://stackoverflow.com/q/26953889
tags question: http://stackoverflow.com/q/26963920
tags question: http://stackoverflow.com/q/26919697
tags question: http://stackoverflow.com/q/26990875
tags question: http://stackoverflow.com/q/26984676
tags question: http://stackoverflow.com/q/26915321
tags question: http://stackoverflow.com/q/26945523
tags question: http://stackoverflow.com/q/26928953
tags question: http://stackoverflow.com/q/26978507
tags question: http://stackoverflow.com/q/26986778
tags question: http://stackoverflow.com/q/26895588
tags question: http://stackoverflow.com/q/26921068
tags question: http://stackoverflow.com/q/26975530
tags question: http://stackoverflow.com/q/26894670
tags question: http://stackoverflow.com/q/26962431
tags question: http://stackoverflow.com/q/26841384
tags question: http://stackoverflow.com/q/26989262
tags question: http://stackoverflow.com/q/26973634
tags question: http://stackoverflow.com/q/26983784
tags question: http://stackoverflow.com/q/26839518
tags question: http://stackoverflow.com/q/26952690
tags question: http://stackoverflow.com/q/26856550
tags question: http://stackoverflow.com/q/26897397

http://stackoverflow.com/q/26919612
answer count: 0
type: UnansweredQuestion
has body: I am working on a java command line application that should keep all objects on the heap (only a few hundred). The main reason I need persistence is that I want to be able to stop the (slow-running) process at some point in time and reload the objects from a mysql database (through Hibernate). I have two class trees in which at some level objects have a reference to a shared object, looking like the following: A (abstract) B "b1" \ -&gt; SharedClass "shared1" / Y "y1" X (abstract) Persisting works like a charm, but when I reload the objects, I get the shared object "shared1" each time as a new object back from my loading helper method. In my case, there seem to be two queries necessary, one for loading all objects for class "B", and one for loading all objects for class "Y". Thanks to the eager loading, the object "shared1" gets instantiated as a new object automagically. This is great when executing the first query for "B", but when I load for "Y", shared1 gets loaded again and gets a new object handle. Relatively new to Java/ORM/hibernate, I naively assumed that hibernate will through some magic know which objects are already loaded, but obviously it doesn't, and if I think about it, this behavior makes some sense. As you can see below, I start two queries at initialization. I want to keep all my objects in a Collection (in a thing I call a "Store") which is initialized at reloading, and I think I need to do this starting from the root of each tree. I would like to avoid writing HQL, and an activated second-level ehcache didn't help to resolve this issue. I'm stuck and I think I'm doing something conceptually wrong. Maybe my whole idea of persisting and loading is broken? What's the usual way to reload objects with shared references in a similar class tree in a consistent way? Is there some design pattern that can be used for such a situation? The abstract class A: @Entity @Table(name = "atree") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorC…
tagged with: design-patterns
has title: Avoid duplicates when eager loading from hibernate with shared objects?
tagged with: java
tagged with: hibernate
tagged with: orm
type: Question
has comment: http://stackoverflow.com/comment/42398799
has comment: http://stackoverflow.com/comment/42398688
has comment: http://stackoverflow.com/comment/42401483
score: 0

http://stackoverflow.com/a/26910814
has body: If you just want to control if the menu item is enabled/disabled what you have is OK. You can control the visibility of the menu item by specifying a 'Visible-When Expression' in the 'Handled Menu Item' entry in the Application.e4xmi. Here you specify the id of a 'core expression' defined using the org.eclipse.core.expressions.definitions extension point.
accepted answer of: http://stackoverflow.com/q/26910470
score: 0
answers question: http://stackoverflow.com/q/26910470
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/q/26991064
has comment: http://stackoverflow.com/comment/42516053
tagged with: ffmpeg
has comment: http://stackoverflow.com/comment/45962425
type: UnansweredQuestion
tagged with: android
score: 6
has comment: http://stackoverflow.com/comment/45962451
linked to: http://stackoverflow.com/q/24818902
has comment: http://stackoverflow.com/comment/42515546
answer count: 0
tagged with: java
has title: error: only position independent executables (PIE) are supported
type: Question
tagged with: pie-chart
has comment: http://stackoverflow.com/comment/42513525
upvote count: 6
tagged with: controls
has comment: http://stackoverflow.com/comment/42513809
has body: When I execute a bin file in my code, Android L 5.0 blocking the execution of these file with following error Error: only position independent executables (PIE) are supported My executable files are an FFmpeg converter and a Sox converter I moved these files from a raw folder to /data/data/com.mypackage/app_bin and call Runtime.getRuntime().exec("/data/data/com.mypackage/app_bin/ffmpeg {commands}") Could any one please help me to resolve this issue?
downvote count: 0
has comment: http://stackoverflow.com/comment/48785511
favorite count: 0

http://stackoverflow.com/comment/42260175
type: QuestionComment
comment on: http://stackoverflow.com/q/26848762
score: 0
has text: delete the character
type: Comment

http://stackoverflow.com/q/26866785
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42292887
has comment: http://stackoverflow.com/comment/42293470
tagged with: java
accepted answer: http://stackoverflow.com/a/26867280
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42293018
tagged with: string
has comment: http://stackoverflow.com/comment/42293228
has body: I have a input string of known length. I have to split this input string in 30 substrings of different lengths. For ex:- Input string: "abcdefghijklmnopqrstuvwxyz" Output string: "a","bcd","efgij","kl","mnopqrstu","v","wx","yz" I wanted to know if there is some sort of API or way where I can provide the lengths, based on which I want to split the string, and get the output at one go instead of multiple steps. Any help will be highly appreciated.
favorite count: 0
possible better answer: http://stackoverflow.com/a/26867047
has comment: http://stackoverflow.com/comment/42292938
has comment: http://stackoverflow.com/comment/42293092
has answer: http://stackoverflow.com/a/26867047
type: Question
score: -1
has answer: http://stackoverflow.com/a/26867280
has title: Java API to split a string into substrings of different length
downvote count: 2

http://stackoverflow.com/q/26888333
has comment: http://stackoverflow.com/comment/42331112
has title: Null pointer running SFTP through spring mvc
has body: Null pointer points to these 2 lines channelSftp.exit(); res = ftpService.send("c:\\Cache\\opt.xml"); @RequestMapping("/ftpFileToServer.json") public String ftpFiletoServer(ModelMap model) { SFTPService ftpService; boolean res; Result result; try { ftpService = new SFTPService(); res = ftpService.send("c:\\Cache\\opt.xml"); result = new Result(res, null); if (result.isSuccess()) { GsonBuilder builder = new GsonBuilder(); Gson gson = builder.create(); String json = gson.toJson(result); model.put("ftpFileToServer", json); The SFTP service works outside when i test it using a driverClass and clicking run. However when using it with spring where i uses it it doesn't work. preparing the host information for sftp. An exception was found while transfering the response. java.lang.NullPointerException at com.xxxxx.xxxx.service.SFTPService.send(SFTPService.java:56) at com.xxxxx.xxxx.controller.BaseController.ftpFiletoServer(BaseController.java:433) public boolean send(String fileName) { props = new Properties(); String propertiesFilename = "src/main/resources/Properties/sftp.properties"; Session session = null; Channel channel = null; ChannelSftp channelSftp = null; System.out.println("preparing the host information for sftp."); try { props.load(new FileInputStream(propertiesFilename)); String SFTPHOST = props.getProperty("SFTPHOST").trim(); int SFTPPORT = Integer.parseInt(props.getProperty("SFTPPORT") .trim()); String SFTPUSER = props.getProperty("SFTPUSER").trim(); String SFTPPASS = props.getProperty("SFTPPASS").trim(); String SFTPWORKINGDIR = props.getProperty("SFTPWORKINGDIR").trim(); JSch jsch = new JSch(); session = jsch.getSession(SFTPUSER, SFTPHOST, SFTPPORT); session.setPassword(SFTPPASS); java.util.Properties config = new java.util.Properties(); config.put("StrictHostKeyChecking", "no"); session.setConfig(config); session.connect(); System.out.println("Host connected."); channel = session.openChannel("sftp"); channel.connect(); System.out.println("sftp channel opene…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42331177
type: Question
has comment: http://stackoverflow.com/comment/42331299
score: 0
has comment: http://stackoverflow.com/comment/42331044
type: UnansweredQuestion

http://stackoverflow.com/a/26935492
upvote count: 3
type: Answer
has body: You need to add an extra scan.nextLine(), in order to consume \n character that scan.nextInt() didn't consume: int x = scan.nextInt(); scan.nextLine(); // consume the newline character
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26935458

http://stackoverflow.com/q/26882604
has answer: http://stackoverflow.com/a/26885037
has title: Selenium - Difference between WebDriver.findElement() and WebElement.findElement()
has comment: http://stackoverflow.com/comment/42324608
has body: I was using WebElement.findElement(By.cssSelector('')).click(); to find an element on a page , but it returned "Unable to locate element", But when I used WebDriver.findElement(By.cssSelector('')).click(); then it was able to find the element and clicked on it. I am unable to understand the difference between the findElement() of the two interfaces. Kindly Help.
score: 5
tagged with: selenium
type: AnsweredQuestion
tagged with: testing
upvote count: 5
tagged with: java
accepted answer: http://stackoverflow.com/a/26885037
possible better answer: http://stackoverflow.com/a/26886440
has comment: http://stackoverflow.com/comment/42321378
type: Question
has answer: http://stackoverflow.com/a/26886440
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/42329901
comment on: http://stackoverflow.com/q/26887646
score: 0
type: Comment
has text: So I read your link kiheru and I have the nvidia vga, and yesterday I updated the driver so you really think that's the cause? Otherwise , the effect in the link is the same as mine, so the code is similar too.
type: QuestionComment

http://stackoverflow.com/a/31940486
type: Answer
downvote count: 0
score: 1
has body: It is very simple, to set a bigger limit, than 1024 characters, to a attribute which is from the type "d:text". You must modify the file custom-config-model.xml which you can find in folder ALFRESCO_HOME/tomcat/shared/classes/alfresco/web-extensions. In the config from your node-type you must write something like in the following example: ... <show id="your:attribute" /> ... ... 40000 ... The fist thing you do with that code is: You show the attribute You make the textfield to a template which is called textarea (much better for a text or something) you set the maximal length of the attribute to 40.000 characters (which should be enough) If you don't want the textfield as textarea delete the template attribute from the control section. After this manipulation you can save strings with up to 40.000 characters in this attribute. Hope I could help you!
answers question: http://stackoverflow.com/q/26892775
upvote count: 1

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

http://stackoverflow.com/q/26908199
has answer: http://stackoverflow.com/a/26909448
upvote count: 3
possible better answer: http://stackoverflow.com/a/26909448
favorite count: 0
has title: transitive dependencies of scala project built with sbt within a different java maven project
tagged with: scala
tagged with: maven
has answer: http://stackoverflow.com/a/26917242
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26917242
downvote count: 0
tagged with: java
has body: I have included a scala library built with sbt in a java maven project. The jar was built using sbt publishM2. I can use the scala classes within the library just fine, but the transitive dependencies of those classes are not added to the classpath by maven. For example one of those scala classes uses the joda-time, and this is specified in its build.sbt file as follows: libraryDependencies += "joda-time" % "joda-time" % "2.0" Yet when running a test with mvn test from the java project I get a class-not-found exception: java.lang.NoClassDefFoundError: org/joda/time/DateTime When looking at the pom built by sbt and placed into the ~/.m2/... subdirectory, I can find the following entry for joda-time: joda-time joda-time 2.0 My understanding is that maven should resolve these transitive dependencies and add them to the classpath of my current project. What am I missing?
type: Question
tagged with: sbt
answer count: 2

http://stackoverflow.com/comment/43538640
type: Comment
type: QuestionComment
has text: @jwill The class is loaded to virtual machine if initialization of all static blocks finished with success. If at least one failed - the class is not loaded.
comment on: http://stackoverflow.com/q/26848502
score: 0

http://stackoverflow.com/comment/42431504
has text: You mean your log file gets overwritten for every new programm execution?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26944302

http://stackoverflow.com/a/53801662
answers question: http://stackoverflow.com/q/26941651
score: 0
type: Answer
has body: import java.util.Scanner; class Multi { public static void doSomething() { Scanner s = new Scanner(System.in); int numone = s.nextInt(); System.out.println("please input the number of numbers you want to analyze"); Scanner r = new Scanner(System.in); int numtwo = s.nextInt(); } } } public class MultiplicationTable { public static void main(String[] args) { Multi.doSomething(); } }

http://stackoverflow.com/a/26933702
answers question: http://stackoverflow.com/q/26933474
downvote count: 0
type: Answer
score: 2
has body: You could use xor operator boolean xTest; if( (xTest=x==a)^(y==a) ? xTest ? y==b : x==b : false ) This will: test x==a en store the result in xTest perform a x==a xor y==a. if false, return false. If true, do 3 if x==a is true, test y==b. if x==a is false, test for x==b
upvote count: 2

http://stackoverflow.com/q/26927301
has comment: http://stackoverflow.com/comment/42400711
possible better answer: http://stackoverflow.com/a/26927426
downvote count: 0
has answer: http://stackoverflow.com/a/26927426
favorite count: 0
accepted answer: http://stackoverflow.com/a/26927416
answer count: 3
linked to: http://stackoverflow.com/q/338206
tagged with: controllers
has comment: http://stackoverflow.com/comment/42400822
has answer: http://stackoverflow.com/a/26927416
has comment: http://stackoverflow.com/comment/42400823
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42400800
has body: if ( accountType = "admin" ) return admin view if ( accountType = "customer" ) return customer view if ( accountType = "user" ) return user view if ( accountType = "merketing" ) return marketing view and so on .......
upvote count: 1
has title: how to choose one view out of many in controller ( i don't want if/else because i might have many views)
type: Question
tagged with: model-view-controller
has comment: http://stackoverflow.com/comment/42400752
has comment: http://stackoverflow.com/comment/42401552
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26927565

http://stackoverflow.com/a/26860900
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42282337
score: 1
has comment: http://stackoverflow.com/comment/42282447
has comment: http://stackoverflow.com/comment/42282293
accepted answer of: http://stackoverflow.com/q/26860845
answers question: http://stackoverflow.com/q/26860845
has comment: http://stackoverflow.com/comment/42282341
has body: You can avoid this by implementing the onLowMemory() callback.
upvote count: 1

http://stackoverflow.com/comment/42305174
type: QuestionComment
type: Comment
has text: Hint: You want to print the first line, call a subroutine to fill in the middle, then print the last line. The subroutine then becomes exactly the same as the main method.
comment on: http://stackoverflow.com/q/26873488
score: 0

http://stackoverflow.com/a/26898147
upvote count: 2
has body: There is undoubtedly a big discontinuity in the signal between the starting moment and the ending moment. With the Java Clip as it is constructed, there is no way to counteract this that I know of. I recommend editing the sound in something like Audacity to try and make the two ends more similar. Easiest dodge is to have both ends taper to silence--but then that leaves a gap. The other possibility is writing your own Clip and adding a provision that allows a degree of overlap of the two edges. Then, you can add tapers in Audacity and have the tapered parts overlap. This is similar to how audio editing ("splicing") is done in a DAW. That is a bit of work though! I have done this and it does work well, but am a month or three away, still, from releasing my audio library. To program it yourself, read the bytes into an array, converting to PCM. Then, you can use the TargetDataLine as an example of an interface that allows reading progressive data (it is overkill, but the read() method is the key). In your read, you make a provision for starting a LERP (linear interpolation) of the PCM data at the overlap point. If another means of dealing with this issue comes up, I will be happy to learn about it!
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26891634
downvote count: 0
answers question: http://stackoverflow.com/q/26891634
type: Answer
score: 2

http://stackoverflow.com/q/26849853
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42262586
has answer: http://stackoverflow.com/a/26850629
linked to: http://stackoverflow.com/q/26839424
has title: Putting multiple onClickListener and OnClick in the same activity
tagged with: android
has comment: http://stackoverflow.com/comment/42262340
has comment: http://stackoverflow.com/comment/42262379
accepted answer: http://stackoverflow.com/a/26850629
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42262832
tagged with: java
has comment: http://stackoverflow.com/comment/42262690
possible better answer: http://stackoverflow.com/a/26850126
has comment: http://stackoverflow.com/comment/42262462
has body: I am trying to setup multiple buttons but I seem to be having trouble doing it. I have 2 onClickListener functions in the same activity. Am I right in doing this or should this be done some other way? btnChpt3 works but when I input the onclicklistener for btnChpt3_1 it force closes as soon as it opens. Thanks. MainMenu.java package com.th3ramr0d.learnar670_1; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainMenu extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button chapterThree = (Button) findViewById(R.id.btnChpt3); chapterThree.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(MainMenu.this, Chapter3.class)); } }); Button chapterThree_1 = (Button) findViewById(R.id.btnChpt3_1); chapterThree_1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity(new Intent(MainMenu.this, Chapter3_1.class)); } }); } @Override protected void onPause() { // TODO Auto-generated method stub super.onPause(); } } So I added a new class to handle the buttons on a sub menu page. But now I am running into the same problem I was previously where the button wont open. I am guessing its because the code isnt being ran for some reason. <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" /> <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.LAUNCHER" /> <action android:name="com.th3ramr0d.learnar670_1.CHAPTER3" /> <category android:name="android.intent…
has answer: http://stackoverflow.com/a/26850126

http://stackoverflow.com/a/26857879
answers question: http://stackoverflow.com/q/26850028
type: Answer
score: 0
has body: I have been able to connect to the DB, and (I think) execute the command, but either my ResultSet has nothing in it, or I am not displaying the results properly First of all , you are not printing anything in the jsp, add out.print() as Larry suggested.Also check whether you have formed the query correctly, you can check it in the interface like sql developer. It is advised to print the sql query before you execute it to avoid the syntax errors Also, when I tried to run the query with a ';' at the end, it would not run. But when I removed it it ran. Is there some reason you don't need to terminate queries with a ';' when using JDBC? You need not terminate the sql queries with the semicolon, jdbc does that for you in case of single query. Have a look at Is the semicolon necessary in SQL? Lastly, don't write the java codes inside the jsp file ,try to use servlets (even it is not advisable in MVC). Refer How to avoid Java code in JSP files?

http://stackoverflow.com/q/26958917
has title: Printing the alphabet using for loop. Why must I explicitly convert character [] to string?
favorite count: 0
has answer: http://stackoverflow.com/a/26958972
upvote count: 2
has answer: http://stackoverflow.com/a/26959049
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26958972
possible better answer: http://stackoverflow.com/a/26959043
has answer: http://stackoverflow.com/a/26959043
tagged with: println
answer count: 3
has body: I am trying to print the letters of the alphabet in caps. So I wrote this in a for loop: System.out.print(Character.toChars(i)); //where i starts at 65 and ends at 90 This works fine and prints the letters but In my code I wanted to put a space between the letters to make it look nicer. So i did this: System.out.print(Character.toChars(i) + " ") Why does it print the memory address of the characters instead of the letter? The solution I came up with was to explicitly convert the char to a new String object: String character = new String(Character.toChars(i)); System.out.print (character + " "); but I'm not quite sure why I can't just write "Character.toChars(i)" In the first one Does the method(Character.toChars()) point to the address of the character and System.out.print is smart enough to print the value at that address? i.e the corresponding letter?
tagged with: string

http://stackoverflow.com/a/26877379
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: API used is flexjson public static void main(String args[]) throws Exception { Child child2 = new Child("ankur", 23); Child child1 = new Child("ankurs", 23); Child child3 = new Child("ankurss", 21); List&lt;Child&gt; childList = new ArrayList&lt;Child&gt;(); childList.add(child1); childList.add(child2); childList.add(child3); Parent parent = new Parent(); parent.setApprovable(true); parent.setChildList(childList); JSONSerializer serializer = new JSONSerializer(); System.out.println(serializer.exclude("*.class").deepSerialize(parent)); } Output { "approvable": true, "childList": [ { "age": 23, "name": "ankurs" }, { "age": 23, "name": "ankur" }, { "age": 21, "name": "ankurss" } ] }
accepted answer of: http://stackoverflow.com/q/26876786
type: Answer
answers question: http://stackoverflow.com/q/26876786

http://stackoverflow.com/q/26847259
has title: How can I set my textClock to phone's default time format?
downvote count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26847749
favorite count: 0
has comment: http://stackoverflow.com/comment/42263291
possible better answer: http://stackoverflow.com/a/26847708
has answer: http://stackoverflow.com/a/40849451
has body: I have my TextClock Set as the following: &lt;TextClock android:id="@+id/datetime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_row="1" android:layout_column="2" android:textColor="@color/black" android:format24Hour="HH:mm" android:format12Hour="HH:mm" /&gt; Right now even though my phone is defaulted to a 12 hour time, it's showing up as a 24 hour time. I want to be able to set it to a 12 hour time zone but not permanently, only in regards to whatever my phone is set as. How can I do that? EDIT: I removed the format above but I am setting it again in the code like: TextClock textClock = (TextClock) findViewById(R.id.datetime); textClock.setFormat12Hour("HH:mm"); textClock.setFormat24Hour("HH:mm"); Would this also affect the phone's time zone? I want to remove the AM/PM from the textclock when a format is not set in XML.
has answer: http://stackoverflow.com/a/26847708
answer count: 4
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/71192072
accepted answer: http://stackoverflow.com/a/26847749
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/26858239
type: Question
has body: I have data in txt : 1 2 3 4 5 6 7 8 if I want to sum in separate ex : 1+2+3 result is 6 and 4+5+6...n= 30 Separated list means the list of numbers separated with empty line. For example in above example, numbers 1 2 3 and 4 5 6 7 8 are separated with empty line. I want the sum of first 3 numbers and then next 5 numbers separately. Scanner sc = new Scanner (new File("patch.txt"); while (sc.hasNextLine()) { //sum each numbers } How do I do it? Read data using scanner.
score: 0
answer count: 3
tagged with: io
has comment: http://stackoverflow.com/comment/42277810
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43195862
has comment: http://stackoverflow.com/comment/42277839
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/26858368
has answer: http://stackoverflow.com/a/26858348
has title: summing in separate using break java scanner
tagged with: switch-statement
has answer: http://stackoverflow.com/a/26858291

http://stackoverflow.com/comment/42405177
comment on: http://stackoverflow.com/a/26929407
score: 0
type: Comment
has text: @BagherS You also need some headers for the request to be accepted.
type: AnswerComment

http://stackoverflow.com/comment/42310968
comment on: http://stackoverflow.com/q/26876611
has text: Perhaps an easier approach, if the scope of the predicates could be easily limited to a few particular cases, is to offer a set of predefined predicates, and in the configuration class use the class name and a number of parameters that work with that class.
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42465377
has text: No, it outputs this: S u g a r instead of s su sug suga sugar
comment on: http://stackoverflow.com/q/26963757
score: 0
type: Comment
type: QuestionComment

gridbaglayout
tags question: http://stackoverflow.com/q/26958119
tags question: http://stackoverflow.com/q/26833913
type: Tag
tags question: http://stackoverflow.com/q/26873189
tag name: gridbaglayout
tags question: http://stackoverflow.com/q/26915042
tags question: http://stackoverflow.com/q/26923348
tags question: http://stackoverflow.com/q/26865935
tags question: http://stackoverflow.com/q/26844147

http://stackoverflow.com/comment/42331263
score: 0
has text: Looks like you've neglected to push the Tika Jars out to your hadoop nodes. How are you deploying your code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26882825

http://stackoverflow.com/comment/42266660
score: 1
has text: Could you perhaps give us some example input and expected output? As already mentioned by ajb, I'm not quite sure what you mean by one character at a time.
comment on: http://stackoverflow.com/q/26852076
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42469429
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26931525
type: Comment
has text: Thank You. I'm pleased to see your suggestions.But unfortunately it did't help me. I have also included mysql-connector-java-5.1.34-bin.jar in tomcat/lib.

http://stackoverflow.com/a/26903737
has body: int index=text.toLowerCase().indexOf(patteren.toLowerCase(),pos); if (index&gt;=0) { component.setSelectionStart(index); component.setSelectionEnd(index+patteren.length()); component.getCaret().setSelectionVisible(true); } else { index=text.substring(0,pos).toLowerCase().indexOf(patteren.toLowerCase()); if (index&gt;=0) { component.setSelectionStart(index); component.setSelectionEnd(index+patteren.length()); component.getCaret().setSelectionVisible(true); } } If nothing is found use previous part of the text
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26903292
upvote count: 1
answers question: http://stackoverflow.com/q/26903292
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26952567
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26952513
type: Answer
answers question: http://stackoverflow.com/q/26952513
score: 2
has body: In this case, java programmers would commonly create a class with 2 members: head and tail. That would be the return type for the getHeadTail(List list) method.

http://stackoverflow.com/q/26980152
has comment: http://stackoverflow.com/comment/42494685
has comment: http://stackoverflow.com/comment/42495460
type: Question
score: -2
tagged with: ubuntu-14.04
upvote count: 0
has body: I can run IE on ubuntu with playOnlinux manually. How do you think is it possible to run it with Selenium WebDriver? [TestNG] Running: /tmp/testng-eclipse--935095095/testng-customsuite.xml FAILED CONFIGURATION: @BeforeTest setUp java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property; for more information, see http://code.google.com/p/selenium/wiki/InternetExplorerDriver. The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html at com.google.common.base.Preconditions.checkState(Preconditions.java:176) at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:105) at org.openqa.selenium.ie.InternetExplorerDriverService.access$100(InternetExplorerDriverService.java:38) at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.build(InternetExplorerDriverService.java:247) at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251) at org.openqa.selenium.ie.InternetExplorerDriver.&lt;init&gt;(InternetExplorerDriver.java:172) at org.openqa.selenium.ie.InternetExplorerDriver.&lt;init&gt;(InternetExplorerDriver.java:146) at com.example.fw.ApplicationManager.&lt;init&gt;(ApplicationManager.java:70) at Which libraries should I install exactly? thanks
has comment: http://stackoverflow.com/comment/42495079
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26980191
has title: is it possible to run IE8 on ubuntu via selenium?
tagged with: java
downvote count: 2
tagged with: selenium

http://stackoverflow.com/comment/42304011
type: QuestionComment
score: 5
type: Comment
comment on: http://stackoverflow.com/q/26872951
has text: With only 5-10 integers, i don't think your performance is going to be effected at all whether you went with either of those.

http://stackoverflow.com/comment/105361059
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26958407
has text: Hi @LiangZhou Here you go.. https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation we don't even need to add `underscore` in method as well .. for example : `List<Student> findByTeacherTeacherId(String teacherId);` This will also work.
score: 1

http://stackoverflow.com/comment/42379825
type: QuestionComment
type: Comment
has text: Hi piyush, sorry i'm new, could explain in details about reconfiguring build path?
score: 0
comment on: http://stackoverflow.com/q/26915498

http://stackoverflow.com/comment/42392785
comment on: http://stackoverflow.com/q/26922009
has text: @MadProgrammer The main problem isn't the object allocation, but the fact that `str3 = str1 + str2` requires copying all of the chars in `str1` and `str2` into the `char[]` that `str3` uses (twice, actually: once for the temporary `StringBuilder` and once for the new `String` it produces). If you do `str += foo`, that means that each time around, the previous `str` chars will be copied to create the new `str`. The original str's chars are copied N times, the first loop's str chars are copied N-1 times, etc. It's an N^2 operation, which is worse than the object allocation.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42344901
comment on: http://stackoverflow.com/q/26895661
score: 0
type: Comment
type: QuestionComment
has text: @afzalex Yup, i want to. Despite of the fact that i won't be able to add anything in the future.

http://stackoverflow.com/q/26965287
tagged with: android
has answer: http://stackoverflow.com/a/26965366
has answer: http://stackoverflow.com/a/26966312
has comment: http://stackoverflow.com/comment/42468764
has body: I am having problems setting an imageview to a jpg in the DCIM folder of my app This one line of code is making my app go really slow, and often crashes the app entirely. picturesDirectoryPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + "/camera/TapTrack/"; imageview.setImageURI(Uri.parse(picturesDirectoryPath + "/TapTrack_164.jpg/")); I also attempted a different way, by setting the imageview to a bitmap, however this is just as slow picturesDirectoryPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() + "/camera/TapTrack/"; imageview.setImageBitmap(BitmapFactory.decodeFile(picturesDirectoryPath + "/TapTrack_164.jpg/")); I was just wondering if you guys knew of a more efficient way of setting an imageview = to a path on the phone. Thanks for any help! --logcat error-- 11-16 21:53:50.062: E/AndroidRuntime(1820): FATAL EXCEPTION: main 11-16 21:53:50.062: E/AndroidRuntime(1820): Process: com.example.homeworkreminder, PID: 1820 11-16 21:53:50.062: E/AndroidRuntime(1820): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.homeworkreminder/com.winbusiness.taptrack.EditAssignment}: java.lang.NullPointerException 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.app.ActivityThread.access$800(ActivityThread.java:135) 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.os.Handler.dispatchMessage(Handler.java:102) 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.os.Looper.loop(Looper.java:136) 11-16 21:53:50.062: E/AndroidRuntime(1820): at android.app.ActivityThread.main(ActivityThread.…
has answer: http://stackoverflow.com/a/26965333
type: Question
tagged with: imageview
tagged with: java
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42468730
has title: Having trouble loading image into imageview
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42468499

http://stackoverflow.com/q/26975821
tagged with: android
has body: By following Kilbolt's Zombie Bird tutorial I created in my project a class to represent all buttons: public class SimpleButton { private float x, y, width, height; private TextureRegion buttonUp; private TextureRegion buttonDown; private Rectangle bounds; private boolean isPressed = false; public SimpleButton(float x, float y, float width, float height, TextureRegion buttonUp, TextureRegion buttonDown) { this.x = x; this.y = y; this.width = width; this.height = height; this.buttonUp = buttonUp; this.buttonDown = buttonDown; bounds = new Rectangle(x, y, width, height); } public boolean isClicked(int screenX, int screenY) { return bounds.contains(screenX, screenY); } public void draw(SpriteBatch batcher) { if (isPressed) { batcher.draw(buttonDown, x, y, width, height); } else { batcher.draw(buttonUp, x, y, width, height); } } public boolean isTouchDown(int screenX, int screenY) { if (bounds.contains(screenX, screenY)) { isPressed = true; return true; } return false; } public boolean isTouchUp(int screenX, int screenY) { // It only counts as a touchUp if the button is in a pressed state. if (bounds.contains(screenX, screenY) &amp;&amp; isPressed) { isPressed = false; return true; } // Whenever a finger is released, we will cancel any presses. isPressed = false; return false; } } Whenever I want to create a button I do it in my InputProcessor class by creating a SimpleButton object and after filling its parameters I add it to List list. My current problem is that I'm trying to create a sound button, which I did create and it work fine, but what I'm struggling with is making the button change TextureRegion between ON and OFF states. This is an example of how I create a button(actually I created the sound button) and put it in the list: soundButton = new SimpleButton( 136 / 2 - (AssetLoader.soundOnNotClicked.getRegionWidth() / 0.25f), midPointY - 102, 15, 15, AssetLoader.soundOnNotClicked, AssetLoader.soundClicked); gameButtons.add(backButton); I tried using the same con…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26982657
score: 0
tagged with: java
type: Question
tagged with: libgdx
has title: libGDX changing button's image
accepted answer: http://stackoverflow.com/a/26982657
answer count: 1

http://stackoverflow.com/comment/42309467
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26875813
has text: @libik That is not correct. See my solution with `Iterator` below

http://stackoverflow.com/a/26891463
accepted answer of: http://stackoverflow.com/q/26891248
answers question: http://stackoverflow.com/q/26891248
type: Answer
has comment: http://stackoverflow.com/comment/42337771
score: 0
has body: You have to learn a bit more about how HTML form works, but basically browser sends a POST request to the webserver with the values from the form. Chrome's Developer Tools, Firefox's web developer toolbar has a functionality what can help you to discover what request is sent to the server when you post a single form. Of course you have to fill the values with your heart content If you already know what content you want to send, you can post it relative easily, it is described well with examples in this StackOverflow answer https://stackoverflow.com/a/4206094/182474. But I strongly recommend to discover how browsers works internally from the aspect of HTTP protocol, because it is a very useful knowledge if you want to develop tools that interacts with web APIs or simulate posting HTML forms.
type: AcceptedAnswer

http://stackoverflow.com/q/26860472
tagged with: java
has comment: http://stackoverflow.com/comment/42281919
has title: Failure of "try" not going to "catch" block
has comment: http://stackoverflow.com/comment/42281917
type: Question
tagged with: try-catch
answer count: 2
has comment: http://stackoverflow.com/comment/42281614
has answer: http://stackoverflow.com/a/40146953
score: 0
has comment: http://stackoverflow.com/comment/42281610
has answer: http://stackoverflow.com/a/26860792
has comment: http://stackoverflow.com/comment/42281491
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42281573
has body: This code is written to get the error reported in console if WebElement is not found on page. It fails on try block but doesn't go to catch. I have tried different tweaks and tricks but its not working, please share what am I missing: Code: public class GetElement extends TestBase{ WebDriverWait wdw = new WebDriverWait(driver, 10); public WebElement getElement(WebElement element) { try { System.out.println("\n" + "==============" + "\n" + "inside try of gE" + "\n" + "==================="); return wdw.until(ExpectedConditions.elementToBeClickable(element)); } catch (NoSuchElementException | TimeoutException ex) { System.out.println("\n" + "==============" + "\n" + element.getText() + " Element not or wasnt clickable found on page" + "\n" + driver.getCurrentUrl() + "\n" + "==================="); } System.out.println("\n" + "==============" + "\n" + "Element will be returned as null"+ "\n" + "==================="); return null; } } here TestBase initializes the WebDriver Exception that I get often is (often, because I was also getting time out but then I increased time): org.openqa.selenium.NoSuchElementException: no such element (Session info: chrome=38.0.2125.111) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.3 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 137 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:03:00'
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/42281831

http://stackoverflow.com/q/26873398
has comment: http://stackoverflow.com/comment/42308769
type: Question
tagged with: network-programming
score: 0
type: UnansweredQuestion
tagged with: multithreading
answer count: 0
tagged with: java
tagged with: javafx
has body: Alright, so I created a Client and Server that manipulates a Map via a GUI interface using a text based protocol. The handler below was used to create a "work order" to manipulate the GUI on a separate thread from the network communications. class RemoteInputHandler implements Runnable,SharedVariables { @Override public void run() { try { String input = netComm.reader.readLine(); while (input != null) { // Make a separate copy of the input string String inputCopy = input; // Post a work order to process the command on the GUI thread Platform.runLater(() -&gt; { handleRemote(inputCopy); }); // Get the next remote input input = netComm.reader.readLine(); } } catch (IOException ex) { throw new RuntimeException(ex); } } This pulls the next line of input from the server without freezing up the GUI. I then use the input in the handleRemote() method with a scanner to determine what is done with the input. The string retrieved from the reader looked something like "put key value". I'd then get the first word "put", using a scanner, to get the "command" and use a switch statement to determine how the GUI / Map should be updated on the client and server side respectively. I'm doing another GUI based program that uses a binary protocol instead, but I'm having trouble figuring out how to handle the information in the same way as I did with the readLine() above. Is there a way to do this? Am i thinking about it the wrong way? I thought I could just get all of the bytes into an array, but I'm having trouble even figuring that out. I could really use a hint! Thank you!
has title: Networked GUI handler for binary protocol
has comment: http://stackoverflow.com/comment/42306866

http://stackoverflow.com/q/26980448
tagged with: cdi
has title: Difference between JSF FlowScoped and CDI ConversationScoped
upvote count: 6
type: AnsweredQuestion
tagged with: jsf
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26982956
tagged with: jsf-2.2
score: 6
accepted answer: http://stackoverflow.com/a/26982956
has body: What are the differences between javax.faces.flow.FlowScoped and javax.enterprise.context.ConversationScoped beans and when should either be used in application? Becouse as far as I'm concerned they are somehow similar, but I can not figure it out by the material I found on the Internet?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/26933939
answers question: http://stackoverflow.com/q/26933627
has body: Create custom annotations and annotate them with jaxrs and swagger annotations. Spring’s RestController is a good example: @Controller @ResponseBody public @interface RestController { } Edit: If meta-annotations is not supported by Swagger and/or RestEasy, you can always try APT as a solution.
score: 0
type: Answer

output
tags question: http://stackoverflow.com/q/26941651
tags question: http://stackoverflow.com/q/26908311
tag name: output
type: Tag

netbeans
tags question: http://stackoverflow.com/q/26834928
tags question: http://stackoverflow.com/q/26863012
tags question: http://stackoverflow.com/q/26913923
tags question: http://stackoverflow.com/q/26835800
tags question: http://stackoverflow.com/q/26895661
tags question: http://stackoverflow.com/q/26851372
tags question: http://stackoverflow.com/q/26939289
tags question: http://stackoverflow.com/q/26952986
tags question: http://stackoverflow.com/q/26950140
tags question: http://stackoverflow.com/q/26869564
tags question: http://stackoverflow.com/q/26881826
tags question: http://stackoverflow.com/q/26837855
tags question: http://stackoverflow.com/q/26899581
tags question: http://stackoverflow.com/q/26960832
tags question: http://stackoverflow.com/q/26927155
tags question: http://stackoverflow.com/q/26908618
tags question: http://stackoverflow.com/q/26975195
tags question: http://stackoverflow.com/q/26894248
tags question: http://stackoverflow.com/q/26949419
tags question: http://stackoverflow.com/q/26904283
tags question: http://stackoverflow.com/q/26927269
tags question: http://stackoverflow.com/q/26991437
tags question: http://stackoverflow.com/q/26841648
tags question: http://stackoverflow.com/q/26893951
tags question: http://stackoverflow.com/q/26940557
type: Tag
tags question: http://stackoverflow.com/q/26931864
tags question: http://stackoverflow.com/q/26944382
tags question: http://stackoverflow.com/q/26904348
tags question: http://stackoverflow.com/q/26964031
tags question: http://stackoverflow.com/q/26962309
tags question: http://stackoverflow.com/q/26873117
tags question: http://stackoverflow.com/q/26945439
tags question: http://stackoverflow.com/q/26871810
tags question: http://stackoverflow.com/q/26953956
tags question: http://stackoverflow.com/q/26944185
tags question: http://stackoverflow.com/q/26850168
tags question: http://stackoverflow.com/q/26907096
tags question: http://stackoverflow.com/q/26840952
tags question: http://stackoverflow.com/q/26872054
tags question: http://stackoverflow.com/q/26835911
tags question: http://stackoverflow.com/q/26832694
tags question: http://stackoverflow.com/q/26877570
tags question: http://stackoverflow.com/q/26962925
tags question: http://stackoverflow.com/q/26986324
tags question: http://stackoverflow.com/q/26873970
tags question: http://stackoverflow.com/q/26835107
tags question: http://stackoverflow.com/q/26880262
tags question: http://stackoverflow.com/q/26893347
tags question: http://stackoverflow.com/q/26893480
tags question: http://stackoverflow.com/q/26894055
tags question: http://stackoverflow.com/q/26871417
tags question: http://stackoverflow.com/q/26925356
tags question: http://stackoverflow.com/q/26930651
tags question: http://stackoverflow.com/q/26962455
tags question: http://stackoverflow.com/q/26854557
tags question: http://stackoverflow.com/q/26848647
tags question: http://stackoverflow.com/q/26836850
tags question: http://stackoverflow.com/q/26910423
tags question: http://stackoverflow.com/q/26886692
tag name: netbeans
tags question: http://stackoverflow.com/q/26964602
tags question: http://stackoverflow.com/q/26898958
tags question: http://stackoverflow.com/q/26952988
tags question: http://stackoverflow.com/q/26839878
tags question: http://stackoverflow.com/q/26984430
tags question: http://stackoverflow.com/q/26843764
tags question: http://stackoverflow.com/q/26861475

http://stackoverflow.com/comment/42369185
type: Comment
has text: I updated my answer to the best of my understanding of your situation. without the actual code / the missing parts I cannot give you a definitive answer
type: AnswerComment
comment on: http://stackoverflow.com/a/26892142
score: 0

http://stackoverflow.com/comment/42500085
type: Comment
has text: And a method with a return type must return something
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26982987

http://stackoverflow.com/comment/42403510
has text: No flush != commit it only issues the queries both nothing is committed. Also if you commit your data will be permanently in the database not sure if that is what you want. What is it that you want to test?
type: QuestionComment
comment on: http://stackoverflow.com/q/26928328
score: 0
type: Comment

http://stackoverflow.com/comment/42447623
comment on: http://stackoverflow.com/a/26953575
score: 0
type: AnswerComment
type: Comment
has text: Ah, my bad. aux is a copy of list, so setting it to null has no effect on the actual list object. I think now that we keep a previous node we can simplify the removal somewhat. prev.next = aux.next should do the job. Also, like marcelv said, I would put in a "head". Any decent list implementation should have that.

http://stackoverflow.com/comment/42303003
has text: Netty is not a servlet container and does not have any Servlet related classes (such as `ServletContext`). Even in the example you link the Request object is coming from Jersey and not Grizzly. You will have to clarify your design, how/why Jersey and Netty are combined and interacting. It seems as though your Grizzly configuration is interacting differently with the servlet container (in this case setting the connection object for the servlet request).
type: Comment
comment on: http://stackoverflow.com/a/26855642
score: 0
type: AnswerComment

http://stackoverflow.com/a/26861444
type: Answer
has body: you can use by two ways 1. take a list in action with setter, getter and add data in this list. In jsp page use strcts tag library and in javascript variable put list data. Then call chartjs library function with data like &lt;script type="text/javascript"&gt; var a = new Array(); &lt;s:iterator var="newsVar" value="newsList" status="newsStatus"&gt; a[&lt;s:property value="#newsStatus.index"/&gt;]='&lt;s:property value="id"/&gt;'; &lt;/s:iterator&gt; $(document).ready(function(){ chartjsfunction(a); }); &lt;/script&gt; send ajax call for data to action and send data to chartjs library function.
score: 1
has comment: http://stackoverflow.com/comment/42326844
upvote count: 1
answers question: http://stackoverflow.com/q/26860744
downvote count: 0
has comment: http://stackoverflow.com/comment/42321777

http://stackoverflow.com/comment/42518455
type: Comment
comment on: http://stackoverflow.com/a/26982499
has text: Thanks for your answer. I did have PersistenceContext.EXTENDED turned on and it did solve my problem turning it off.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27009743
has body: Use GATE (https://gate.ac.uk/), a NLP &amp; Machine Learning tool. You can use ANNIE for splitting sentences and POS tagging. You have to prepare training dataset, with sentiments already annotated manually and then use Batch Learning plugin to predict sentiment for training documents. Step-by-step tutorial for this: https://gate.ac.uk/sale/talks/gate-course-may10/track-3/module-11-ml-adv/module-11-sentiment.pdf And the example talked about in the pdf: https://gate.ac.uk/sale/talks/gate-course-may10/track-3/module-11-ml-adv/module-11-sentiment.zip
accepted answer of: http://stackoverflow.com/q/26947373
answers question: http://stackoverflow.com/q/26947373
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26923052
has comment: http://stackoverflow.com/comment/42393464
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/42394297
answer count: 1
tagged with: default
has body: An interface with a default method is initialized even if this method is overridden and even if it's not at all invoked. Example: public interface I { int a = foo(); default void test1(){ } static int foo(){ System.out.println("I initialized"); return 15; } } public class C implements I{ public void test2(){ System.out.print("C initialized"); } } public class Test { public static void main(String[] args) { C c = new C(); c.test2(); } } prints: I initialized C initialized What's exactly the problem here?
type: UnansweredQuestion
tagged with: interface
linked to: http://stackoverflow.com/q/23096084
has title: Interface with default method Initialisation
has answer: http://stackoverflow.com/a/26923085
duplicate of: http://stackoverflow.com/q/23096084
tagged with: methods
type: Question

http://stackoverflow.com/q/26897886
tagged with: jsf
tagged with: java
has body: I used DataTable - Row Selection from prime faces to display list of users and when I run the page I faced this error Cannot find component with expression ":dialog1:employes" referenced from "dialog1:j_idt43:j_idt51" <h:form id="dialog1"> <p:accordionPanel> <p:tab title="nouveau Groupe"> <h:panelGrid columns="2"> <h:outputLabel value="nom groupe" /> <p:inputText value="#{CalCulJobsBean.libelle}" /> </h:panelGrid> <p:commandButton value="submit" action="#{CalCulJobsBean.ajouter()}" icon="ui-icon-check" style="margin-left: 40%" oncomplete="PF('DialogAddGroupesalriers').hide()" /> </p:tab> <p:tab title="liste Salariers"> <h:outputLabel value="Matricule:" /> <p:inputText value="#{donneesIndividuellesBean.matricule}" onkeypress="if (event.keyCode == 13) {onchange(); return false; }"> <p:ajax event="change" listener="#{donneesIndividuellesBean.chercherEmployesByMatricule()}" update=":dialog1:employes" /> </p:inputText> <!-- <p:commandButton icon="ui-icon-plus fa fa-plus" onclick="PF('dialog1').show()" update=":formdialog1"> </p:commandButton> --> <p:commandButton icon="ui-icon-plus fa fa-plus" onclick="PF('dialog2').show()" update=":formdialog1"> </p:commandButton> <p:panel header="liste des salariers"> select + to add <p:dataTable id="employes" value="#{donneesIndividuellesBean.employesCherches}" var="emp" selection="#{donneesIndividuellesBean.identiteSelectionne}" rowKey="#{emp.numedoss}" selectionMode="single"> <f:facet name="header"> </f:facet> <!-- <p:ajax event="rowSelect" execute="@this" update=":employe" /> --> <p:column style="width:40px"> <p:graphicImage value="#{donneesIndividuellesBean.photoE}" cache="false" id="dragImg" style="width:30px; height:40px;"> <f:param name="empid" value="#{emp.numedoss}" /> <p:draggable for="dragImg" revert="true" helper="clone" /> </p:graphicImage> </p:column> <p:column headerText="Matricule"> <h:outputText value="#{emp.matricul}" /> </p:column> <p:column headerText="Nom"> <h:outputText value="#{emp.nom}" /> </p:column> <p:column…
type: Question
tagged with: primefaces
has title: Cannot find component with expression?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26903475
has answer: http://stackoverflow.com/a/26900056
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8634156
duplicate of: http://stackoverflow.com/q/8634156

http://stackoverflow.com/comment/140089838
has text: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/79433503

http://stackoverflow.com/comment/124053826
type: Comment
type: AnswerComment
has text: @Manius Not according to the [documentation](https://openjfx.io/javadoc/16/javafx.controls/javafx/scene/control/Tooltip.html#hideDelayProperty), though I agree it seems weird.
score: 0
comment on: http://stackoverflow.com/a/49927111

http://stackoverflow.com/comment/42345347
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Android Localhost?](http://stackoverflow.com/questions/21800939/android-localhost)
comment on: http://stackoverflow.com/q/26895936

http://stackoverflow.com/q/26847351
tagged with: multidimensional-array
type: Question
accepted answer: http://stackoverflow.com/a/26847491
has body: Writing a program where I randomly insert 0's and 1's into a 4 x 4 array matrix and then need to return the column and row index where 1's occur the most. My first method which checks the rows works fine, but I am having issues in my second check column method. The error is saying that it cannot find the symbol for variable "col". public class AssignmentEight_MultiArray { public static void main(String[] args) { System.out.println("Beginning to insert random integers into array.."); // Declare array matrix int[][] matrix = new int[4][4]; // For loop to insert integers into the array for (int row = 0; row &lt; matrix.length; row++) { for (int col = 0; col &lt; matrix[row].length; col++) { int ranNum = (Math.random() &lt; 0.5) ? 0:1; matrix[row][col] = ranNum; } } // Display contents of the array System.out.println("The values of the array are printed below"); showArray(matrix); System.out.println(); System.out.print("The largest row index: " + scanRow(matrix) + "\n"); System.out.print("The largst column index: " + scanColumn(matrix) + "\n"); } // end main // method to show array contents private static void showArray(int[][] array) { for (int row = 0; row &lt; array.length; row++) { for (int col = 0; col &lt; array[row].length; col++) System.out.print(array[row][col] + "\t"); System.out.println(); } } // row index method private static int scanRow(int[][] array) { int result = -1; int highest = -1; for (int row = 0; row &lt; array.length; row++) { int temp = 0; for (int col = 0; col &lt; array[row].length; col++) { // assign current location to temp variable temp = temp + array[row][col]; } if (temp &gt; highest) { highest = temp; result = row; } } return result; } // end of row method // column index method private static int scanColumn(int[][] array) { int result = -1; int highest = -1; for (int row = 0; row &lt; array.length; row++) { int temp = 0; for (int col = 0; col &lt; array[row].length; col++) { // assing current location to temp variable temp = temp + arra…
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/42257750
possible better answer: http://stackoverflow.com/a/26847646
has answer: http://stackoverflow.com/a/26847646
tagged with: java
score: 2
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26847491
favorite count: 0
has title: Finding index & column in a two dimensional array with the most amount of 1's

http://stackoverflow.com/comment/42403568
score: 0
type: Comment
type: QuestionComment
has text: so what is the correct pattern you are looking for? is it anything/anthing/* ?
comment on: http://stackoverflow.com/q/26928953

text
tags question: http://stackoverflow.com/q/26894263
tags question: http://stackoverflow.com/q/26881826
type: Tag
tags question: http://stackoverflow.com/q/26833507
tags question: http://stackoverflow.com/q/26900943
tags question: http://stackoverflow.com/q/26899619
tags question: http://stackoverflow.com/q/26958591
tag name: text

http://stackoverflow.com/a/26911827
answers question: http://stackoverflow.com/q/26869149
score: 0
has body: well I managed to generate reports using $V{PAGE_NUMBER} == 1 in PrintWhenExpression, adding crosstab in band Sumary and allowing the header and footer is displayed in band Sumary.
type: Answer

http://stackoverflow.com/comment/42382416
has text: Because that is an expression not a placeholder. They are both evaluated in completely different ways.
comment on: http://stackoverflow.com/q/26916598
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42284488
type: QuestionComment
comment on: http://stackoverflow.com/q/26862120
score: 0
has text: The task might be more easily tackled by first print-ing spaces and then println the number: forming one single line.
type: Comment

http://stackoverflow.com/comment/42458855
type: QuestionComment
has text: what you are getting? if you get some error...then logcat please..
score: 1
type: Comment
comment on: http://stackoverflow.com/q/26960236

http://stackoverflow.com/comment/42408375
score: 0
type: QuestionComment
type: Comment
has text: if you paste the sql generated in java into sql, do you get desired values?
comment on: http://stackoverflow.com/q/26920158

http://stackoverflow.com/q/26854906
downvote count: 0
answer count: 1
has title: Java import jgoodies.forms.factories.* cannot be resolved. (Eclipse Luna)
score: 1
tagged with: jgoodies
favorite count: 0
has answer: http://stackoverflow.com/a/26855097
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26855097
type: Question
has body: I've inherited code that uses: import com.jgoodies.forms.factories.FormFactory; I'm attempting to build the project. I've added the jgoodies-forms-1.8.0*.jar files to a 'lib' directory that I made at the same level as the 'JRE System Library' and 'Referenced Libraries' within my Project. /project |-- src | `--(...) |-- JRE System Library |-- Referenced Libraries `-- lib |-- jgoodies-forms-1.8.0-javadoc.jar |-- jgoodies-forms-1.8.0-sources.jar |-- jgoodies-forms-1.8.0-tests.jar `-- jgoodies-forms-1.8.0.jar At the source files that use FormFactory, Eclipse Luna 4.4 tells me that: The import com.jgoodies.forms.factories.FormFactory cannot be resolved. I understand that this is because jgoodies RELEASE-NOTES.txt: CHANGES IN 1.6.0 o Renamed FormFactory to FormSpecs. I figured I could just change "FormFactories" to "FormSpecs" but I get: The import com.jgoodies.forms.factories.FormSpecs cannot be resolved.

http://stackoverflow.com/comment/42439299
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26948814
has text: Parse it out and convert the Unicode.
type: Comment

http://stackoverflow.com/comment/42434153
has text: @Netherland , No.You'll get 2.50 as the cost. BTW,how come that as the consumed unit increases,the cost decreases??
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26945073

http://stackoverflow.com/q/26851274
answer count: 3
accepted answer: http://stackoverflow.com/a/26851414
has title: How can I call this method in another activity?
tagged with: android
score: 0
has answer: http://stackoverflow.com/a/26851414
has body: In my main Activity, I have this method: public void CancelAlarms() { AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent intent = new Intent(context, AlarmReceiver.class); pendingIntent = PendingIntent.getBroadcast(context, 0, intent, 0); manager.cancel(pendingIntent); } but I want to call it in my other activity. How can I call it from one activity to another? Also, would it be alright if I am using context in the method? Would the context change if I call it from another activity to this one?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26851364
tagged with: java
has answer: http://stackoverflow.com/a/26851364
has answer: http://stackoverflow.com/a/26852520
type: Question

http://stackoverflow.com/comment/42457481
type: AnswerComment
type: Comment
has text: public class MockTransacaoActivity extends ActionBarActivity { EditText edtDescricao = null; EditText edtData = null; EditText edtValor = null; private MockBO mockBO; private LoginOpenHelper loginOpenHelper;
comment on: http://stackoverflow.com/a/26959489
score: 0

http://stackoverflow.com/comment/42469728
type: Comment
has text: @DavidWallace I appreciate your concerns for the beginners. IMHO, it's better for them to learn advance stuff from good, gentle teachers (like yourself), than other less-friendlier ones. For a moment, I thought you're gonna pull the ["clarity over brevity"](https://signalvnoise.com/posts/3250-clarity-over-brevity-in-variable-and-method-names) card :-)
type: AnswerComment
comment on: http://stackoverflow.com/a/26965531
score: 0

http://stackoverflow.com/comment/42462531
type: Comment
type: QuestionComment
score: 1
has text: Normally, class names are singular. Event instead of Events.
comment on: http://stackoverflow.com/q/26962198

http://stackoverflow.com/q/26881739
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/75263084
score: 152
has answer: http://stackoverflow.com/a/62834327
has comment: http://stackoverflow.com/comment/42334168
has answer: http://stackoverflow.com/a/45170518
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/50759598
upvote count: 152
tagged with: mysql
has answer: http://stackoverflow.com/a/50457117
has comment: http://stackoverflow.com/comment/42319436
has answer: http://stackoverflow.com/a/66586782
has answer: http://stackoverflow.com/a/37469963
has answer: http://stackoverflow.com/a/73253589
type: Question
linked to: http://stackoverflow.com/q/53630079
has answer: http://stackoverflow.com/a/48984472
possible better answer: http://stackoverflow.com/a/26882135
has answer: http://stackoverflow.com/a/62139178
has answer: http://stackoverflow.com/a/73547131
has answer: http://stackoverflow.com/a/68563630
has answer: http://stackoverflow.com/a/26882135
has answer: http://stackoverflow.com/a/47439006
has answer: http://stackoverflow.com/a/26902713
has answer: http://stackoverflow.com/a/60919750
downvote count: 0
has answer: http://stackoverflow.com/a/78263829
has answer: http://stackoverflow.com/a/60555713
has answer: http://stackoverflow.com/a/65415793
has answer: http://stackoverflow.com/a/55430655
has body: I'm unable to get spring boot to automatically load my database schema when I start it up. Here is my application.properties: spring.datasource.url=jdbc:mysql://localhost:3306/test spring.datasource.username=test spring.datasource.password= spring.datasource.driverClassName = com.mysql.jdbc.Driver spring.jpa.database = MYSQL spring.jpa.show-sql = true spring.jpa.hibernate.ddl-auto = create spring.jpa.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect spring.jpa.hibernate.naming_strategy = org.hibernate.cfg.ImprovedNamingStrategy Here is my Application.java: @EnableAutoConfiguration @ComponentScan public class Application { public static void main(final String[] args){ SpringApplication.run(Application.class, args); } } Here is a sample entity: @Entity @Table(name = "survey") public class Survey implements Serializable { private Long _id; private String _name; private List&lt;Question&gt; _questions; /** * @return survey's id. */ @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "survey_id", unique = true, nullable = false) public Long getId() { return _id; } /** * @return the survey name. */ @Column(name = "name") public String getName() { return _name; } /** * @return a list of survey questions. */ @OneToMany(mappedBy = "survey") @OrderBy("id") public List&lt;Question&gt; getQuestions() { return _questions; } /** * @param id the id to set to. */ public void setId(Long id) { _id = id; } /** * @param name the name for the question. */ public void setName(final String name) { _name = name; } /** * @param questions list of questions to set. */ public void setQuestions(List&lt;Question&gt; questions) { _questions = questions; } } Any ideas what I'm doing wrong?
has answer: http://stackoverflow.com/a/52342880
accepted answer: http://stackoverflow.com/a/26902713
has answer: http://stackoverflow.com/a/55319941
has answer: http://stackoverflow.com/a/54754477
has answer: http://stackoverflow.com/a/42730132
has answer: http://stackoverflow.com/a/27757754
has title: Unable to get spring boot to automatically create database schema
favorite count: 0
has answer: http://stackoverflow.com/a/55193302
answer count: 33
has answer: http://stackoverflow.com/a/36170175
has answer: http://stackoverflow.com/a/75414793
has answer: http://stackoverflow.com/a/55411977
has answer: http://stackoverflow.com/a/37302815
tagged with: spring
has answer: http://stackoverflow.com/a/61062854
has answer: http://stackoverflow.com/a/59375913
has answer: http://stackoverflow.com/a/45829462

http://stackoverflow.com/comment/42481507
has text: @Learner Please mark this answer accepted to close this question. How we thank each other here
comment on: http://stackoverflow.com/a/26971065
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26842678
has comment: http://stackoverflow.com/comment/42249306
accepted answer of: http://stackoverflow.com/q/26841806
answers question: http://stackoverflow.com/q/26841806
score: 5
type: AcceptedAnswer
has body: OK now I have it. You are loading the Laerer Object and then placing it in the session. Somewhere later you try to access a lazy loaded collection on it. But the problem is, that the proxy inside of your list, which should call your database to get the data, needs to be in the same transaction as your call to the database when you loaded Laerer. There a several solutions. When you know that there are not so many objects in that list change to "EAGER" and you are happy. In your DAO after you got the Laerer Object from the entitymanager call the list to load it. Same as loading it directly "EAGER". (JPA defines that an entity can only have one EAGER Loaded list) Don't load directly the list. Instead load the list of IDs when loading Laerer Object. When you then access the list of ids over the session you can call the database again to load the required objects by IDs. For example you can place the list of IDs as a comma seperated string in a transient variable of your entity. This string can directly be use in an SELECT a FROM a.class WHERE a.id IN (:IDS) Query.
type: Answer
has comment: http://stackoverflow.com/comment/42248965
upvote count: 5
downvote count: 0

user-interface
tags question: http://stackoverflow.com/q/26978066
tags question: http://stackoverflow.com/q/26970210
tags question: http://stackoverflow.com/q/26967020
tags question: http://stackoverflow.com/q/26878965
tags question: http://stackoverflow.com/q/26832615
tags question: http://stackoverflow.com/q/26834433
tags question: http://stackoverflow.com/q/26840220
tags question: http://stackoverflow.com/q/26985469
tags question: http://stackoverflow.com/q/26835763
tags question: http://stackoverflow.com/q/26922807
tags question: http://stackoverflow.com/q/26945720
type: Tag
tags question: http://stackoverflow.com/q/26977403
tags question: http://stackoverflow.com/q/26963231
tags question: http://stackoverflow.com/q/26882972
tags question: http://stackoverflow.com/q/26900608
tags question: http://stackoverflow.com/q/26941638
tags question: http://stackoverflow.com/q/26961510
tags question: http://stackoverflow.com/q/26851126
tags question: http://stackoverflow.com/q/26947969
tags question: http://stackoverflow.com/q/26848719
tags question: http://stackoverflow.com/q/26908487
tags question: http://stackoverflow.com/q/26971049
tags question: http://stackoverflow.com/q/26944499
tags question: http://stackoverflow.com/q/26923062
tags question: http://stackoverflow.com/q/26966910
tags question: http://stackoverflow.com/q/26882576
tags question: http://stackoverflow.com/q/26856099
tags question: http://stackoverflow.com/q/26848647
tags question: http://stackoverflow.com/q/26969884
tags question: http://stackoverflow.com/q/26854253
tags question: http://stackoverflow.com/q/26959319
tags question: http://stackoverflow.com/q/26873772
tags question: http://stackoverflow.com/q/26949271
tags question: http://stackoverflow.com/q/26944465
tags question: http://stackoverflow.com/q/26891333
tags question: http://stackoverflow.com/q/26888804
tags question: http://stackoverflow.com/q/26871739
tags question: http://stackoverflow.com/q/26847488
tags question: http://stackoverflow.com/q/26959864
tags question: http://stackoverflow.com/q/26873302
tag name: user-interface
tags question: http://stackoverflow.com/q/26923873
tags question: http://stackoverflow.com/q/26929247
tags question: http://stackoverflow.com/q/26839014
tags question: http://stackoverflow.com/q/26873929
tags question: http://stackoverflow.com/q/26882768
tags question: http://stackoverflow.com/q/26836850
tags question: http://stackoverflow.com/q/26844631
tags question: http://stackoverflow.com/q/26887646
tags question: http://stackoverflow.com/q/26875301
tags question: http://stackoverflow.com/q/26962678
tags question: http://stackoverflow.com/q/26951401

http://stackoverflow.com/comment/42258101
has text: This is a coding convention (one of many) to distinguish parameters (pXXXX) from member variables (mXXXX). Less popular today.
type: QuestionComment
comment on: http://stackoverflow.com/q/26847607
type: Comment
score: 1

http://stackoverflow.com/comment/42507074
has text: I have no experience with making excel sheets with javascript.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26986962

http://stackoverflow.com/q/26982823
has comment: http://stackoverflow.com/comment/42530634
has body: I work on Eclipse Luna on my windows 7, the java version insatlled on the computer itself is up to date. I build some simple JApplet to see how it runs on an html page in my computer. I mean not through 'run as applet' in eclipse, rather on a real html page. But I can not run it due to the restriction - "Application blocked by java security". How can I see it? do I must get certificate for just simple trial? If yes, how to do it with eclipse? Is it a short procedure? Can I see the applet runs without it? Thanks in advance, Liron
score: -1
tagged with: eclipse
has title: Running my JApplet on html in my computer
answer count: 1
tagged with: applet
favorite count: 0
has comment: http://stackoverflow.com/comment/42530440
upvote count: 0
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27012412

http://stackoverflow.com/comment/42274996
type: QuestionComment
comment on: http://stackoverflow.com/q/26856483
has text: try `new File(".").getAbsolutePath()` to see the absolute path and update your file path based on that.
score: 0
type: Comment

http://stackoverflow.com/a/26955039
type: Answer
answers question: http://stackoverflow.com/q/26954994
has body: Option 2 seems fine. Just add column type for tbl_person and extra table tbl_company_data: tbl_person // Here placed the data of "Individuals" and "Company" id type [1 - individual, 2 - company] Data_1 Data_2 ... data_N tbl_customer id person_id Data_1 Data_2 ... data_N tbl_company_data id person_id Data_1 Data_2 ... data_N
score: 0

http://stackoverflow.com/comment/42578148
type: Comment
type: QuestionComment
has text: Please tell us your exact Jdev version! There are other samples for losing files available. Have you tried other samples which come complete with the sources?
score: 0
comment on: http://stackoverflow.com/q/26855676

http://stackoverflow.com/comment/42400785
type: AnswerComment
score: 0
type: Comment
has text: Your answer was very helpful too. Thank you. I was not allowed to choose 2 answers as best on this site. Thanks again. @Jaya
comment on: http://stackoverflow.com/a/26926741

http://stackoverflow.com/q/26953900
linked to: http://stackoverflow.com/q/1179983
has title: Any smart way to store all chars of a very large file into a String?
tagged with: java
has comment: http://stackoverflow.com/comment/42447968
type: Question
linked to: http://stackoverflow.com/q/2356137
answer count: 1
has answer: http://stackoverflow.com/a/26953979
score: 0
has comment: http://stackoverflow.com/comment/42448222
has comment: http://stackoverflow.com/comment/42450465
tagged with: string
linked to: http://stackoverflow.com/q/3038392
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42448273
has comment: http://stackoverflow.com/comment/42447997
has body: with the help of an expert here, i currently have the following: File f = new File(inputFileName); Scanner in = new Scanner(f); String input = in.useDelimiter("\\Z").next(); However, if the file(all text inside) is too huge, my String object will only store from middle onwards till end of file? Any sugggestion? My that file size is around 3,000KB. And also, how much char can a String store?So i know what file size and above will cuz my prog to crash Thanks Update: guys i realized the problem might not be my String is unable to store all the chars in the file but rather it is taking a very long time to process my compression hence. I am still debugging, will update as soon as i am very sure of the issue. Any guys know if substring will caused my prog to be very slow? As i dont thing there are any big issue with my algorithm
has comment: http://stackoverflow.com/comment/42447992

http://stackoverflow.com/comment/42296508
type: QuestionComment
comment on: http://stackoverflow.com/q/26868342
has text: I'm not sure this works, I'm merely presenting it as a possible solution. Apologies for the poor phrasing of the question!
score: 0
type: Comment

http://stackoverflow.com/comment/42366728
has text: @RedBaron no session is not the only way,There are many ways but for that I have to completely understand your scenario.May be next time when I am free I will explain.
comment on: http://stackoverflow.com/a/26907068
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42364011
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26906779
has text: @BenjaminLindqvist "doesn't work" is too broad reason. What exactly it complains about?

http://stackoverflow.com/q/26945247
has comment: http://stackoverflow.com/comment/42433120
tagged with: textview
has comment: http://stackoverflow.com/comment/42433261
has comment: http://stackoverflow.com/comment/42433085
type: AnsweredQuestion
has body: I am having some strange problem with my text view on selected. So basically I have a list view on top, a text box and button at bottom. The list view is populated with data retrieved from database perfectly with no errors. However, when I tried to type in something at the text view, I am getting some error messages: 11-15 19:14:28.622: D/dalvikvm(1686): GC_CONCURRENT freed 622K, 13% free 10976K/12551K, paused 2ms+3ms 11-15 19:14:32.747: D/dalvikvm(1686): GC_CONCURRENT freed 431K, 12% free 11080K/12551K, paused 107ms+3ms 11-15 19:14:35.059: D/dalvikvm(1686): GC_CONCURRENT freed 428K, 11% free 11283K/12615K, paused 29ms+6ms 11-15 19:14:35.075: W/SurfaceView(1686): CHECK surface infomation creating=false formatChanged=false sizeChanged=false visible=false visibleChanged=true surfaceChanged=true realSizeChanged=false redrawNeeded=false left=false top=false 11-15 19:14:42.973: D/dalvikvm(1686): GC_CONCURRENT freed 712K, 14% free 11216K/12935K, paused 2ms+3ms 11-15 19:15:27.770: D/AndroidRuntime(1686): Shutting down VM 11-15 19:15:27.770: W/dalvikvm(1686): threadid=1: thread exiting with uncaught exception (group=0x40c7e1f8) 11-15 19:15:27.864: E/AndroidRuntime(1686): FATAL EXCEPTION: main 11-15 19:15:27.864: E/AndroidRuntime(1686): java.lang.NullPointerException 11-15 19:15:27.864: E/AndroidRuntime(1686): at nyp.edu.eneighbourhood.EventChat$ListAdapter.getView(EventChat.java:112) 11-15 19:15:27.864: E/AndroidRuntime(1686): at android.widget.AbsListView.obtainView(AbsListView.java:2201) 11-15 19:15:27.864: E/AndroidRuntime(1686): at android.widget.ListView.makeAndAddView(ListView.java:1774) 11-15 19:15:27.864: E/AndroidRuntime(1686): at android.widget.ListViewa.fillSpecific(ListView.java:1318) 11-15 19:15:27.864: E/AndroidRuntime(1686): at android.widget.ListView.layoutChildren(ListView.java:1603) 11-15 19:15:27.864: E/AndroidRuntime(1686): at android.widget.AbsListView.onLayout(AbsListView.java:2052) 11-15 19:15:27.864: E/AndroidRuntime(1686): at android.view.View.layou…
has comment: http://stackoverflow.com/comment/42433146
accepted answer: http://stackoverflow.com/a/26945386
type: Question
linked to: http://stackoverflow.com/q/218384
tagged with: java
has comment: http://stackoverflow.com/comment/42433073
has answer: http://stackoverflow.com/a/26945386
tagged with: listview
answer count: 1
score: 0
tagged with: nullpointerexception
has title: NullPointerException when textview selected
tagged with: android

http://stackoverflow.com/q/26940739
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/8268356
linked to: http://stackoverflow.com/q/133925
tagged with: java
duplicate of: http://stackoverflow.com/q/8268356
type: Question
score: 0
answer count: 2
tagged with: jsp
tagged with: javascript
favorite count: 0
has answer: http://stackoverflow.com/a/26941099
possible better answer: http://stackoverflow.com/a/26940773
has title: How can i use Javascript variable as argument in java code in JSP?
has answer: http://stackoverflow.com/a/26940773
has body: I want to send code title and price as an argument to the book object but gives illegal start expression error. function addrecord() { code = document.getElementById('code').value; title = document.getElementById('title').value; price = parseFloat(document.getElementById('price').value); &lt;% Book book = new Book(%&gt; code &lt;% ,%&gt; title &lt;% , %&gt; price &lt;% ); bookdb.addRecord(book); %&gt; document.getElementById("code").value = ""; document.getElementById("title").value = ""; document.getElementById("price").value = ""; }
upvote count: 1
has comment: http://stackoverflow.com/comment/42425487
accepted answer: http://stackoverflow.com/a/26941099
downvote count: 1

http://stackoverflow.com/comment/42466781
comment on: http://stackoverflow.com/q/26962727
score: 0
has text: Hey guys, I found the answer. While in the ~ directory, I did `javac -cp "." keyboard_warriors/test/ConfigTest.java`
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26890603
has answer: http://stackoverflow.com/a/26890711
type: Question
has comment: http://stackoverflow.com/comment/42335186
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42335727
has comment: http://stackoverflow.com/comment/42335341
has comment: http://stackoverflow.com/comment/42335606
tagged with: import
accepted answer: http://stackoverflow.com/a/26890711
has comment: http://stackoverflow.com/comment/42335430
downvote count: 0
answer count: 1
has body: I am trying to import a package to my Main project, but I need to exclude a class. I know that I can individually import each class, but I have so many classes in this package that it would take much too long. Perhaps I can import the entire package, and somehow block the class I don't want?
has comment: http://stackoverflow.com/comment/42335255
favorite count: 0
has comment: http://stackoverflow.com/comment/42335461
has comment: http://stackoverflow.com/comment/42335288
has comment: http://stackoverflow.com/comment/42335193
has comment: http://stackoverflow.com/comment/42335283
has comment: http://stackoverflow.com/comment/42335706
score: 2
has comment: http://stackoverflow.com/comment/42335646
has comment: http://stackoverflow.com/comment/42335221
upvote count: 2
has title: Can I import a package while excluding a certain class?
tagged with: package

http://stackoverflow.com/q/26851973
answer count: 4
has comment: http://stackoverflow.com/comment/42266250
has answer: http://stackoverflow.com/a/26852161
has answer: http://stackoverflow.com/a/26852090
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26852121
has answer: http://stackoverflow.com/a/26852087
has comment: http://stackoverflow.com/comment/42266605
has comment: http://stackoverflow.com/comment/42266492
has comment: http://stackoverflow.com/comment/42266357
tagged with: boolean
has comment: http://stackoverflow.com/comment/42266362
score: 0
has comment: http://stackoverflow.com/comment/42266344
has body: I was wondering if anyone could help me to understand how to eliminate the two member booleans from this method: public boolean testAdd() { boolean addPositSuccess; boolean addNegatSuccess; Double firstPositiveNumber = 22.0; Double secondPositiveNumber = 33.0; calc.x = firstPositiveNumber; if (calc.x(secondPositiveNumber) == (firstPositiveNumber + secondPositiveNumber)) { System.out.println("[ OK ] Calculator can add positive numbers"); addPositSuccess = true; } else { System.out.println("[FAIL] Calculator adds incorrectly"); addPositSuccess = false; } Double firstNegativeNumber = -5.0; Double secondNegativeNumber = -6.0; calc.x = firstNegativeNumber; if (calc.x(secondNegativeNumber) == (firstNegativeNumber + secondNegativeNumber)) { System.out.println("[ OK ] Calculator can add a negative number"); addNegatSuccess = true; } else { System.out.println("[FAIL] Calculator adds with negative numbers incorrectly"); addNegatSuccess = false; } if ((addPositSuccess = true) &amp;&amp; (addNegatSuccess = true)) { return true; } else { return false; } } Lets assume calc is just referring to an instance of a stub class.
has title: How to get rid of these booleans but return a boolean
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42266272

http://stackoverflow.com/q/26953582
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/26953783
score: -1
tagged with: distance
upvote count: 0
has body: I'm currently making a fitness app that can track the running distance. But how to test my coding are working or not except taking the phone and running outside. Is it has another way to test the coding?
answer count: 1
favorite count: 0
has title: How to Test My Coding for Track Running Distance Function in android
has comment: http://stackoverflow.com/comment/42448773
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42447459
tagged with: tracking
tagged with: java
downvote count: 1

http://stackoverflow.com/q/26920583
has comment: http://stackoverflow.com/comment/42401751
has title: xjc or jaxb2-maven-plugin or maven: weird behavior while compiling XSDs, processing files twice but with altered names?
has answer: http://stackoverflow.com/a/26928970
has comment: http://stackoverflow.com/comment/42403513
upvote count: 2
answer count: 3
tagged with: maven
has answer: http://stackoverflow.com/a/26948296
tagged with: jaxb2-maven-plugin
tagged with: java
has answer: http://stackoverflow.com/a/26934618
type: UnansweredQuestion
tagged with: jaxb
has body: Not sure where the issue is here; I suspect XJC but it's been driven by the jaxb2-maven-plugin within maven, so there's a couple of layers to unpack. I'm compiling a folder of XSDs and it seems to be processing each file twice, once with the actual filename and once with a slightly altered filename. [This is on OSX, by the way, but I don't think it's a straight case-sensitive filesystem problem at all (as you'll see later).] Here's the relevant part of the pom.xml: org.codehaus.mojo jaxb2-maven-plugin 1.6 xjc xjc src/main/resources The src/main/resources contains these XSDs: ATIS_03_00_74_Local.xsd ITIS_Final_3_0_0.xsd LRMS_Final_09_07.xsd TCIP_4_0_0_Final.xsd ATIS_Partial_03_00_74.xsd ITIS_Final_3_0_0_for_atis.xsd LRMS_Final_09_07_for_atis.xsd TCIP_4_0_0_Local.xsd IM_03_00_38_Local.xsd ITIS_Local_for_atis.xsd LRMS_Final_09_07_for_im.xsd TMDD_Partial_0_0_0.xsd IM_Partial_03_00_38.xsd ITIS_Local_for_im.xsd LRMS_Local_for_atis.xsd ITIS_3_0_0_Local.xsd LRMS_09_07_Local.xsd LRMS_Local_for_im.xsd when I run maven, it fails on very single file with something like: [ERROR] file:/Users/dhaskin/clients/cs/onebusaway-nyc/onebusaway-nyc-tcip-api/src/main/resources/atis_Partial_03_00_74.xsd[35,50] org.xml.sax.SAXParseException: 'RouteRequest' is already defined ... [ERROR] file:/Users/dhaskin/clients/cs/onebusaway-nyc/onebusaway-nyc-tcip-api/src/main/resources/ATIS_Partial_03_00_74.xsd[22,38] org.xml.sax.SAXParseException: (related to above error) the first definition appears here ... note that the filename in the first error doesn't even exist; it's the same as the 2nd filename (which does exist) with the first underscore-separated word transformed to lowercase (but note the second word, Partial, is left unchanged). Looking at maven -X output, I'm pretty sure it's XJC itself that's doing this, but I haven't been able to determine yet how to fix it. Note that this project is a sub-project in a larger maven project, but I don't think that's relevant. For what it's worth, my mave…
score: 2
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/26936271
tagged with: xjc
type: Question

http://stackoverflow.com/comment/42242936
has text: Thank you so much , it worked! for others-with details : I changed the file extension to xml on windows, sent it to myself by mail , downloaded on the computer that has ubuntu, copied the xml file to the project workspace instead of the ser file and changed the code to read an xml file - fileInput = new FileInputStream("file.xml") and ---- I have all my data!!! Thank you!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26838817

http://stackoverflow.com/comment/44256650
type: AnswerComment
type: Comment
has text: @MukeshRana this code works but if device notification sound is off then it does not increase the volume and finally no notification sound listens
comment on: http://stackoverflow.com/a/26931746
score: 0

http://stackoverflow.com/q/26886642
has answer: http://stackoverflow.com/a/26889372
has title: DISTINCT not eliminating the duplicate records- Why?
accepted answer: http://stackoverflow.com/a/26892472
possible better answer: http://stackoverflow.com/a/26889372
downvote count: 0
has body: DISTINCT is not working as usual on DB2 database query SELECT DISTINCT PF1 FROM ( SELECT DISTINCT PF1 FROM RELATIONS UNION SELECT DISTINCT PF2 FROM RELATIONS ) WHERE PF1 NOT IN ( SELECT DISTINCT NAME FROM REFERENCES WHERE TYPE = 'F' ); This query is giving duplicate results as C1:PROV C1:PROV WK:HEADER WK:HEADER WK:HEADER etc What thing/setting is responsible for this abnormal behavior?? FYI: Same query gives correct result on another machine's database. Edited Here are the table's structure CREATE TABLE RELATIONS ( PF1 VARCHAR(54) NOT NULL, PF1TXT VARCHAR(50), PF2 VARCHAR(54) NOT NULL, SEQ DOUBLE NOT NULL, PF2TXT VARCHAR(50), UNIQUE (PF1, SEQ, PF2) ); CREATE TABLE REFERENCES ( NAME1 VARCHAR(54) NOT NULL, NAMETXT VARCHAR(50) NOT NULL, NAME VARCHAR(54) NOT NULL, TYPE VARCHAR(1) NOT NULL, UNIQUE (NAME1, NAMETXT, NAME, TYPE) );
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42327980
has comment: http://stackoverflow.com/comment/42331440
has answer: http://stackoverflow.com/a/26892472
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42329796
tagged with: db2
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42330219
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/42331271
tagged with: sql
favorite count: 0

http://stackoverflow.com/a/26859983
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42307885
has comment: http://stackoverflow.com/comment/42307907
answers question: http://stackoverflow.com/q/26855216
accepted answer of: http://stackoverflow.com/q/26855216
has body: This would be actually incorrect, as null property is semantically different from this property stubbed with some default value. So setting some new Account() to account property for a missing value would not be correct. If you want to simplify your code, consider using JAXB2 Fluent API plugin. You'll be probably able get code like: rootObject.withAccount().getAccountName() (Implicitly initializes account.) I am not 100% sure if it will work that way, but definitely worth giving it a try. Update A few notes on your comments. I looked at the link you've posted and tried to look it up online but if I understand correctly, it is mostly used for populating values in the objects rather than reading them. The link you sent says: The FluentApi plugin provides Method Chaining for bean setters. I was looking for a way to somehow avoid checking for nulls when trying to access nested classes. You are correct. However you said specifically "unmarshal the full object tree to include those representing missing elements". My point is, it would be incorrect for JAXB to fill in these missing properties, but you can do this and the Fluent API plugin is the closes I would know to an easy-to-use API for this case. But this does not answer your question as, probably, there is no answer at the moment. The comments there mostly suggest to either suck it up and check for null values along the way, use reflection, or just catch the error. I ended up going with the first option for performance considerations. Probably the best thing you can do at the moment. This is what I do (checking for nulls) all the time. Well, not quite nice, but also quite trivial. Next, I though a bit on how could this be solved at all? XJC supports plugins which can augment the generated code. This is a very powerful tool, I did a great lot with these plugins. But what code should be generated? How should it look like in Java? Filling properties with default values is simply not correct. I think gooing this way will…
upvote count: 2
type: AcceptedAnswer

dining-philosopher
type: Tag
tags question: http://stackoverflow.com/q/26835107
tag name: dining-philosopher

http://stackoverflow.com/a/26930349
accepted answer of: http://stackoverflow.com/q/26894248
answers question: http://stackoverflow.com/q/26894248
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Keep in mind that Web Pages and Source packages are different things. To use the classes inside Source packages with custom files, you have to place your files inside a Package and use getClass().gerResource() like this: In case the ErrorSet folder is a folder inside another package use this: File file = new File(getClass().getResource("ErrorSet/error_list.xml").toURI()); And if the error_list.xml is in the same package as the class, simply use getResource("error_list.xml").
type: Answer
has comment: http://stackoverflow.com/comment/42411436
upvote count: 1

http://stackoverflow.com/comment/42313298
type: Comment
type: QuestionComment
has text: @August But that's an implementation detail, which is of course allowed be different.
comment on: http://stackoverflow.com/q/26878117
score: 0

file
tags question: http://stackoverflow.com/q/26836626
type: Tag
tags question: http://stackoverflow.com/q/26854944
tags question: http://stackoverflow.com/q/26943195
tags question: http://stackoverflow.com/q/26921261
tags question: http://stackoverflow.com/q/26852254
tags question: http://stackoverflow.com/q/26948497
tag name: file
tags question: http://stackoverflow.com/q/26908368
tags question: http://stackoverflow.com/q/26878566
tags question: http://stackoverflow.com/q/26866975
tags question: http://stackoverflow.com/q/26867366
tags question: http://stackoverflow.com/q/26949985
tags question: http://stackoverflow.com/q/26899596
tags question: http://stackoverflow.com/q/26895451
tags question: http://stackoverflow.com/q/26921524
tags question: http://stackoverflow.com/q/26924700
tags question: http://stackoverflow.com/q/26947287
tags question: http://stackoverflow.com/q/26935595
tags question: http://stackoverflow.com/q/26894501
tags question: http://stackoverflow.com/q/26941622
tags question: http://stackoverflow.com/q/26961032
tags question: http://stackoverflow.com/q/26990712
tags question: http://stackoverflow.com/q/26983024
tags question: http://stackoverflow.com/q/26917123
tags question: http://stackoverflow.com/q/26898373
tags question: http://stackoverflow.com/q/26865775
tags question: http://stackoverflow.com/q/26895462
tags question: http://stackoverflow.com/q/26934202
tags question: http://stackoverflow.com/q/26990618
tags question: http://stackoverflow.com/q/26840117
tags question: http://stackoverflow.com/q/26962727
tags question: http://stackoverflow.com/q/26865474
tags question: http://stackoverflow.com/q/26839673
tags question: http://stackoverflow.com/q/26990039
tags question: http://stackoverflow.com/q/26960497
tags question: http://stackoverflow.com/q/26933928
tags question: http://stackoverflow.com/q/26967252
tags question: http://stackoverflow.com/q/26850724
tags question: http://stackoverflow.com/q/26857191

http://stackoverflow.com/comment/42470268
type: Comment
comment on: http://stackoverflow.com/a/26966251
score: 0
type: AnswerComment
has text: That gives the flexibility in case you need to update what the keyword (or in this case the annotation) means and also offer backward compatibility. You can simply add a new annotation and mark the old one as deprecated.

http://stackoverflow.com/q/26938510
type: Question
has comment: http://stackoverflow.com/comment/42421382
has title: Need help method calling program - day number in year
score: 0
answer count: 2
has body: basically I am in the middle of my program that involves asking a user to enter a day,month, and year, and based on that entry I am supposed to create a method that calculates the number of days in the year, but of course I need a method that defines how many days are in each month, and a method that determines whether or not it is a leap year or not. I have established my methods, user input, but now I am having method/return issue. Here is what I have so far: import java.util.Scanner; public class DayNumber{ public static void main(String[] args){ int year; int month; int day; Scanner keyboard = new Scanner(System.in); System.out.print("Enter the date's year (0001 - 9999): "); year = keyboard.nextInt(); System.out.print("Enter the date's month (1 - 12): "); month = keyboard.nextInt(); System.out.print("Enter the date's day (1 - 31): "); day = keyboard.nextInt(); } public static int numberOfDays(int day, int month, int year){ int numberOfDays; return numberOfDays; } public static int daysInMonth(int month, int year){ int daysInMonth; if (month ==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12){ month = 31;} if (month ==4 || month ==6 || month==9|| month==11){ month = 30;} else if (month ==2){ if (){ } } return daysInMonth; } public static boolean isLeapYear(int year){ if (((year%4 == 0) &amp;&amp; (year%100 != 0)) || (year%400 ==0)){ return true; } else{ return false; } } } I would appreciate any advice or tips. I am really new to Java so go ahead and critique away! Thanks.
has comment: http://stackoverflow.com/comment/42421524
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26938639
has answer: http://stackoverflow.com/a/26938718
tagged with: java

rtmp
tag name: rtmp
tags question: http://stackoverflow.com/q/26928831
type: Tag

opennlp
type: Tag
tags question: http://stackoverflow.com/q/26987362
tags question: http://stackoverflow.com/q/26975716
tag name: opennlp

http://stackoverflow.com/comment/42259448
type: Comment
has text: Cool glad you figured it out...
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26847582

http://stackoverflow.com/a/32988692
answers question: http://stackoverflow.com/q/26869143
downvote count: 0
has body: Sorry this is late, but possibly it may help someone else stuck with this. The easiest way I have found to accomplish this is to set the android:input value like so: &lt;EditText android:id="@+id/editText" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="numberDecimal|numberSigned" /&gt; "numberDecimal" - means that it will accept floating point numbers. "numberSigned" - means it will accept positive &amp; negative numbers. This ^^^ combination will only allow users to enter integers or floating point numbers! Then if you wish to parse this value you may want to try something like this: String numberAsString = "22.13"; try { int number = Integer.parseInt(numberAsString); } catch (NumberFormatException e) { try { float number = Float.parseFloat(numberAsString); } catch (NumberFormatException ex) { Log.e(TAG, "Not float value", e); Log.e(TAG, "Not integer value", ex); } }
score: 3
type: Answer
upvote count: 3

http://stackoverflow.com/comment/42466073
comment on: http://stackoverflow.com/a/26963970
type: Comment
has text: @ankur-singhal ahh I knew that! thank you! how do I get as good as you?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26895496
possible better answer: http://stackoverflow.com/a/26895600
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26895559
has body: Around here - if (code&lt;10 || code&gt;99) seems to be the issue. When entering a number outside the range the loop continues infinitely, seemingly ignoring the condition. I tried System.exit(0), though that did the job I would like to try and use the while loop to stop the code. import java.util.*; public class LockPicker { public static void main(String[] args) { Scanner kb = new Scanner(System.in); Random r = new Random(); boolean stop = false; while (!stop) { System.out.print("What is the unlock code? "); int code = kb.nextInt(); if (code&lt;10 || code&gt;99) { System.out.println("Your number must be between 10 and 99"); stop = !stop; } System.out.println("Picking the lock..."); System.out.println(""); int x = -1, counter = 0; while (x!=code) { x = r.nextInt(90)+10; System.out.println(x); counter++; } System.out.println("That took only "+counter+" tries to pick the lock!"); stop = !stop; } } }
has comment: http://stackoverflow.com/comment/42344449
tagged with: while-loop
has comment: http://stackoverflow.com/comment/42344642
accepted answer: http://stackoverflow.com/a/26895559
type: AnsweredQuestion
tagged with: loops
has answer: http://stackoverflow.com/a/26895600
type: Question
has title: Java boolean conditioned while loop seemingly ignoring an if statement?

http://stackoverflow.com/comment/42252335
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26844324
has text: OK I wanted to be sure it was done this way. probably depends on the need, thank you.

http://stackoverflow.com/a/26969520
answers question: http://stackoverflow.com/q/26969490
downvote count: 0
upvote count: 2
has body: You have missed the , msg.setFrom(username); method ,which should be configured to send the email from your account. As docs says. Set the "From" attribute in this Message. The value of this attribute is obtained from the property "mail.user". If this property is absent, the system property "user.name" is used. And also read this thread JavaMail API, Gmail-Auth and setFrom
has comment: http://stackoverflow.com/comment/42478196
type: Answer
score: 2

http://stackoverflow.com/a/26920449
score: 0
type: AcceptedAnswer
has body: A more hacky solution: sleep &lt;your_preferend_timeout&gt; &amp;&amp; execute_whatever_you_want_here &amp;
accepted answer of: http://stackoverflow.com/q/26919913
type: Answer
answers question: http://stackoverflow.com/q/26919913
has comment: http://stackoverflow.com/comment/42416010
has comment: http://stackoverflow.com/comment/42443625
has comment: http://stackoverflow.com/comment/42410374

http://stackoverflow.com/q/26963357
has comment: http://stackoverflow.com/comment/42464835
type: Question
has body: I'm trying to take the String contents from 2 text files and perform a union with the tables. However my code keeps outputting the table@hexidecimal object location, rather than the string content inside the file. Here's a sample of my code: /** * ----------------------------------------------------------------------------------------------------- * Purpose : This class is used to create a row for a two dimensional data * * ----------------------------------------------------------------------------------------------------- */ class Table { String ID = ""; String name = ""; Table(String ID, String name) { this.ID = ID; this.name = name; } } /** * ----------------------------------------------------------------------------------------------------- * Purpose : This class is used to show how to work with two dimensional data * ----------------------------------------------------------------------------------------------------- */ public class RelationalAlgebra { /** * It reads a two columns table into a two dimensional array * * @return ArrayList&lt;Table&gt; * @throws IOException */ ArrayList&lt;Table&gt; getTable(String fileName) throws IOException { ArrayList&lt;Table&gt; T1 = new ArrayList&lt;Table&gt;(); // creates an array list File inFile = new File(fileName); // creates a file object Scanner scanner = new Scanner(inFile); // Scanner is a reader class int repetition = 1; // used to skip the 1st line from input file while (scanner.hasNext()) { // reads until not data if (repetition == 1) { // if 1st line, skips scanner.next(); scanner.next(); repetition = 2; } else { // else reads each column String ID = scanner.next(); String name = scanner.next(); T1.add(new Table(ID, name)); } } scanner.close(); // close input stream return T1; // returns the new table in the form of ArrayList } /** * It prints the content of an ArrayList&lt;Table&gt; * * @param t */ void printTable(ArrayList&lt;Table&gt; t) { for (int i = 0; i &lt; t.size(); i++) { System.out.println(t.get(i)…
answer count: 1
has comment: http://stackoverflow.com/comment/42464703
has comment: http://stackoverflow.com/comment/42464859
favorite count: 0
has answer: http://stackoverflow.com/a/26963522
upvote count: 3
has title: Java Relational Algebra Union
downvote count: 2
has comment: http://stackoverflow.com/comment/42464735
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26963522

http://stackoverflow.com/comment/42283235
type: QuestionComment
comment on: http://stackoverflow.com/q/26859738
has text: You mean to say, in the form bean, I should have a randomly generated hidden token? And when user do some action, before processing the action, i should validate the token?
score: 0
type: Comment

http://stackoverflow.com/q/26882086
has comment: http://stackoverflow.com/comment/42320781
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26882454
has comment: http://stackoverflow.com/comment/42320182
answer count: 4
tagged with: java
has body: I want to have two Set collections holding unique objects based on different implementations of the equals/hashCode for the same kind of object. For example, one Set would be only for the elements that have a different timestamp and the equals should return a.timestamp!=b.timestamp, but the other set could be only for elements that have different names with equals like a.name!=b.name. Is there a trivial way to achieve this? How can you make custom equals for each different Set?
has answer: http://stackoverflow.com/a/26882430
type: Question
has comment: http://stackoverflow.com/comment/42320609
has comment: http://stackoverflow.com/comment/42320677
has answer: http://stackoverflow.com/a/26882328
score: 2
has answer: http://stackoverflow.com/a/26882519
downvote count: 0
has title: Different Set collection based in different equals / hashcode
has comment: http://stackoverflow.com/comment/42320404
favorite count: 0

http://stackoverflow.com/comment/94068111
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28787519
has text: Changing 'List' to 'Set' worked for me on a @ElementCollection(fetch = FetchType.EAGER) private Set<Colour> colours; @ElementCollection(fetch = FetchType.EAGER) private Set<Accessory> accessories;

http://stackoverflow.com/q/26878111
tagged with: java.util.scanner
has title: Feed a Scanner via String
tagged with: args
answer count: 1
has body: Heres my basic goal: Convert a program that uses a Scanner and the keyboard as input into a program that uses the Scanner and java args as input. This will be done programatically for a variety of programs, so I'd like to make as few and as small changes to the actual program itself. I'm able to do this by changing Scanner scanner = new Scanner(System.in); into Scanner scanner = new Scanner(args[0]);. Now I can seperate each argument with a space in args[0] and the program runs fine, but ONLY if it doesn't use scanner.nextLine(). As soon as scanner.nextLine() is used, the scanner munches up the entire String and breaks the program. I can't figure out a workaround without changing the program structure all together (Removing all the scanner.nextLine()s. Is there maybe some sort of character/sequence that will stop scanner.nextLine(), or will it always process the entire String? Thanks Edit: My initial idea was to give the scanner a String array and have it go through that, index by index, regardless of which method was used (next, nextInt, nextLine). Is that perhaps possible?
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26878180
type: AnsweredQuestion
tagged with: string
type: Question
accepted answer: http://stackoverflow.com/a/26878180

http://stackoverflow.com/comment/42389840
type: Comment
has text: @DavidWallace do you mean that you recommend to always use doReturn() when using spies, or to always use it, even with mocks? I tend to always use it with spies, but find the classical wen(...).then... more readable and thus use that for mocks.
type: AnswerComment
comment on: http://stackoverflow.com/a/26920558
score: 0

http://stackoverflow.com/q/26981649
has answer: http://stackoverflow.com/a/26981746
has answer: http://stackoverflow.com/a/26981705
has answer: http://stackoverflow.com/a/26982223
answer count: 6
accepted answer: http://stackoverflow.com/a/26981705
downvote count: 2
tagged with: calendar
has answer: http://stackoverflow.com/a/26982146
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/26981777
has comment: http://stackoverflow.com/comment/42497454
has answer: http://stackoverflow.com/a/46306557
type: AnsweredQuestion
has body: The doc here at Oracle says Calendar class is an abstract class. The same doc also says Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time: Calendar rightNow = Calendar.getInstance(); After going through the discussions at this post of stackoverflow I understand we can not create object of abstract class.To create an object of abstract class we must implement its concrete subclass. Can somebody please help me understand ( or point me to some references) why we can create an object of Calendar class even the class itself is an abstract class? OR I am missing some very important points about abstract class
linked to: http://stackoverflow.com/q/4321386
favorite count: 0
type: Question
possible better answer: http://stackoverflow.com/a/26981746
has comment: http://stackoverflow.com/comment/42498144
score: 3
has title: calendar.getInstance() - how it return object

http://stackoverflow.com/comment/42412635
score: 0
type: AnswerComment
type: Comment
has text: Any reason for using explicit indexed access rather than `for(String value : arr)`?
comment on: http://stackoverflow.com/a/26930568

http://stackoverflow.com/q/26955189
downvote count: 0
tagged with: windows
favorite count: 0
tagged with: service
type: UnansweredQuestion
has title: JNI_CreateJavaVM fails from windows service
has comment: http://stackoverflow.com/comment/42523133
answer count: 0
score: 1
tagged with: java-native-interface
tagged with: java
upvote count: 1
tagged with: windows-services
type: Question
has comment: http://stackoverflow.com/comment/42489369
has body: When I run my code from console it works fine: the jvm gets created and runs my application. However, if I run the executable as a windows service JNI_CreateJavaVM fails and returns -1. Do I need to configure something in my service for it to work? Thanks Edit: Adding code examples I downloaded Microsoft's service example and modified it to my needs. Basically when the service starts it runs this function in a new thread: void CWSMService::ServiceWorkerThread(void) { // Periodically check if the service is stopping. wchar_t szMessage[260]; JNIEnv *env = NULL; JavaVM *vm = NULL; while (!m_fStopping) { jint res; jclass cls; jmethodID mid; res = JNI_CreateJavaVM(&amp;vm, (void**)&amp;env, getVMArgs()); if(res &lt; 0) { StringCchPrintf(szMessage, ARRAYSIZE(szMessage), L"Can't create Java VM (%d)", res); WriteEventLogEntry(szMessage, EVENTLOG_ERROR_TYPE); break; } cls = env-&gt;FindClass(JAVA_BOOTSTRAP_CLASS); if (cls == NULL) { StringCchPrintf(szMessage, ARRAYSIZE(szMessage), L"Class not found %s", JAVA_BOOTSTRAP_CLASS_WIDE); WriteEventLogEntry(szMessage, EVENTLOG_ERROR_TYPE); vm-&gt;DestroyJavaVM(); break; } mid = env-&gt;GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V"); if (mid == 0) { StringCchPrintf(szMessage, ARRAYSIZE(szMessage), L"No main() method in class %s", JAVA_BOOTSTRAP_CLASS_WIDE); WriteEventLogEntry(szMessage, EVENTLOG_ERROR_TYPE); vm-&gt;DestroyJavaVM(); break; } env-&gt;CallStaticVoidMethod(cls, mid, getProgramArgs(env)); jthrowable exc = env-&gt;ExceptionOccurred(); if (exc) { jboolean isCopy = false; jmethodID toString = env-&gt;GetMethodID(env-&gt;FindClass("java/lang/Object"), "toString", "()Ljava/lang/String;"); jstring s = (jstring) env-&gt;CallObjectMethod(exc, toString); const char* utf = env-&gt;GetStringUTFChars(s, &amp;isCopy); StringCchPrintf(szMessage, ARRAYSIZE(szMessage), L"Java Exception: %s", utf); WriteEventLogEntry(szMessage, EVENTLOG_ERROR_TYPE); env-&gt;ReleaseStringUTFChars(s,utf); vm-&gt;DestroyJavaVM(); break; } } if (vm)…

http://stackoverflow.com/q/26861058
linked to: http://stackoverflow.com/q/10190132
answer count: 2
has answer: http://stackoverflow.com/a/26862588
tagged with: arrays
has comment: http://stackoverflow.com/comment/57646814
tagged with: sorting
has title: SelectionSort variation not working
tagged with: selection-sort
score: 0
possible better answer: http://stackoverflow.com/a/26863149
has answer: http://stackoverflow.com/a/26863149
accepted answer: http://stackoverflow.com/a/26862588
type: Question
type: AnsweredQuestion
has body: I have to implement a Selection Sort in Java according to these parameters: Implement a variation to the SelectionSort that locates both the smallest and largest elements while scanning the list and positions them at the beginning and the end of the list, respectively. On pass number one, elements x0,...,xn-1 are scanned; on pass number two, elements x1,...,xn-2 are scanned; and so on. I am passing the method an array of size 32, and when I print the array it is not sorted. What's the matter with my code? static void selectionSort() { scramble(); int smallIndex = 0; //index of smallest to test int largeIndex = array.length - 1; //index of largest to test int small = 0; //smallest int large; //largest int smallLimit = 0; //starts from here int largeLimit = array.length - 1; //ends here int store; //temp stored here int store2; for(int i = 0; i &lt; array.length/2; i++) { //TODO not working... small = array[smallLimit]; large = array[largeLimit]; for(int j = smallLimit; j &lt;= largeLimit; j++) { if(array[j] &lt; small) { smallIndex = j; small = array[j]; } else if(array[j] &gt; large) { largeIndex = j; large = array[j]; } } store = array[smallLimit]; store2 = array[smallIndex]; array[smallLimit] = store2; array[smallIndex] = store; store = array[largeLimit]; array[largeLimit] = array[largeIndex]; array[largeIndex] = store; smallLimit++; largeLimit--; } print(); }
tagged with: java

http://stackoverflow.com/comment/42285007
type: QuestionComment
comment on: http://stackoverflow.com/q/26862243
score: 2
has text: http://stackoverflow.com/questions/19889132/xslthe-processing-instruction-target-matching-xxmmll-is-not-allowed
type: Comment

http://stackoverflow.com/comment/42289513
comment on: http://stackoverflow.com/q/26859222
score: 0
type: Comment
type: QuestionComment
has text: i know , that's is the problem in VRTL_PI_BOI_DLVR_ACTIONS BOI_DLVR_ID is f.k to BOI_DLVR_ID in VrtlPiBoiDlvr and VrtlPiBoiDlvrIfn is acollection of entity in VRTL_PI_BOI_DLVR_ACTIONS (i know how to get actionId thet is p.k in VRTL_PI_BOI_DLVR_ACTIONS but i dont know how to get BOI_DLVR_ID

http://stackoverflow.com/q/26920335
type: Question
tagged with: java
tagged with: date
tagged with: substring
score: 0
has body: I have an input GEDCOM file with tons of individual/family records. The purpose is to format their data into this form: name(p6, 'Harry Buis'). birth(p6, date(1927,11,17)). death(p6, date(2001,08,21)). famc(p6, f3). fams(p6, f2). I have been able to pull out the person number and their name and print it to an output file, however I am having trouble parsing the birth/death dates. I want to be able to use substring to assign the birthDay, birthMonth, and BirthYear as Integers so I can print it to the output file. It must be Integers so I can sort by date. Here is a sample of one client's data from the input file. 0 @P6@ INDI 1 BIRT 2 DATE 17 Nov 1924 1 NAME Harry /Buis/ 1 DEAT Age: 76 2 DATE 21 Aug 2001 1 SEX M 1 FAMC @F3@ 1 FAMS @F2@ And here is my source code of what I have so far: public class Main { static Scanner scan; static BufferedWriter outFile; static int birthYear = 0; static int birthMonth = 0; static String birthDay = ""; static int deathYear = 0; static int deathMonth = 0; static int deathDay = 0; static String name = ""; static String person = ""; static String sex = ""; static String famC = ""; static String famS = ""; static String man = ""; static String woman = ""; static String child = ""; public static void parse() throws IOException { scan = new Scanner(new FileReader("pbuis.ged")); outFile = new BufferedWriter(new FileWriter("output.txt")); String reader = scan.nextLine(); int count = 0; while (scan.hasNextLine()) { if (reader.contains("NAME") &amp;&amp; count &lt; 1) { reader = reader.substring(1).replace("/", ""); count++; System.out.println(reader); name = reader.replace("NAME", ""); } if (reader.startsWith("0")) { person = reader.trim().substring(2, 7).replace("@", "") .replace("I", "").trim().toLowerCase(); System.out.print(person); count = 0; } if (reader.contains("BIRT")) { scan.nextLine(); birthDay = Integerreader.substring(6, 9).trim(); } if (reader.equalsIgnoreCase("") || reader.equalsIgnoreCase(" ")) { outFile.write("name(" + person …
answer count: 2
tagged with: gedcom
has title: Reading GEDCOM files: How to substring the corresponding birth day, month, and year, into an Integer variable from an input file to an output file
has answer: http://stackoverflow.com/a/26920415
type: UnansweredQuestion
tagged with: parsing
has answer: http://stackoverflow.com/a/38542139

http://stackoverflow.com/comment/42434820
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26941676
score: 0
has text: Why do you need the session, you wanted the user (authentication) and that is what you get. As long as you handle events synchronously you could get access to the session or whatever you like but in general you want to write such code not dependent on things like that.

http://stackoverflow.com/comment/42359360
has text: @adrian-b you should not fix OP code in edit, this may lead to bad situations (question no longer valid etc)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26903555

http://stackoverflow.com/q/26893717
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42341058
has body: Currently I have a game that I am building in Netbeans, and have been able to create a board, place the pieces and allow them to be moved anywhere using mouseveent's But now I have ran into a problem when trying to code the pieces on the board to only do allowed actions. The problem I am having is that every piece is still allowed to be moved but now when it is moved the selected piece disappears from the board completely ingorning all the new function in the mouse release event The code I am trying to add is for the WhitePawn which is the only piece that should be allowed to move right now The rest if they are tried to move should just return to there set positions regardless of where they are dragged. I have removed all code not relevant to the question and ran the debugger. From that I know a fact that the problem is somewhere in the mouse release event code, I just cant find it. public void mouseReleased(MouseEvent e) { if (chessPiece == null) { return; } chessPiece.setVisible(false); Boolean success = false; Component c = chessBoard.findComponentAt(e.getX(), e.getY()); String tmp = chessPiece.getIcon().toString(); String pieceName = tmp.substring(0, (tmp.length() - 4)); Boolean validMove = false; //Pawn Moves //White Pawn if (pieceName.equals("WhitePawn")) { if (startY == 1) { if ((startX == (e.getX() / 75)) &amp;&amp; ((((e.getY() / 75) - startY) == 1) || ((e.getY() / 75) - startY) == 2)) { if ((((e.getY() / 75) - startY) == 2)) { if ((!piecePresent(e.getX(), (e.getY()))) &amp;&amp; (!piecePresent(e.getX(), (e.getY() + 75)))) { validMove = true; } else { validMove = false; } } else { if ((!piecePresent(e.getX(), (e.getY())))) { validMove = true; } else { validMove = false; } } } else { validMove = false; } } else { int newY = e.getY() / 75; int newX = e.getX() / 75; if ((startX - 1 &gt;= 0) || (startX + 1 &lt;= 7)) { if ((piecePresent(e.getX(), (e.getY()))) &amp;&amp; ((((newX == (startX + 1) &amp;&amp; (startX + 1 &lt;= 7))) || ((newX == (startX - 1)) &amp;&a…
tagged with: java
has comment: http://stackoverflow.com/comment/42382508
has comment: http://stackoverflow.com/comment/42640876
tagged with: mouseevent
type: Question
has comment: http://stackoverflow.com/comment/42621359
has comment: http://stackoverflow.com/comment/42459501
answer count: 1
has comment: http://stackoverflow.com/comment/42375694
has comment: http://stackoverflow.com/comment/42341114
has answer: http://stackoverflow.com/a/26898271
favorite count: 0
has comment: http://stackoverflow.com/comment/42383051
has comment: http://stackoverflow.com/comment/42380898
has comment: http://stackoverflow.com/comment/42381797
has comment: http://stackoverflow.com/comment/42341126
has comment: http://stackoverflow.com/comment/42341151
upvote count: 3
tagged with: mouselistener
accepted answer: http://stackoverflow.com/a/26898271
tagged with: swing
has title: Disappearing Problems Using a Released MouseEvent In Java
downvote count: 1
score: 2
has comment: http://stackoverflow.com/comment/42341364

http://stackoverflow.com/q/26947719
has body: What is wrong with this code? When I run it I see an error. int number=28; int[] nums = new int[number]; int cont=0; for(int i=0; i&lt;=number; i++) { if(number%i==0) { nums[i] = i; cont++; }//if }//for
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/26947747
upvote count: 0
has title: What's wrong with this JAVA(jsp) code?
answer count: 1
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/26947747
downvote count: 2
has comment: http://stackoverflow.com/comment/42437281
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/26885210
has comment: http://stackoverflow.com/comment/42327726
downvote count: 0
has comment: http://stackoverflow.com/comment/42326529
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42326643
accepted answer: http://stackoverflow.com/a/26886724
has comment: http://stackoverflow.com/comment/42329182
has body: I am having some problem when trying to execute different method in servlet doGet(). So when my button on click, it will pass along the eventID: viewDtlEventBtn.setOnClickListener(new OnClickListener(){ public void onClick(View v){ Intent eventDtlIntent = new Intent(context, EventDetail.class); eventDtlIntent.putExtra("eventID", eventIDTV.getText()); startActivity(eventDtlIntent); } }); Then in my EventDetail class, I am executing the method in AsyncTask class: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.event_detail); context = this; Bundle extras = getIntent().getExtras(); if (extras != null) { eventID = extras.getString("eventID"); } eventModel.setEventID(eventID); new GetEventDetailAsyncTask(context).execute(eventModel); } And in my AsyncTask class, I am calling the method in my controller which retrieving the JSON returned from servlet: @Override protected Double doInBackground(Event... params) { try { eventCtrl.getEventDetailByID(params[0]); } catch (JSONException e) { e.printStackTrace(); } return null; } And in my controller class: public Event getEventDetailByID(Event event) throws JSONException { Event eventModel = new Event(); String page; JSONArray jsonArray; String eventID = event.getEventID(); try { HttpClient client = new DefaultHttpClient(); HttpGet request = new HttpGet(ENeighbourhoodActivity.URL + "?getEventDetailByID&amp;eventID=" + eventID +""); HttpResponse response = client.execute(request); HttpEntity entity = response.getEntity(); String responseString = EntityUtils.toString(entity, "UTF-8"); page = "{\'EventDetail\':" + responseString + "}"; try { JSONObject jsonObject = new JSONObject(page); jsonArray = jsonObject.getJSONArray("EventDetail"); int length = jsonArray.length(); for (int i = 0; i &lt; length; i++) { JSONObject attribute = jsonArray.getJSONObject(i); String eventName = attribute.getString("eventName"); eventModel.setEventName(eventName); } } catch (JSONE…
type: Question
linked to: http://stackoverflow.com/q/4024271
linked to: http://stackoverflow.com/q/8198312
has comment: http://stackoverflow.com/comment/42327376
has comment: http://stackoverflow.com/comment/42327865
has comment: http://stackoverflow.com/comment/42328332
has comment: http://stackoverflow.com/comment/42327174
has answer: http://stackoverflow.com/a/26886724
has comment: http://stackoverflow.com/comment/42326893
tagged with: servlets
has comment: http://stackoverflow.com/comment/42326142
linked to: http://stackoverflow.com/q/10000008
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42326754
favorite count: 0
tagged with: android-asynctask
has title: Multiple if else statement with parameter in doGet() servlet
tagged with: android
has comment: http://stackoverflow.com/comment/42328736
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42328686
has comment: http://stackoverflow.com/comment/42326402
has comment: http://stackoverflow.com/comment/42326055
has comment: http://stackoverflow.com/comment/42326981

http://stackoverflow.com/q/26987237
linked to: http://stackoverflow.com/q/38722853
downvote count: 0
has answer: http://stackoverflow.com/a/50826360
favorite count: 0
type: UnansweredQuestion
has title: IDEA Groovy test class already exists
tagged with: intellij-14
has answer: http://stackoverflow.com/a/43459820
answer count: 4
has answer: http://stackoverflow.com/a/28192102
tagged with: maven
upvote count: 7
type: Question
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/44942552
tagged with: groovy
has body: IDEA is giving my groovy class the warning `class "MyClassTest" already exists in "my.class.package". It also doesn't seem to be doing a very good job of keeping the class updated when I run the test. I'll add an assertion guaranteed to fail, or succeed and it won't recognize it until later (later so far seems arbitrary). Given that I have maven tests passing and running correctly I suspect this is simply an IDEA configuration problem here's my pom.xml <?xml version="1.0" encoding="UTF-8"?> 4.0.0 com.xenoterracide rpf 0.1.0 org.springframework.boot spring-boot-starter-parent 1.1.9.RELEASE org.codehaus.gmavenplus gmavenplus-plugin 1.2 addSources addTestSources generateStubs compile testGenerateStubs testCompile removeStubs removeTestStubs ${project.basedir}/src/test/groovy **/*.groovy org.springframework.boot spring-boot-starter-data-rest org.springframework.boot spring-boot-starter-data-jpa org.springframework.data spring-data-jpa 1.8.0.DATAJPA-622-SNAPSHOT org.springframework.boot spring-boot-starter-logging org.springframework.boot spring-boot-starter-test com.h2database h2 test org.postgresql postgresql 9.3-1102-jdbc41 javax.enterprise cdi-api 1.2 org.codehaus.groovy groovy-all 2.3.7 test <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> com.xenoterracide.rpf.Application <java.version>1.8</java.version> spring-snapshots Spring Snapshots http://repo.spring.io/snapshot true spring-releases http://repo.spring.io/libs-release spring-milestones Spring Milestones http://repo.spring.io/milestone false spring-releases http://repo.spring.io/libs-release
tagged with: intellij-idea

http://stackoverflow.com/q/26865757
has body: Apologies if this is a duplicate question, but I could not find anything for my situation. So here goes: I have the following in an xsd file: &lt;xs:complexType name="Allocation"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;Links its owner to an xs:id.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:attribute name="idRef" type="xs:IDREF"/&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="XYZ"&gt; &lt;xs:sequence&gt; &lt;xs:element name="SomeAllocation" type="Allocation"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="ABC"&gt; &lt;xs:sequence&gt; &lt;xs:element name="SomeAllocation" type="Allocation"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; I am try to generate fields/getters and setters in java that are of specific types for example XYZ.getSomeAllocation() should return type Object1 and ABC.getSomeAllocation() should return type Object2. The problem I am facing is that xjc is generating one Allocation class and the XYZ and ABC classes with the methods mentioned below returning java.lang.Object types. Obviously creating to different Allocation types which are then used in the different objects solves the problem but I would like to reuse the object holding the xs:IDREF. Your help is highly appreciated! Thanks!
score: 0
has comment: http://stackoverflow.com/comment/42294248
has title: specify type for multiple IDREF attributes in JAXB bindings
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16285036
tagged with: xsd
has comment: http://stackoverflow.com/comment/42316699
has comment: http://stackoverflow.com/comment/42320367
tagged with: java
tagged with: jaxb
type: Question

http://stackoverflow.com/comment/42463503
score: 0
comment on: http://stackoverflow.com/q/26962157
type: QuestionComment
has text: @Tom do you have a set of code so that i can understand what you want to say. and i cant use ajax according to my whole applications.
type: Comment

http://stackoverflow.com/comment/42260930
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26848832
score: 0
has text: I have it too. I have both ant-junit and ant-junit4. But its using Junit3 runner.

http://stackoverflow.com/a/26914761
upvote count: 1
score: 1
has body: Code duplication warning a meant to show copied sections of code normally produced with copy &amp; paste. Copying code will reduce maintainability and may result in security issues. If sonarqube shows me duplication warnings, I have a closer look on the section of fode and decide, if this is a false positive in sense that many pojos will share some code like getId() { return id; } even if the retrn type differs or I some programmer just re-implemented or copied a section. I would strongly recommend to not reduce you entities. This will only lead to objuscation. However, you can try to use @MappedSuperClass if you really bother about code dublication detection limitations.
has comment: http://stackoverflow.com/comment/42381667
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26914438
type: Answer
answers question: http://stackoverflow.com/q/26914438

http://stackoverflow.com/q/26929653
has comment: http://stackoverflow.com/comment/42404984
has comment: http://stackoverflow.com/comment/42405335
has comment: http://stackoverflow.com/comment/42404865
has comment: http://stackoverflow.com/comment/42406526
has title: libGDX Example Project in Eclipse Getting Error 87
has answer: http://stackoverflow.com/a/26935324
tagged with: android
tagged with: java
has body: I was trying out the sample project using libGDX(a clone of Flappy Bird) in Eclipse. This is the link to the tutorial - http://www.kilobolt.com/day-2-setting-up-libgdx.html. In the step 18(please visit the link), when I clicked the "Run as Java Application", I am getting error alert box with message "LoadLibrary failed with error 87:The parameter is incorect". What could be the reason?
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42405124
accepted answer: http://stackoverflow.com/a/26935324
tagged with: libgdx
possible better answer: http://stackoverflow.com/a/31693871
has answer: http://stackoverflow.com/a/31693871
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42410335
score: 0
answer count: 2

http://stackoverflow.com/a/26939682
type: Answer
has body: RecyclerView is not supported to be used as a RemoteView. See CreatingLayout A RemoteViews object (and, consequently, an App Widget) can support the following layout classes: FrameLayout LinearLayout RelativeLayout GridLayout And the following widget classes: AnalogClock Button Chronometer ImageButton ImageView ProgressBar TextView ViewFlipper ListView GridView StackView AdapterViewFlipper
score: 32
has comment: http://stackoverflow.com/comment/42423608
upvote count: 32
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26939152
answers question: http://stackoverflow.com/q/26939152

http://stackoverflow.com/comment/42400545
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26926922
type: AnswerComment
has text: Hmm I use git inside intellij. It's much simpler to use imho.

http://stackoverflow.com/comment/42480708
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26972584
has text: look at reflection - http://tutorials.jenkov.com/java-reflection/index.html
score: 0

http://stackoverflow.com/comment/42375118
type: QuestionComment
comment on: http://stackoverflow.com/q/26912837
has text: I think error is on output.setSpan()
score: 0
type: Comment

http://stackoverflow.com/comment/42406979
comment on: http://stackoverflow.com/a/26930836
score: 0
type: AnswerComment
has text: Apparently yes, I have not tried yet. But even if it works, your application will not work for most devices in the market. I think it is better to keep a DB inside you application with the ids of the processed messages, so you can guarantee it works in the most recent versions.
type: Comment

http://stackoverflow.com/q/26949503
tagged with: oop
score: 1
tagged with: java
has body: In order to better understand how debug loggers work, I tried to implement my own logger in java. Shown in the code below. As far as I understand loggers are usually singletons. I want to use the same instance in different classes of my application. Each class where I use this logger will log to a different file. But that would mean that the singleton is being mutated by different objects. Wouldn't this cause inaccurately logging one classes debug output into a file that should be logged into by the other class. Since the same logger instance is shared across the entire app, how do different files get generated? Its the SAME instance being mutated in the application. So I decided to make the logFile location a final but then all classes would log to the same file. Could you shed some light on these curiosities? Thank you in advance. public class Logger { private final String logFile; private static Logger instance; private Logger(String logFile){ this.logFile = logFile; } public Logger getInstance(String logFile){ synchronized(Logger.class){ if(instance==null){ instance = new Logger(logFile); } } return instance; } public void write(String data) throws IOException{ PrintWriter out = new PrintWriter (new BufferedWriter(new FileWriter(logFile))); out.write(data); } }
type: Question
has comment: http://stackoverflow.com/comment/42440673
answer count: 2
has comment: http://stackoverflow.com/comment/42440487
has answer: http://stackoverflow.com/a/26949621
downvote count: 0
possible better answer: http://stackoverflow.com/a/74139931
has answer: http://stackoverflow.com/a/74139931
favorite count: 0
accepted answer: http://stackoverflow.com/a/26949621
tagged with: singleton
tagged with: log4j
has title: How exactly is the logger a singleton and how are different log files created? Implemented my own logger for understanding
has comment: http://stackoverflow.com/comment/42440469
upvote count: 1
tagged with: design-patterns
type: AnsweredQuestion

http://stackoverflow.com/q/26965206
downvote count: 0
has body: I am new to web service. I am getting the response from client in DataHandler. I have to write content of datahandler into a file. And also i want to know how to get data in string from datahandler. My program is package com.ws.mtom; import java.io.File; import java.io.FileOutputStream; import javax.activation.DataHandler; import javax.jws.WebService; @WebService(endpointInterface = "com.ws.mtom.WSInterface") public class WSImpl implements WSInterface { @Override public String writeFile(DataHandler sTr) { try { File file = new File("D:\\xml\\efg.xml"); file.createNewFile(); FileOutputStream fop = new FileOutputStream(file); sTr.writeTo(fop); } catch (Exception e) { return "Fail to write content in file"; } return "Chutiyap hogaya hai."; } } i am getting java.io.BufferedReader@28e70e30 in file file not the original content. please help me. my client program is public static void main(String[] args) throws Exception { URL wsdlUrl = new URL("http://localhost:8087/ws/fileHandling/?wsdl"); QName qname = new QName("http://mtom.ws.com/", "WSImplService"); Service service = Service.create(wsdlUrl, qname); DataSource ds = new ByteArrayDataSource(getFileContentAsString("D:\\xml\\abc.xml").getBytes(), "text/plain; charset=UTF-8"); DataHandler handler = new DataHandler(ds); WSInterface intr = service.getPort(WSInterface.class); String str = intr.writeFile(handler); }
favorite count: 0
has title: Convert DataHandler to string and also write content of datahandler into file
type: UnansweredQuestion
score: 5
has answer: http://stackoverflow.com/a/27105839
type: Question
upvote count: 5
tagged with: java
answer count: 1

http://stackoverflow.com/q/26862195
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42284689
has comment: http://stackoverflow.com/comment/42285014
has title: Java volatile effect on other variables
tagged with: java
tagged with: concurrency
has comment: http://stackoverflow.com/comment/42284597
type: Question
score: 3
downvote count: 0
has body: I am trying to understand the following paragraph about volatile variables in java. (from section 3.1.4 of Java concurrency in practice): "The visibility effects of volatile variables extend beyond the value of the volatile variable itself. When thread A writes to a volatile variable and subsequently thread B reads that same variable,the values of all variables that were visible to A prior to writing to the volatile variable become visible to B after reading the volatile variable. So from a memory visibility perspective, writing a volatile variable is like exiting a synchronized block and reading a volatile variable is like entering a synchronized block." Why writing to a volatile variable by A and reading the same variable by B makes other variables visible to B? Is it because volatile acts as a barrier?
favorite count: 0
linked to: http://stackoverflow.com/q/6259745
has comment: http://stackoverflow.com/comment/42284910
duplicate of: http://stackoverflow.com/q/6259745
has comment: http://stackoverflow.com/comment/42284535

http://stackoverflow.com/q/26940558
tagged with: android
score: 1
has body: Here's my code: public String getGPA() { String gpa = null; final String responseBody1; new Thread(new Runnable(){ public void run() { try { HttpGet httpGet_gpa = new HttpGet("https://somedomain.com" + getRegId() + "&amp;format=P"); HttpResponse response = httpClient.execute(httpGet_gpa); responseBody1 = EntityUtils.toString(response.getEntity()); } catch (ClientProtocolException cpe) { // Ignore } catch (IOException ioe) { // Ignore } } }).start(); Document gpa_doc = Jsoup.parse(responseBody1); Element p = gpa_doc.select("p").first(); gpa = p.text().replace("Your overall GPA (Grade Point Average) to date is:", ""); return gpa; } I'm getting this error: cannot assign a value to final variable responseBody1. What does this mean? I tried removing the final modifier but it tells me I need to make it final, but when I do i get that error. Any clues on why this is happening and how to fix it?
has answer: http://stackoverflow.com/a/26940679
tagged with: final
type: UnansweredQuestion
upvote count: 1
tagged with: http
tagged with: java
has answer: http://stackoverflow.com/a/26940620
type: Question
has answer: http://stackoverflow.com/a/26940598
downvote count: 0
favorite count: 0
has title: Cannot assign a value to final variable
answer count: 3

http://stackoverflow.com/comment/42291340
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26863127
has text: I am tempted to say that using NotFoundException() would tie my implementation to REST but then again using annotations also does that, right?
score: 0

http://stackoverflow.com/q/26924957
has body: I was trying out string concatenation and the '+' operator on a string and encountered the following- String xyz = "Hello" + null; System.out.println("xyz= " +xyz); String abc= "Hello".concat(null); System.out.println("abc= " +abc); The output for the first one was : Hellonull The output for the second one was a Null Pointer exception I don't understand why there were two different outputs.
has answer: http://stackoverflow.com/a/26925008
accepted answer: http://stackoverflow.com/a/26925008
has answer: http://stackoverflow.com/a/26925020
score: 0
has answer: http://stackoverflow.com/a/26924999
has answer: http://stackoverflow.com/a/26925018
has answer: http://stackoverflow.com/a/26925056
tagged with: string
answer count: 5
duplicate of: http://stackoverflow.com/q/47605
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26925020
linked to: http://stackoverflow.com/q/47605
has title: String concatenation and + operator
tagged with: java
type: Question

http://stackoverflow.com/comment/42475845
score: 0
type: Comment
type: QuestionComment
has text: Can't understand you, can you post a picture or something to explain more?
comment on: http://stackoverflow.com/q/26959442

http://stackoverflow.com/q/26980727
answer count: 2
has body: I am working on another homework assignment, and I'm stuck with this problem. My 2D int[][] graph1 (array) "cannot be resolved to a variable"? Basically, I translated some graphs to 2D arrays, that must be uploaded into a program that will read if they are a PATH, or CIRCUIT. One is a directed graph, the other (which I'm on now) is undirected. This is what I have so far: boolean undirectedCircuit (int [][] graph) { //graph = graph1(graph1(null)); int edgeCounter = 0; for (int edge = 0; edge &lt; graph.length; edge++) { /* SET FOR WHEN 1s are found in array: edgeCounter++;*/ if(graph[4][4] == '1') { edgeCounter++; System.out.println("edgeCounter found '1' " + edgeCounter + "times"); } } if (edgeCounter % 2 == 0) { System.out.println("This is a circuit!"); //return true; } else System.out.println("This is not a circuit!!"); return false; } public void go () { graph1 = new int[][] //This line is complained about. { {0,1,1,1,0}, {1,0,0,0,1}, {1,0,0,1,0}, {1,0,1,0,1}, {0,1,0,1,0} }; undirectedCircuit(graph1); //This is complained about. } Any advice would be great!
tagged with: arrays
has answer: http://stackoverflow.com/a/26980841
has comment: http://stackoverflow.com/comment/42495638
tagged with: int
accepted answer: http://stackoverflow.com/a/26980841
possible better answer: http://stackoverflow.com/a/26980912
has comment: http://stackoverflow.com/comment/42495742
has answer: http://stackoverflow.com/a/26980912
score: 0
has title: 2D array cannot be resolved to a variable
has comment: http://stackoverflow.com/comment/42495785
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42495677
tagged with: java
type: Question
tagged with: graph

http://stackoverflow.com/a/26835160
upvote count: 3
answers question: http://stackoverflow.com/q/26835156
has body: Assuming your table has more then one row, this if(rs.next()){ should use a loop like while(rs.next()){ Also, you'll need to add more then one instance to your List, so move pelic into the loop body while(rs.next()){ Movie pelic=new Movie(); Or you'll add only one instance of Movie to the List (and modify that single instance with each loop iteration).
has comment: http://stackoverflow.com/comment/42236303
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
accepted answer of: http://stackoverflow.com/q/26835156

http://stackoverflow.com/comment/42436043
type: Comment
comment on: http://stackoverflow.com/a/26946924
type: AnswerComment
score: 0
has text: Good idea. That way you can avoid band names with a space in their name ... And there is no problem with `nextLine` if you use it properly (i.e. don't mix it with `nextInt` or so).

http://stackoverflow.com/q/26847251
answer count: 1
tagged with: javascript
has comment: http://stackoverflow.com/comment/42258371
has comment: http://stackoverflow.com/comment/42257437
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has title: Parse JavaScript from html string in C#/Java
has body: I am trying to do some WebScraping of a site and the data is in dynamically loaded containers. It appears that the loading is done via JavaScript. Therefore I would need to execute it, in order to get it. I have written 2 versions of the program, one in Java and one in C#, so helping me with one would be nice enough. I am currently using WebResponse/WebRequest in C# and HttpURLConnection in Java. I have to login into the site first, which already works like a charm. Now I need to parse the content, so the data gets filled in and the containers loaded. Is there an easy way to run the html through a browser control or an already included library?
has answer: http://stackoverflow.com/a/28929323
tagged with: web-scraping
linked to: http://stackoverflow.com/q/720678
type: Question
tagged with: c#
tagged with: java
score: 0

http://stackoverflow.com/q/26855918
has title: Why do original variables change when new variables are changed?
tagged with: java
type: Question
tagged with: arraylist
has answer: http://stackoverflow.com/a/26855947
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26855933
tagged with: iteration
type: UnansweredQuestion
tagged with: concurrentmodification
has body: I have the following block of code: ArrayList&lt;Integer&gt; list1 = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; list2 = list1; // both list1 and list2 are empty arraylists System.out.println(list1.size()); // prints: 0 list2.add(7); System.out.println(list1.size()); // prints: 1 How come when I modify list2, list1 is also modified? This is causing ConcurrentModificationExceptions in my program. How can I edit list2 without changing list1?

http://stackoverflow.com/comment/42348535
type: AnswerComment
comment on: http://stackoverflow.com/a/26897555
type: Comment
has text: How do you address _I have captured the request with Fiddler, and according to JSONLint the JSON object is well formed_ ?
score: 0

http://stackoverflow.com/q/26912114
has comment: http://stackoverflow.com/comment/42377246
has comment: http://stackoverflow.com/comment/42376898
has answer: http://stackoverflow.com/a/26913098
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/17590620
type: Question
has title: Cannot get attribute from session in Struts 2
has body: I am new to Struts2 and I am trying to retrieve an attribute I set in the action class. LoginAction.java: public class LoginAction extends ActionSupport implements SessionAware { private static final long serialVersionUID = 1L; private Map<String, Object> session; // field variables @Override public String execute() { UserManager um = new UserManager(); String registeredPassword = um.getCurrentUserDetail("user_password", getUserId()); if(getUserPassword().equals(registeredPassword)) { String currentUserId = um.getCurrentUserDetail("user_id", userId); int currentUserType = um.getCurrentUserType(userId); session.put("currentUserId", (String) currentUserId); session.put("currentUserType", (Integer) currentUserType); System.out.println("You have successfully logged in!"); return SUCCESS; } System.out.println("Your login has failed!"); return ERROR; } @Override public void setSession(Map<String, Object> session) { this.session = session; } // getters and setters } struts.xml: <?xml version="1.0" encoding="UTF-8"?> /index.jsp /login.jsp index.jsp: <%@ taglib prefix="s" uri="/struts-tags"%> <%@ page import="com.mypackage.model.LoginAction" %> <% int type = 0; if(session.containsKey("currentUserType")) { type = (Integer) session.get("currentUserType"); } %> However, the methods containsKey() and get() are returning undefined for session. How do I get the attributes that was put in session in Struts2?
tagged with: session
tagged with: jsp
accepted answer: http://stackoverflow.com/a/26913098
tagged with: struts2
score: 0
answer count: 1

http://stackoverflow.com/a/26859191
has comment: http://stackoverflow.com/comment/42279714
has comment: http://stackoverflow.com/comment/42314797
score: 0
has body: You can create a class that loads a library from the System object like this: public class MyLibrary { static { System.loadLibrary("mylib"); } public static native boolean foo(); public static native String bar(); } You then have access to those methods like MyLibrary.foo()
accepted answer of: http://stackoverflow.com/q/26859056
answers question: http://stackoverflow.com/q/26859056
has comment: http://stackoverflow.com/comment/136123793
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42478965
has text: Can you try replacing the call `getClass().getResource(path)` with `getClass.getClassLoader().getResource(path)`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26962814

http://stackoverflow.com/a/26869874
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26869677
has body: Simon is correct. Another approach is to define c and d inside of main. Something like int c = in.nextInt(); int d = in.nextInt(); This gives better scoping.
answers question: http://stackoverflow.com/q/26869677
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42298561
type: AcceptedAnswer

http://stackoverflow.com/comment/42480649
type: Comment
has text: In what format receives this number ? What will be the input I mean.
score: 0
comment on: http://stackoverflow.com/q/26972588
type: QuestionComment

http://stackoverflow.com/comment/42287410
type: Comment
comment on: http://stackoverflow.com/a/26863090
has text: Correct. Feel free to ask more question
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42256581
comment on: http://stackoverflow.com/a/26835748
has text: @DavidWallace The meaning behind 11 in this algorithm is that 11 is the maximum number of characters to represent an integer. In general if you don't know the initial size or don't have a good estimate than taking the default may be OK. However if you do have a good estimate or in this case know the maximum size (that is relatively small) I would argue you should use it for clarity and allocating memory responsibly. This is a general statement which applies to any containers which take an initial size for construction.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42262927
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26850110
has text: So can i understand, that it is bugged?
score: 0

http://stackoverflow.com/a/26929111
has body: Finally I've come up with a simple solution. At the end of the package phase I run my obfuscation tool, e.g., Allatori, on the appropriate JAR files, then I use Exec Maven Plugin to update the WAR file built by Spring Boot Plugin (or by the WAR Plugin if you don't use Spring Boot Plugin) using the JAR executable as explained there.
answers question: http://stackoverflow.com/q/26913920
score: 0
type: Answer

http://stackoverflow.com/comment/42482203
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26970603
has text: It is not possible. Period. And unless you are on the same physical network as the client, you won't be able to get its MAC address, so that's probably not a solution either.

http://stackoverflow.com/comment/42276641
comment on: http://stackoverflow.com/q/26857487
score: 1
has text: How do you compile this? Looking at your error message, I think it is a simple classpath issue. You need to specify your classpath in your javac command when you try to compile it.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42287045
type: Comment
has text: Please vote up. I need it to get my asking ability back.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26863628

http://stackoverflow.com/a/26864774
has comment: http://stackoverflow.com/comment/42318955
answers question: http://stackoverflow.com/q/26864335
has body: To properly share a repository among multiple users/clients, you need to set up a proper Subversion server on a centralized system (not your PC!) which is backed up regularly. The full details of setting up a server from scratch are beyond the scope of a Stack Overflow answer; the Subversion manual explains it quite well. All of the pieces are available from Apache &amp; the Subversion project (which falls under the Apache organization), or you can use a pre-packaged solution like CollabNet Subversion Edge, uberSVN or VisualSVN. While it may be technically possible for you to share the repository over a UNC path using the file:/// protocol, it is not safe to do so and is not a recommended or supported configuration. It's not unlike giving all users unrestricted administrative access to every computer they touch - you can do it, but eventually you'll regret it.
has comment: http://stackoverflow.com/comment/42331866
score: 0
type: Answer

http://stackoverflow.com/q/26964024
tagged with: androidplot
tagged with: android
has answer: http://stackoverflow.com/a/26971559
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42478519
has title: androidplot zoom example error
has comment: http://stackoverflow.com/comment/42465922
has body: Can someone help me edit the code provided by the guys who made androidplot for the touch-zoom example? I plan to use it but I noticed that everytime I zoom in on the plot I can't zoom out back to it's original size. Here is the code for that https://bitbucket.org/androidplot/androidplot/src/397fac6a3541b4020a716e958a9c0b42bd2450fd/Examples/DemoApp/src/com/androidplot/demos/TouchZoomExampleActivity.java?at=master
score: 0
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26971559
tagged with: zooming

http://stackoverflow.com/a/27105798
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/74894771
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26887367
has body: For TCP/IP stack: We can get the protocols on the basis of port number of tcp header Port numbers corresponding to different protocols are given on the following link: http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml Getting protocol in jnetpap library ( http://jnetpcap.com ): PcapPacket packet = //get from somewhere Tcp tcp = new Tcp(); Ip4 ip = new IP4(); byte[] sIP = new byte[4]; byte[] dIP = new byte[4]; String sourceIP = ""; String destIP = ""; if(packet.hasHeader(ip) &amp;&amp; packet.hasHeader(tcp)){ sIP = packet.getHeader(ip).source(); sourceIP = org.jnetpcap.packet.format.FormatUtils.ip(sIP); dIP = packet.getHeader(ip).destination(); destIP = org.jnetpcap.packet.format.FormatUtils.ip(dIP); System.out.println("*" + sourceIP + "*" + destIP); System.out.println("Source IP" + sourceIP); System.out.println("Destination IP" + destIP); if(tcp.source() == 80){ System.out.println("HTTP protocol"); } else if(tcp.source == 23) { System.out.println("Telnet protocol"); } }
type: Answer
answers question: http://stackoverflow.com/q/26887367

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/26897686
tags question: http://stackoverflow.com/q/26896104
type: Tag
tags question: http://stackoverflow.com/q/26863650
tags question: http://stackoverflow.com/q/26840053
tags question: http://stackoverflow.com/q/26836706

http://stackoverflow.com/comment/42308948
score: 0
has text: Not sure how to implement this. I should have mentioned that for the purview of this class we are not using controllers just the Model and view. This class is nested in my GUI.
comment on: http://stackoverflow.com/a/26875508
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26882925
has comment: http://stackoverflow.com/comment/42321778
has comment: http://stackoverflow.com/comment/42321942
has comment: http://stackoverflow.com/comment/42321565
has body: that depends on how do you want to arrange the items in the LinearLayout. If you want to arrange the button next to the TextView, then, probably, the button width should be WRAP_CONTENT instead of FILL_PARENT. If you want to show the button under the TextView, then, your LinearLayout should have vertical as orientation (default is horizontal). Imo, the easiest way is to have your layout defined in a xml file. At least you can see the output at compile time, and use an inflater to retrieve the View's object at run time
answers question: http://stackoverflow.com/q/26882855
has comment: http://stackoverflow.com/comment/42321472
has comment: http://stackoverflow.com/comment/42321498
has comment: http://stackoverflow.com/comment/42321641
accepted answer of: http://stackoverflow.com/q/26882855
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42322261
has comment: http://stackoverflow.com/comment/42322198
has comment: http://stackoverflow.com/comment/42322398
type: Answer

http://stackoverflow.com/comment/42383927
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26910019
has text: As far as I know. Because tcp is designed to have two "ends" of communication.
type: Comment

state
tag name: state
type: Tag
tags question: http://stackoverflow.com/q/26898856

http://stackoverflow.com/q/26916117
has comment: http://stackoverflow.com/comment/42380821
has answer: http://stackoverflow.com/a/26916412
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26916212
score: 1
tagged with: java
has body: At the beginning of my test I have an Array List with items in it, during my test I add more items and then in a different test I clear the array. Now in my third test I would like to access the array as it was during the @Before stage - before any of the tests were ran. Is it at all possible to do this or would I have to do a separate test file for this?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26916212
has title: Is it possible to reset a JUnit test?
downvote count: 0
tagged with: junit
accepted answer: http://stackoverflow.com/a/26916412
has comment: http://stackoverflow.com/comment/42380829
favorite count: 0

http://stackoverflow.com/comment/43380368
type: QuestionComment
comment on: http://stackoverflow.com/q/26924403
score: 1
has text: Can you share your Region Cache configuration ? And give us the full starting log ?
type: Comment

http://stackoverflow.com/comment/97299737
comment on: http://stackoverflow.com/a/27739605
type: AnswerComment
score: 0
type: Comment
has text: which imports are you using?

http://stackoverflow.com/comment/42503536
comment on: http://stackoverflow.com/q/26984962
has text: Could it be, you are missing the beginning of your code? There are two braces to much.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26963887
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/47454528
upvote count: 2
type: UnansweredQuestion
tagged with: spring
score: 2
has answer: http://stackoverflow.com/a/26977614
tagged with: cxf
tagged with: java
has body: Like the title, I am new to cxf. Just wondering that what is the difference between the soap:address, and the address which is specified in jaxws:endpoint in application-context while publish it? Furthermore, in the jaxws:endpoint, what is the difference between the address and publishedEndpointUrl?
type: Question
has title: Difference between soap:address and jaxws:enpoint address
tagged with: wsdl

http://stackoverflow.com/comment/42448405
has text: Ok. I will think about it a little more.
type: Comment
comment on: http://stackoverflow.com/q/26954066
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42431560
has text: You might want to look up how JUnit Testcases work.
comment on: http://stackoverflow.com/q/26937187
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42423795
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26939366
score: 0
has text: I think that usually using `setBounds(...)` is a bad idea. I would make sure to create the images only once and not many times.

http://stackoverflow.com/q/26948103
has comment: http://stackoverflow.com/comment/42440550
has comment: http://stackoverflow.com/comment/42443638
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/42438567
score: 0
has title: Repeating a spring batch task to read multiple files
type: UnansweredQuestion
has body: I need to process multiple files with spring batch. I used MultiResourceItemReader and it works, but then I got the following requirements : Before processing a file do some check and possibly skip processing the file Log when file an input file reading is started, writing is in progress and finished writing The 1st requirement can be easily met, but the 2nd is problematic for multiple reasons : 1. The writer has no reference to the input resource, it only receives a list of POJOs 2. A chunk might contain POJOS that were read from multiple input files. I was thinking in a few solutions solutions Implement a flow with a loop in it using a JobExecutionDecider. In this case the step would only process a single file, and the loop would iterate over all resources Repeat the step somehow and the step would keep track the list of files include the resource in the POJO. I am using java based config and the documentation is quite vague on case 1. and 2. as it only explains using XML. What would be the best way to implement this?
tagged with: spring
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/22993633
type: Question

http://stackoverflow.com/q/26954152
score: 0
has comment: http://stackoverflow.com/comment/42448480
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26954256
has answer: http://stackoverflow.com/a/26954481
tagged with: java
has body: /* * 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 Javaclass; import java.util.Scanner; /** * t * * @author dhayal */ public class Javaclass { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner a = new Scanner(System.in); int i, n; System.out.println("enter the value"); n = a.nextInt(); while (n &gt; 0) { for (i = 0; i &lt; n; i++) { System.out.print("*"); // TODO code application logic here } System.out.println(); n--; } } }
has comment: http://stackoverflow.com/comment/42448475
type: Question
answer count: 2
has title: i keep getting this error Error: Could not find or load main class javaclass.Javaclass
has comment: http://stackoverflow.com/comment/42448418

http://stackoverflow.com/comment/42544780
score: 0
type: Comment
has text: Your class seems to be ok, it should be serializable, is there anything else in the logs that shows an Exception? Is LocalBean a property in some other class?
comment on: http://stackoverflow.com/a/26922885
type: AnswerComment

http://stackoverflow.com/a/26929414
has comment: http://stackoverflow.com/comment/42404305
upvote count: 2
has body: ,(?=([^()]*\([^()]*\))*[^()]*$) Try this.See demo. http://regex101.com/r/pQ9bV3/31 P.S this assumes there are no nested ( or ). Here is optimized regex that worked for me ,(?=[^)]+\() Online demo
answers question: http://stackoverflow.com/q/26929358
has comment: http://stackoverflow.com/comment/42404486
downvote count: 0
has comment: http://stackoverflow.com/comment/42404778
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42404400

http://stackoverflow.com/comment/42518633
has text: OK, my hypothesis is that weblogic has a joda-time dependency "built in", which it will use in all webapps regardless of the fact that a given webapp may depend on another version of the same library; weblogic is already known to me to include an old version of Guava which brings conflicts in `Equivalence`. Maybe this is the same problem.
comment on: http://stackoverflow.com/q/26973480
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42609048
type: Comment
has text: My Hi, I don't know how to configure the file orm.xml in my app. My configuration is like for this: http://stackoverflow.com/questions/23811261/orm-xml-files-without-persistense-xml I also use: <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
comment on: http://stackoverflow.com/a/26982662
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42415416
type: Comment
has text: You don't need to type the full path for classes in `java.lang`. eg. `public static final String INITIAL` is perfectly fine (and preferred).
type: QuestionComment
comment on: http://stackoverflow.com/q/26935453
score: 0

http://stackoverflow.com/q/26923907
has answer: http://stackoverflow.com/a/26924053
tagged with: file-upload
favorite count: 0
score: 50
upvote count: 51
answer count: 4
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26923985
has answer: http://stackoverflow.com/a/52412393
tagged with: java
has answer: http://stackoverflow.com/a/36934558
downvote count: 1
type: Question
has title: how to get getServletContext() in spring mvc Controller
accepted answer: http://stackoverflow.com/a/26924053
tagged with: eclipse
has body: I need to upload images in my project. How to get the upload path in SpringMVC. The path is; /home/cme/project/eclipse/workspace_12_11/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fileUploadTester/upload The following error; The method getServletContext() is undefined for the type HomePageController appears when I use this code; String uploadPath = getServletContext().getRealPath("") + File.separator + UPLOAD_DIRECTORY; My code is public ModelAndView UploadPhoto(@ModelAttribute User user, HttpServletRequest request, HttpServletResponse response) throws IOException { final String UPLOAD_DIRECTORY = "upload"; final int THRESHOLD_SIZE = 1024 * 1024 * 3; // 3MB final int MAX_FILE_SIZE = 1024 * 1024 * 40; // 40MB final int MAX_REQUEST_SIZE = 1024 * 1024 * 50; // 50MB String value[] = new String[10]; int i = 0; // checks if the request actually contains upload file if (!ServletFileUpload.isMultipartContent(request)) { PrintWriter writer = response.getWriter(); writer.println("Request does not contain upload data"); writer.flush(); return; //here is error This method must return a result of type ModelAndView } 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); //here error The method setFileSizeMax(int) is undefined for the type ServletFileUpload upload.setSizeMax(MAX_REQUEST_SIZE); String uploadPath = getServletContext().getRealPath("") + File.separator + UPLOAD_DIRECTORY; // here error The method getServletContext() is undefined for the type Homepage Controller // creates the directory if it does not exist File uploadDir = new File(uploadPath); if (!uploadDir.exists()) { uploadDir.mkdir(); } try { List &lt; FileItem &gt; items = upload.parseRequest(request); // request is HttpServletRequest for (FileItem item: items) { if (item.isFormField()…
possible better answer: http://stackoverflow.com/a/26923985

pdfbox
tag name: pdfbox
type: Tag
tags question: http://stackoverflow.com/q/26971401
tags question: http://stackoverflow.com/q/26989208

pass-by-value
tags question: http://stackoverflow.com/q/26984730
tag name: pass-by-value
tags question: http://stackoverflow.com/q/26946886
type: Tag

http://stackoverflow.com/comment/42493837
type: QuestionComment
has text: Somehow it doesn't show the LOG_TAG's, but I found the error in the logcat. I also edited my question a bit, hope this helps a little bit more.
comment on: http://stackoverflow.com/q/26978761
score: 0
type: Comment

http://stackoverflow.com/q/26839890
has comment: http://stackoverflow.com/comment/42244270
upvote count: 4
tagged with: recursion
has comment: http://stackoverflow.com/comment/42244338
downvote count: 0
has title: Calculating nth root of a positive integer in Java
has comment: http://stackoverflow.com/comment/42244623
tagged with: java
has comment: http://stackoverflow.com/comment/42244426
has comment: http://stackoverflow.com/comment/42244376
type: Question
tagged with: square-root
has comment: http://stackoverflow.com/comment/42244207
has body: My task is to write a program which prompts the user to enter a positive double a and an integer n greater than 2, and print the value of the nth root of positive integer a to the screen with accuracy to 100 places. I've used Math.pow to be able to get the root, and I feel as though I've done everything right. The only problem is that every time I run my program, the output is 1.0, no matter what numbers I input for a and n. What is the problem with my code? import java.util.Scanner; import java.lang.Math; public class Q8 { public static void main(String[] args) { System.out.println("Enter a positive number: "); Scanner in = new Scanner(System.in); double a = in.nextDouble(); System.out.println("Enter an integer greater than 2: "); Scanner in2 = new Scanner(System.in); int n = in.nextInt(); System.out.println(pow (a,n)); } private static double pow(double a, int n) { if (n == 0){ return 1; } else{ double sum = Math.pow(a,(1/n)); return sum; } Why is the answer always 1.0?
score: 4
has comment: http://stackoverflow.com/comment/42244473
answer count: 2
has answer: http://stackoverflow.com/a/26839943
favorite count: 0
has answer: http://stackoverflow.com/a/26839902
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42244353
has comment: http://stackoverflow.com/comment/42244694

http://stackoverflow.com/a/37549890
score: 0
answers question: http://stackoverflow.com/q/26966316
type: Answer
has body: This solution was from thanks to Harry Hurr. I had to change like two small things in order to get it to work. If yours still isn't working, you probably imported the wrong things. //put this line before you loadContent webEngine.documentProperty().addListener(new WebDocumentListener(webEngine)); class WebDocumentListener implements ChangeListener&lt;Document&gt; { private final WebEngine webEngine; public WebDocumentListener(WebEngine webEngine) { this.webEngine = webEngine; } @Override public void changed(ObservableValue&lt;? extends Document&gt; arg0, Document arg1, Document arg2) { try { // Use reflection to retrieve the WebEngine's private 'page' field. Field f = webEngine.getClass().getDeclaredField("page"); f.setAccessible(true); WebPage page = (WebPage) f.get(webEngine); // Set the background color of the page to be transparent. page.setBackgroundColor((new java.awt.Color(0, 0, 0, 0)).getRGB()); } catch (Exception e) { System.out.println("Error: " + e); } } }

http://stackoverflow.com/a/26847777
answers question: http://stackoverflow.com/q/26842258
type: AcceptedAnswer
type: Answer
has body: I solved the problem by moving filesystem /var/lucene/indexes to jpaProperties tag
score: 0
accepted answer of: http://stackoverflow.com/q/26842258

http://stackoverflow.com/comment/42364167
comment on: http://stackoverflow.com/a/26906727
type: AnswerComment
score: 0
type: Comment
has text: @DimaMaligin i didnt say it is wrong. it is definitely a correct solution; i just said it depends on how long you static map will be. its related to personal flavor and code esthetics

http://stackoverflow.com/a/26987356
has body: nextLine() doesn't just fetch the last line, it also advances a line. Before your second loop you are calling nextLine() twice causing you to advance two lines each iteration of the loop. You can fix your problem by setting dataLines = bottomHeader instead of calling nextLine() again.
type: Answer
answers question: http://stackoverflow.com/q/26987269
score: 0

http://stackoverflow.com/comment/42398418
type: QuestionComment
score: 0
has text: To used it you will need a qmljs library sources. Then you will pass sources to lexer and later you will go to writing own Visitor/Evaluator/etc.
comment on: http://stackoverflow.com/q/26859707
type: Comment

http://stackoverflow.com/q/26973196
has body: I have used ActiveMQ for publishing my message to the consumer so that I can receive the message at consumers end and trigger something. Now my question is that can ActiveMQ support storing and processing the group of messages? For example: If a group of messages published at a time I need to get the first two and process. The rest of them should wait in queue. After those two messages have processed I need to get another to process until I processed the picked messages, The rest of the message should wait in queue. Is this possible?
tagged with: message-queue
has title: Store and Process Messages in ActiveMQ
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/27309057
downvote count: 0
tagged with: jms
favorite count: 0
has comment: http://stackoverflow.com/comment/42505456
type: Question
has comment: http://stackoverflow.com/comment/42527697
has comment: http://stackoverflow.com/comment/42546500
upvote count: 2
tagged with: activemq-classic
tagged with: java
has comment: http://stackoverflow.com/comment/42486782
answer count: 1
tagged with: queue
has answer: http://stackoverflow.com/a/27309057

http://stackoverflow.com/q/26958018
tagged with: spring-integration
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/26958850
accepted answer: http://stackoverflow.com/a/26958850
type: Question
tagged with: java
answer count: 1
downvote count: 0
has title: Spring Integration 4.1.0 Migration problems
favorite count: 0
tagged with: spring
type: AnsweredQuestion
has body: I'm having problems migrating my application form spring-integration 4.0.4 to the recent 4.1.0 release. Once replacing the jars, my integration context throws an exception for each &lt;recipient-list-router/&gt; tag. The thrown exception is a java.lang.ClassCastException the message is: Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy62 cannot be cast to org.springframework.integration.context.IntegrationObjectSupport at org.springframework.config.AbstractSimpleMessageHandlerFactoryBean.createHandlerInternal(AbstractSimpleMessageHandlerFactoryBean.java:130) at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:102) at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:44) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanReagistrySupport.java:168) ... 20 more I am using Spring-Integration 4.1.0.RELEASE, spring-core 4.1.2.RELEASE, and running on jdk1.8.0_05. My Integration beans context contains two &lt;recipient-list-router/&gt; tags, which upon removal, do not throw this error.

http://stackoverflow.com/comment/42318798
comment on: http://stackoverflow.com/a/26845642
type: AnswerComment
has text: Able to sent in messages with Priority! But strangely, the consumer is consuming messages with all sorts of priority. Its like the priority was never being enforce. I have double check the rabbitMQ plugin Status, and priority queue shows as enabled: [E] rabbitmq_priority_queue 3.3.x-72d20292
score: 0
type: Comment

http://stackoverflow.com/q/26861149
has comment: http://stackoverflow.com/comment/42282769
upvote count: 2
possible better answer: http://stackoverflow.com/a/26861281
has answer: http://stackoverflow.com/a/26867722
has title: Java add items into class as an Array
has answer: http://stackoverflow.com/a/26862087
has answer: http://stackoverflow.com/a/26861301
accepted answer: http://stackoverflow.com/a/26861301
has body: I have simply this below class structure and I want to add any item to it. public class Person implements Serializable { private String name; private String mobile; public Person(String n, String e) { name = n; mobile = e; } public String getName() { return name; } public String getMobile() { return mobile; } @Override public String toString() { return name; } } I want to add any item like with this: people = new Person[]{ new Person("Hi" , " programmer"), new Person("Hello", " world") }; My code is this and I want to add items into that by while() my code is don't correct. people = new Person[]{}; while (phones.moveToNext()) { people = new Person("Hi" , " programmer"); people = new Person("Hello", " world") }
favorite count: 0
has comment: http://stackoverflow.com/comment/42282869
has comment: http://stackoverflow.com/comment/42282816
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42282876
has answer: http://stackoverflow.com/a/26861281
downvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26861338
type: Question
tagged with: java

http://stackoverflow.com/a/26868020
upvote count: 0
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/42296709
has comment: http://stackoverflow.com/comment/42298690
has comment: http://stackoverflow.com/comment/42296544
score: -1
has comment: http://stackoverflow.com/comment/42298503
answers question: http://stackoverflow.com/q/26867806
has body: If you want to keep two classes, use this on your test class(that contains main method). public class countMessages{ public static void main(String args[]){ // You must instantiate the other class SampleDataBase sdb = new SampleDataBase(); // here you will get the total messages in your arrayList int count = sdb.messages.size(); }

http://stackoverflow.com/q/26855015
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/26855135
has body: Is it more efficient to query a MySQL database in Java whilst specifying the fields in the query or more efficient to use the * wildcard? My current code is try (Statement statement = SQL.connection.createStatement()) { try (ResultSet rs = statement.executeQuery("SELECT player_name, ip FROM " + SQL.database + "." + TableType.PlayerProfile.tableName + " WHERE ip='" + getPlayerIP(args[0]) + "' AND not(player_name='" + args[0] + "');")) { if (!rs.isBeforeFirst()) { sender.sendMessage("§7No accounts are associated with this player's ip"); } else { sender.sendMessage("§7" + getServer().getOfflinePlayer(args[0]).getName() + "'s §lpossible §7alternative accounts:"); while (rs.next()) if (!args[0].equalsIgnoreCase(rs.getString("player_name"))) sender.sendMessage("§7" + getServer().getOfflinePlayer(rs.getString("player_name")).getName()); } } } catch (Exception exception) { exception.printStackTrace(); } So the query is "SELECT player_name, ip FROM " + SQL.database + "." + TableType.PlayerProfile.tableName + " WHERE ip='" + getPlayerIP(args[0]) + "' AND not(player_name='" + args[0] + "');" and then im using the Java code rs.getString("player_name") to get one of fields I need (I do the same for the ip field later) Is this efficient or should I use the * wildcard instead of specifieng the fields I will be using with the Java code?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26855135
has title: Querying a MySQL database in Java, is it more efficient to specify which fields you require?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42506757
type: Comment
has text: what space do you want to have? If you want space as a character try `data + " "`, or if you want to enter a line each time you write in file, just try `println` instead of `write`, or `data + "\r\n"`
comment on: http://stackoverflow.com/q/26980703
score: 0
type: QuestionComment

http://stackoverflow.com/a/27347463
accepted answer of: http://stackoverflow.com/q/26979476
has body: According to the Material Design specifications, the overflow menu should display on top of the action bar: A menu is a temporary sheet of paper that always overlaps the app bar, rather than behaving as an extension of the app bar. This is the default behavior for Android Lollipop applications as well as any applications that use the AppCompat v7 support library.
answers question: http://stackoverflow.com/q/26979476
type: AcceptedAnswer
downvote count: 1
type: Answer
upvote count: 8
score: 7

http://stackoverflow.com/q/26877570
tagged with: netbeans
tagged with: mouselistener
type: AnsweredQuestion
tagged with: java
tagged with: mouseevent
type: Question
has body: Some background I am developing a game in java, I am using Netbeans to build it I currently have 2 java files App.java Board.java Right Now I can create and display a simple chess board with all the pieces in the right positions the problem I am having is assigning any mouseevents to those chess pieces Currently i wrote test code using textpad and no folder links for the images and have been able to get the mouse events to work there so I know there is no problem in the code for the events. But Now that I am writing the program cleaner in Netbeans the mousevents don't work any more So I am ammusing I am not linking them correctly to the new chess board and the new peieces Here is the chess Board In netbeans (Not working version) package chessgame; import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE; public class Board extends JFrame implements MouseListener, MouseMotionListener{ JLayeredPane layeredPane; JPanel chessBoard; JLabel chessPiece; int xAdjustment; int yAdjustment; int startX; int startY; int initialX; int initialY; JPanel panels; JLabel pieces; public Board() { Dimension boardSize = new Dimension(600, 600); // This is a Layered Pane for this application layeredPane = new JLayeredPane(); getContentPane().add(layeredPane); layeredPane.setPreferredSize(boardSize); //Add a chess board to the Layered Pane chessBoard = new JPanel(); layeredPane.add(chessBoard, JLayeredPane.DEFAULT_LAYER); chessBoard.setLayout(new GridLayout(8, 8)); chessBoard.setPreferredSize(boardSize); chessBoard.setBounds(0, 0, boardSize.width, boardSize.height); for (int i = 0; i &lt; 64; i++) { JPanel square = new JPanel(new BorderLayout()); chessBoard.add(square); int row = (i / 8) % 2; if (row == 0) { square.setBackground(i % 2 == 0 ? Color.white : Color.gray); } else { square.setBackground(i % 2 == 0 ? Color.gray : Color.white); } } // Setting up the Initial Chess board. //White Side for (int i …
accepted answer: http://stackoverflow.com/a/26877596
score: 0
linked to: http://stackoverflow.com/q/26893717
has title: Linking image's to Mouseevents in java
answer count: 1
has answer: http://stackoverflow.com/a/26877596

http://stackoverflow.com/q/26980389
has comment: http://stackoverflow.com/comment/42495052
favorite count: 0
linked to: http://stackoverflow.com/q/21306410
tagged with: while-loop
tagged with: system.out
has body: I am writing a basic Tic-Tac-Toe Single player game using basic swing graphics. I completed the game, but there is a weird problem I am facing. At one place, I used a while loop with a SOP statement. If I omit this statement, program works differently and nothing happens (like some kind of infinite loop), and if I keep it, it works just fine. I don't know what's happening in the code. Please help. Below is the source code which causing problem. Sorry for my amateur coding style. import java.util.Random; public class SinglePlayer implements Runnable{ public final int MINIMUM = -1000000; private GameBoard game; public SinglePlayer(){ game = new GameBoard("Single Player"); } public static void main(String[] args){ SinglePlayer gameSingle = new SinglePlayer(); gameSingle.run(); } public void run(){ boolean machinePlayed = true, userPlayed = false; // Outer loop is to maintain re-match option of program while(this.game.quitTwoPlayer == false){ // Inner loop is a single game b/w user and machine while(this.game.GameQuitStatus() == false){ /* I kept two conditions to switch b/w machine and user mode * of game and they just keep changing to simulate the game * b/w machine and user. */ if(machinePlayed == false &amp;&amp; userPlayed){ try { MachineMove("O"); } catch (CloneNotSupportedException e) { e.printStackTrace(); break; } this.game.ChangePlayerLabels(); machinePlayed = true; userPlayed = false; } else if(machinePlayed &amp;&amp; userPlayed == false){ int earlierCount = this.game.CountSteps(); /* THIS IS THE WHILE LOOP I AM TALKING ABOUT. * If I omit the print statement inside the body of loop, * program behaves differently, but when I keep it, * it working just fine. * */ while(earlierCount == this.game.CountSteps()){ System.out.println("Player User thinking"); } this.game.ChangePlayerLabels(); machinePlayed = false; userPlayed = true; } this.game.DeclareResult(); } this.game.dispose(); } } public void MachineMove(String player) throws CloneNotSupportedException{ /* If…
duplicate of: http://stackoverflow.com/q/25425130
has answer: http://stackoverflow.com/a/26980455
accepted answer: http://stackoverflow.com/a/26980455
has title: Weird behavior in Java While Loop
has comment: http://stackoverflow.com/comment/42495062
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42494936
has comment: http://stackoverflow.com/comment/42494963
linked to: http://stackoverflow.com/q/25425130
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42495035
tagged with: infinite-loop
answer count: 1
downvote count: 1

http://stackoverflow.com/q/26986587
tagged with: hash
has answer: http://stackoverflow.com/a/26986777
has comment: http://stackoverflow.com/comment/42506434
accepted answer: http://stackoverflow.com/a/26989158
answer count: 4
has comment: http://stackoverflow.com/comment/42506272
type: AnsweredQuestion
has body: Hi I'm wondering if it is possible to access the contents of a HashSet directly if you have the Hashcode for the object you're looking for, sort of like using the HashCode as a key in a HashMap. I imagine it might work something sort of like this: MyObject object1 = new MyObject(1); Set&lt;MyObject&gt; MyHashSet = new HashSet&lt;MyObject&gt;(); MyHashSet.add(object1) int hash = object1.getHashCode MyObject object2 = MyHashSet[hash]??? Thanks! edit: Thanks for the answers. Okay I understand that I might be pushing the contract of HashSet a bit, but for this particular project equality is solely determined by the hashcode and I know for sure that there will be only one object per hashcode/hashbucket. The reason I was pretty reluctant to use a HashMap is because I would need to convert the primitive ints I'm mapping with to Integer objects as a HashMap only takes in objects as keys, and I'm also worried that this might affect performance. Is there anything else I could do to implement something similar with?
has comment: http://stackoverflow.com/comment/42506648
tagged with: java
upvote count: 7
type: Question
tagged with: hashcode
has answer: http://stackoverflow.com/a/26986754
tagged with: hashset
has comment: http://stackoverflow.com/comment/42506375
linked to: http://stackoverflow.com/q/16148575
has answer: http://stackoverflow.com/a/26989158
possible better answer: http://stackoverflow.com/a/26986754
has comment: http://stackoverflow.com/comment/42506285
has comment: http://stackoverflow.com/comment/42506288
has answer: http://stackoverflow.com/a/26986683
downvote count: 0
score: 7
has title: Accessing a HashSet using the HashCode directly? (Java)
favorite count: 0

http://stackoverflow.com/comment/42338267
score: 0
comment on: http://stackoverflow.com/q/26879074
type: Comment
type: QuestionComment
has text: @zanerock Yes it works, but it only works when you first execute the java jar. After that it doesn't look at the file anymore. I want that in.txt file as my keyboard. For example if I put a `/stop` in the in.txt the server will start and then shutdown. If it's blank and later I put something in it, it won't use that as input. It does nothing. I need the `&` so I can continue using my bash shell. Even if I don't use the `&` it still does the same thing. Nothing.

http://stackoverflow.com/comment/42380224
comment on: http://stackoverflow.com/q/26915145
type: Comment
score: 0
has text: @user771912 you must add `<context:component-scan base-package="packageNameOfFollowUp" />` to your definition. See: http://stackoverflow.com/a/19419296/1888799
type: QuestionComment

http://stackoverflow.com/q/26894326
tagged with: java
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/26894426
has answer: http://stackoverflow.com/a/26894603
tagged with: int
score: 0
tagged with: validation
type: UnansweredQuestion
has title: is there a way to validate data by saying "variable != int"
answer count: 4
has answer: http://stackoverflow.com/a/26894394
has answer: http://stackoverflow.com/a/26894404
tagged with: conditional-statements
has body: So this is basically what I want my code to say, as to avoid compile error's in the event that the user selects "Tea" instead of using the corresponding integer. if(appSelection &lt; 1 || appSelection &gt; appetizersArray.length || appSelection != int) the first two conditions are obviously to catch data that would be out of bounds, but I'm looking for a way to specify that the input needs to be an int. If the only option is try catch just say so but I'm hoping there's a more elegant solution.

http://stackoverflow.com/q/26850259
has answer: http://stackoverflow.com/a/26850333
tagged with: java
accepted answer: http://stackoverflow.com/a/26850339
possible better answer: http://stackoverflow.com/a/26850333
answer count: 2
favorite count: 0
score: 0
has title: How do I create a window to run my letter grade program in?
has answer: http://stackoverflow.com/a/26850339
tagged with: jframe
upvote count: 1
downvote count: 1
has body: I am a beginner in Java and I decided to write a letter grade checker program for people if they want to convert their grades in whole number form to a letter grade. I want to know how I can create a window for this to run in with a dialogue box and space for a photo/logo for the program. import java.util.Scanner; public class noname { public static void main(String[] args) { Scanner user_input = new Scanner(System.in); int gradescore; System.out.println("Please enter your score and round the decimals"); gradescore = user_input.nextInt(); if((gradescore &gt;= 94) &amp;&amp; (gradescore &lt;= 100)) { char grade = 'A'; System.out.println("Your grade is an "+grade); gradescore = user_input.nextInt(); } else if ((gradescore &gt;=90) &amp;&amp; (gradescore &lt;= 93)) { char grade = 'A'; System.out.println("Your grade is an " +grade +"-"); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 87) &amp;&amp; (gradescore &lt;=89)) { char grade = 'B'; System.out.println("Your grade is a "+grade +"+"); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 83) &amp;&amp; (gradescore &lt;= 86)) { char grade = 'B'; System.out.println("Your grade is a "+grade); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 80) &amp;&amp; (gradescore &lt;= 82)) { char grade = 'B'; System.out.println("Your grade is a "+grade +"-"); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 77) &amp;&amp; (gradescore &lt;= 79)) { char grade = 'C'; System.out.println("Your grade is a " +grade +"-"); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 73) &amp;&amp; (gradescore &lt;= 76)) { char grade = 'C'; System.out.println("Your grade is a " +grade); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 70) &amp;&amp; (gradescore &lt;= 72)) { char grade = 'C'; System.out.println("Your grade is a " +grade +"-"); gradescore = user_input.nextInt(); } else if ((gradescore &gt;= 67) &amp;&amp; (gradescore &lt;= 69)) { char grade = 'D'; Sy…
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/42450154
type: AnswerComment
comment on: http://stackoverflow.com/a/26955260
type: Comment
has text: More likely, just let the relevant variable fall out of scope. I very rarely need to set things to null for the sake of the garbage collector.
score: 1

http://stackoverflow.com/q/26884309
type: AnsweredQuestion
tagged with: java
has body: I need to add the same dependency twice configuring one version for the compilation and test purpose and another version of the same library for the runtime. It sounds weird and it is wrong but I received 2 version of the same library from another team in my company and the "test purpose" version contains some classes - used only by the "test" methods - that haven't to be expose in a production server because very sensible being part of the 'core'. So this means I need to use a version library for the test and compilation phase and another one only on the server. Actually I solved the problem setting only the "test" version with 'provided' scope, so it won't be included in the generated war, and putting the "production" version in the web container's lib folder but my boss wants I will automate the configuration!!! Unfortunately if I add the dependency to the second version with 'runtime' or 'compile' scope maven doesn't find the classes present only in the "test" version during the JUnit execution step. It seems like Maven recognises the libraries like the same and the 'compile' or 'runtime' configuration won on the other one. I've tried also to set the "test" version with 'test' scope but it doesn't work either... actually I've tried all the possible combinations using 'test' and 'provided' scopes for the "test" version and 'runtime' and 'compile' for the "production one. Any suggestion? I can't ask for a different library only for test purposes or just to change the name of the library, everything is integrated with a continuous integration system and it has to be automated with it, so annoying... company.group.id project.id 0.1.1.TEST provided // test company.group.id project.id 0.1.0.PROD compile // runtime Thanks
has title: How to configure Maven with the same library twice but with different version
type: Question
answer count: 1
tagged with: junit
has answer: http://stackoverflow.com/a/26886346
score: 0
linked to: http://stackoverflow.com/q/4312553
duplicate of: http://stackoverflow.com/q/4312553
accepted answer: http://stackoverflow.com/a/26886346
tagged with: maven
tagged with: unit-testing

http://stackoverflow.com/comment/42472282
type: AnswerComment
has text: @MalikDz This is StackOverflow, not Skype. The conversation must continue and be completed *here*. Otherwise the question has zero permanent value and is liable for deletion.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26966534

http://stackoverflow.com/q/26899631
has answer: http://stackoverflow.com/a/26899708
has comment: http://stackoverflow.com/comment/42352242
favorite count: 0
possible better answer: http://stackoverflow.com/a/26899708
has answer: http://stackoverflow.com/a/26899701
has body: If I have an ArrayList of these strings... "String1, String1, String1, String2, String2, String2, String3, String3" How can I find the most appearing string in this list? If there are any duplicates, I would want to put both into the same list and deal with that accordingly. How could I do this, assuming that the list of strings could be of any size. This is about as far as I've gotten: public String getVotedMap() { int[] votedMaps = new int[getAvailibleMaps().size()]; ArrayList&lt;String&gt; mostVoted = new ArrayList&lt;String&gt;(); int best = 0; for(int i = 0; i &lt; votedMaps.length; i++) { if(best &gt; i) { best = i; } else if(best == i) { } else { } } } getAvailibleMaps() is a list of Maps that I would choose from (again, can get any size) Thanks!
has title: Find most appearing string in ArrayList
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42351991
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42352021
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42352140
has comment: http://stackoverflow.com/comment/42352151
accepted answer: http://stackoverflow.com/a/26899701
has comment: http://stackoverflow.com/comment/42352202
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26900033
answer count: 3

http://stackoverflow.com/comment/42419423
type: AnswerComment
score: 0
has text: Thanks for your help, I've produced 1/3 of the code above in the edited post, do you think it looks good?
type: Comment
comment on: http://stackoverflow.com/a/26922345

http://stackoverflow.com/comment/42406728
type: QuestionComment
has text: what was you try? please add your code
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26930778

http://stackoverflow.com/a/26840707
has comment: http://stackoverflow.com/comment/42245976
has comment: http://stackoverflow.com/comment/42246929
type: Answer
has body: A relative path adds to uncertainty where a file-not-found stems from. As you tried alternatives, handle the error: File file = new File("C:/.../something.txt"); try { ... } catch (FileNotFoundException e) { File full = file.getAbsoluteFile(); File dir = file.getParentFile(); while (dir != null &amp;&amp; !dir.exists()) { dir = dir.getParentFile(); } System.out.printf("File %s does not exist under %s%n", full.getPath(), dir == null ? "/" : dir.getPath()); } catch (IOException e2) { } Tips: StringBuilder is faster, successor of StringBuffer. New style (since Java 7): Path path = Paths.get("C:/..."); byte[] content = Files.readAllBytes(path); String contentText = new String(content); // Default encoding
answers question: http://stackoverflow.com/q/26840117
score: 0

http://stackoverflow.com/comment/42440751
has text: let me try with link you provided and get back to you...
type: Comment
comment on: http://stackoverflow.com/a/26949647
score: 0
type: AnswerComment

http://stackoverflow.com/a/26922441
type: AcceptedAnswer
downvote count: 0
has body: OK,TCP+MEM+EMBEDED SERVER is what I want. import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import org.h2.tools.Server; import org.junit.Before; import org.junit.Test; public class H2ServerDownTest { private Server server; @Before public void startServer() throws SQLException { // TCP server only. server = Server.createTcpServer("-tcp -webPort 8008 -tcpPort 9008 -properties null".split(" ")); System.out.println("Start Server AT: " + server.getURL()); } @Test(expected = SQLException.class) public void test() throws SQLException { server.start(); Connection c = getConnection(); Statement stmt = c.createStatement(); stmt.execute("create table test(id int primary key, val varchar(100))"); for (int i = 0; i &lt; 1000; i++) { if (i == 500) { server.stop(); } stmt.execute("insert into test values(" + i + ", 'values')"); } } public Connection getConnection() throws SQLException { return DriverManager.getConnection("jdbc:h2:"+server.getURL()+"/mem:db", "sa", ""); } @Test public void shutdownServer() { server.shutdown(); } }
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26921842
answers question: http://stackoverflow.com/q/26921842

http://stackoverflow.com/comment/42286151
score: 2
comment on: http://stackoverflow.com/a/26862989
has text: @tomasb: As Marko said, making it mutable was a bad idea to start with. But the whole "fields and one method instead of many methods" has caused *so* many problems over time. Basically the java.util.* time API is a disaster area.
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26951780
score: 1
has body: The problem is that System.in is an infinite stream. Calling hasNextXXX will cause System.in to prompt if the Scanner doesn't find a token in what has already been read. The user needs to enter some non-integer to terminate the list. You may, however, use a second Scanner since Scanner can scan a String e.g.: Scanner in = new Scanner(System.in); System.out.print("Enter a list of integers: "); List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); Scanner line = new Scanner(in.nextLine()); // optional line.useDelimiter("\\D+"); while(line.hasNextInt()) { list.add(line.nextInt()); } System.out.println("You entered " + list); Using a single Scanner you could also use findInLine: for(String token; (token = in.findInLine("-?[1-9]\\d*")) != null;) { list.add(Integer.valueOf(token)); }
has comment: http://stackoverflow.com/comment/42444674
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26951134
downvote count: 0
answers question: http://stackoverflow.com/q/26951134
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42378415
has text: @chiastic-security I updated my answer. And thanks for suggesting integer overflow.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26914441
type: Comment

http://stackoverflow.com/comment/42320988
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26844493
has text: yes my project is 'jsp' servlet web app...and sorry but I didn't get your point
type: AnswerComment

http://stackoverflow.com/comment/42290968
score: 0
comment on: http://stackoverflow.com/q/26865767
type: QuestionComment
type: Comment
has text: Aside from duffymo's comments you don't really do anything in the read loop, rs.getString() will return the current row value each time round - i.e. that line of code runs for each row

http://stackoverflow.com/comment/42424886
type: QuestionComment
comment on: http://stackoverflow.com/q/26934757
has text: I've tried a small test case with your classes and `@JsonProperty` as you have it works fine. What does your `buildResponse` look like?
score: 0
type: Comment

http://stackoverflow.com/comment/42264583
type: AnswerComment
comment on: http://stackoverflow.com/a/26850745
type: Comment
has text: thanks a lot!! what if I, for example, only create the folder en: will it always take the pictures from there, if the language on the phone is english? I mean, does it mater if the user is in England or USA?
score: 0

http://stackoverflow.com/q/26973876
score: 1
tagged with: java
tagged with: gson
accepted answer: http://stackoverflow.com/a/26978053
has comment: http://stackoverflow.com/comment/42483433
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42483742
has comment: http://stackoverflow.com/comment/42483258
tagged with: http://stackoverflow.com/tag/json
has body: I am receiving JSON from a call from Java, and I want to parse it to an object that has a 'info' property, that will change type according to who made the call. public &lt;T&gt; ExternalCallBaseResult&lt;T&gt; parseExternalResultJson(String res) { Type collectionType = new TypeToken&lt;ExternalCallBaseResult&lt;T&gt;&gt;(){}.getType(); return Global.gson.fromJson(res, collectionType); } I would like to call this method like this: ExternalCallBaseResult&lt;GetUserInfoResult_Info&gt; result = global.parseExternalResultJson(res); Given the class: public static class ExternalCallBaseResult&lt;T&gt; { public int callbackid = 0; public int success = 1; public T info = null; } I'm getting the error: java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to com.cht.params.Params$GetUserInfoResult_Info EDIT: I saw this question with an answer: gson: parametrized fromJson depending on the Type But is there no way to make without having to send the TypeToken on the method call?
has comment: http://stackoverflow.com/comment/42483176
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26978053
favorite count: 0
has title: Pass Type to method and alter response
linked to: http://stackoverflow.com/q/11280837
type: AnsweredQuestion

http://stackoverflow.com/a/26955020
has comment: http://stackoverflow.com/comment/42450023
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/42449759
has comment: http://stackoverflow.com/comment/42449975
answers question: http://stackoverflow.com/q/26954882
has body: That's the stack trace says: You called quick sort with max size like if i entered 10 elements, you called s with 10 quickSort(a,1,s); This in turn calls q=Partition(A,p,r); With r as 10, which in turn uses array[r] Now array starts with index 0 and goes until r-1 in your case and hence you are getting ArrayIndexOutOfBound exception. So call your quicksort method with s-1 as last parameter and 0 as start index i.e. quickSort(a,0,s-1); Also in your recursive solution, you are using while loop which should be if. So your quick sort becomes: void quickSort(int a[],int p,int r){ if(p&lt;r){ int q; q=Partition(A,p,r); quickSort(A,p,q-1); quickSort(A,q+1,r); } }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42397010
has text: Unfortunately `setPrefWidth` is not available for `Text`. I have to rebuild each `TextFlows` because the highlighted areas do change since the user wants to highlight a different pattern
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26916644
type: Comment

http://stackoverflow.com/comment/42564425
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26977561
type: Comment
has text: @Santoshbudhe - I would think you can just include it as another element in the `env` array? It belongs there, not as part of `cmd`. My example was from a shell, I hadn't realised you were invoking SQL*Loader from Java.

http://stackoverflow.com/comment/42428548
type: AnswerComment
comment on: http://stackoverflow.com/a/26942333
type: Comment
has text: @AlexLockwood I would certainly hold the static list of the activities via weak reference so they can still be collected, and still allow referencing.
score: 0

http://stackoverflow.com/comment/112523113
type: Comment
has text: @Trejkaz or you split the reading and writing of the old format into separate classes and only deprecate the ones for writing…
comment on: http://stackoverflow.com/a/26982159
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42505134
type: Comment
has text: For that, you might be interested to [check if the app is installed](http://stackoverflow.com/q/11392183/2821954), then [open the Play Store programmatically](http://stackoverflow.com/q/11753000/2821954). As a hint, you need to use `com.instagram.android` as the argument (taken from the [URL of its Play Store](https://play.google.com/store/apps/details?id=com.instagram.android))
comment on: http://stackoverflow.com/a/26964897
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42457469
type: QuestionComment
score: 0
has text: @MikeOliveira see my answer it should solve your problem
type: Comment
comment on: http://stackoverflow.com/q/26959446

http://stackoverflow.com/comment/42288863
has text: Tried both, no joy. Thanks all the same.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26864266
type: Comment

http://stackoverflow.com/q/26906939
tagged with: servlets
tagged with: getparameter
type: Question
has comment: http://stackoverflow.com/comment/42398431
downvote count: 0
has comment: http://stackoverflow.com/comment/42403139
has body: I am sending registration form data through HttpPost method to Servlet and get this data by getParameterValues. No problem with getting data, but I get the data in random order. I want that at servlet I get the data in order of how they are sent. I try to solve this by reading in internet but nothing can help. I am posting my servlet code here. response.setContentType("text/html"); ObjectOutputStream out = new ObjectOutputStream(response.getOutputStream()); Enumeration paramNames = request.getParameterNames(); String params[] = new String[7]; int i=0; while(paramNames.hasMoreElements()) { String paramName = (String) paramNames.nextElement(); System.out.println(paramName); String[] paramValues = request.getParameterValues(paramName); params[i] = paramValues[0]; System.out.println(params[i]); i++; } I get the output like this 5_Country United States 4_Password zxcbbnm 1_Lastname xyz 0_Firstname abc 3_Email abc@xyz.com 6_Mobile 1471471471 2_Username abcd I want 0_Firstname first then 1_Lastname then 2_Username like that, because I want to insert this data in database. Here 0,1,2...I wrote just for indicate that I want value in this order.
answer count: 2
tagged with: http-post
possible better answer: http://stackoverflow.com/a/26929610
favorite count: 0
has answer: http://stackoverflow.com/a/26929610
has title: How to get values of getParameterValues in the order they are sent?
has answer: http://stackoverflow.com/a/26928656
linked to: http://stackoverflow.com/q/4733373
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/26928656
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/42384999
score: 0
has text: Why the downvote please explain why downvoter?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26918307

arraylist
tags question: http://stackoverflow.com/q/26959735
tags question: http://stackoverflow.com/q/26989589
tags question: http://stackoverflow.com/q/26969922
tags question: http://stackoverflow.com/q/26855918
tags question: http://stackoverflow.com/q/26903549
tags question: http://stackoverflow.com/q/26922640
tags question: http://stackoverflow.com/q/26967739
tags question: http://stackoverflow.com/q/26899631
tags question: http://stackoverflow.com/q/26925556
tags question: http://stackoverflow.com/q/26941282
tags question: http://stackoverflow.com/q/26980023
tags question: http://stackoverflow.com/q/26984430
tags question: http://stackoverflow.com/q/26966397
tags question: http://stackoverflow.com/q/26914762
tags question: http://stackoverflow.com/q/26868067
tags question: http://stackoverflow.com/q/26919013
tags question: http://stackoverflow.com/q/26944196
tags question: http://stackoverflow.com/q/26964741
tags question: http://stackoverflow.com/q/26882045
tags question: http://stackoverflow.com/q/26921081
tags question: http://stackoverflow.com/q/26930675
tags question: http://stackoverflow.com/q/26928556
tags question: http://stackoverflow.com/q/26845594
tags question: http://stackoverflow.com/q/26875813
tags question: http://stackoverflow.com/q/26973577
tags question: http://stackoverflow.com/q/26874173
tags question: http://stackoverflow.com/q/26942687
tags question: http://stackoverflow.com/q/26979939
tags question: http://stackoverflow.com/q/26930527
tags question: http://stackoverflow.com/q/26923155
tags question: http://stackoverflow.com/q/26964771
tags question: http://stackoverflow.com/q/26864420
tags question: http://stackoverflow.com/q/26965109
tags question: http://stackoverflow.com/q/26949894
tags question: http://stackoverflow.com/q/26854034
tags question: http://stackoverflow.com/q/26958160
tags question: http://stackoverflow.com/q/26876390
tags question: http://stackoverflow.com/q/26954527
tags question: http://stackoverflow.com/q/26916200
tags question: http://stackoverflow.com/q/26955041
tags question: http://stackoverflow.com/q/26891723
tags question: http://stackoverflow.com/q/26895543
tags question: http://stackoverflow.com/q/26922009
tags question: http://stackoverflow.com/q/26987133
tags question: http://stackoverflow.com/q/26854312
tags question: http://stackoverflow.com/q/26853196
tags question: http://stackoverflow.com/q/26913148
tags question: http://stackoverflow.com/q/26847582
tags question: http://stackoverflow.com/q/26838830
tags question: http://stackoverflow.com/q/26976929
tags question: http://stackoverflow.com/q/26922216
tags question: http://stackoverflow.com/q/26871263
tags question: http://stackoverflow.com/q/26840468
tags question: http://stackoverflow.com/q/26859714
tags question: http://stackoverflow.com/q/26941589
tags question: http://stackoverflow.com/q/26918293
tags question: http://stackoverflow.com/q/26922698
tags question: http://stackoverflow.com/q/26870357
tags question: http://stackoverflow.com/q/26983864
tags question: http://stackoverflow.com/q/26857156
tags question: http://stackoverflow.com/q/26985120
tags question: http://stackoverflow.com/q/26942967
tags question: http://stackoverflow.com/q/26978978
tags question: http://stackoverflow.com/q/26912113
tags question: http://stackoverflow.com/q/26876195
tags question: http://stackoverflow.com/q/26836638
tags question: http://stackoverflow.com/q/26864116
tags question: http://stackoverflow.com/q/26914331
tags question: http://stackoverflow.com/q/26980265
tags question: http://stackoverflow.com/q/26934189
tags question: http://stackoverflow.com/q/26898228
tags question: http://stackoverflow.com/q/26842770
tags question: http://stackoverflow.com/q/26986748
type: Tag
tags question: http://stackoverflow.com/q/26951894
tags question: http://stackoverflow.com/q/26888106
tags question: http://stackoverflow.com/q/26872454
tags question: http://stackoverflow.com/q/26987665
tags question: http://stackoverflow.com/q/26923782
tags question: http://stackoverflow.com/q/26882203

http://stackoverflow.com/comment/42437831
has text: Thanks dude this seemed to work fine. I was checking over my lab notes but could not really find any content that could help me. Thanks.
type: Comment
comment on: http://stackoverflow.com/a/26947968
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42386063
has text: Cache it in the browser?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26918868
type: Comment

http://stackoverflow.com/q/26854301
answer count: 9
has answer: http://stackoverflow.com/a/54446353
linked to: http://stackoverflow.com/q/46408538
tagged with: css
has body: I was playing around with JavaFX's Tooltip. I realized that for me personally the delay between hovering over something and the tooltip actually appearing is too long. A look in the API reveals: Typically, the tooltip is "activated" when the mouse moves over a Control. There is usually some delay between when the Tooltip becomes "activated" and when it is actually shown. The details (such as the amount of delay, etc) is left to the Skin implementation. After some further investigation, I was not able to find any possibility to control the delay. The JavaFX CSS Reference has no information about delay time and a runtime-evaluation of getCssMetaData() did not help either. I know that there is a way to control the tooltips manually via onMouseEntered(...) and onMouseExited(...), but is there really no other way? Or am I missing an obvious solution?
has answer: http://stackoverflow.com/a/36916925
type: AnsweredQuestion
tagged with: fxml
has answer: http://stackoverflow.com/a/27739605
linked to: http://stackoverflow.com/q/12717969
tagged with: java
has answer: http://stackoverflow.com/a/36408705
downvote count: 1
has answer: http://stackoverflow.com/a/49927111
possible better answer: http://stackoverflow.com/a/27739605
type: Question
upvote count: 37
has answer: http://stackoverflow.com/a/43291239
has title: How to control the JavaFX Tooltip's delay?
has answer: http://stackoverflow.com/a/79293336
score: 36
tagged with: javafx-8
has answer: http://stackoverflow.com/a/26854441
accepted answer: http://stackoverflow.com/a/49927111
has answer: http://stackoverflow.com/a/42759066
favorite count: 0

http://stackoverflow.com/comment/42265865
type: AnswerComment
has text: You could put MyComparator<T> implements Comparator<Employee> that it would do the same thing!
comment on: http://stackoverflow.com/a/26851208
score: 0
type: Comment

http://stackoverflow.com/q/26885953
upvote count: 3
tagged with: java
type: Question
has title: Volley.NoConnectionError : java.io.EOFException 0
has answer: http://stackoverflow.com/a/29427379
answer count: 2
score: 3
downvote count: 0
favorite count: 0
has body: i don't understand this error , although i search many many time on th net, but nothing to do , the error appear sometime. I did an app which use VOlley library , and all work well, 95% of my request works, but sometime i have the error ; 11-12 12:18:54.991: I/Error(1870): com.android.volley.NoConnectionError: java.io.EOFException 0 and i don't know why this error appear. FOr example during y COnnection to the app , i send somes information like register_id for notification GCM , login, password and imei well, and sometime i have this error which appear 0_0 This is my Login request (but it's in all my request that i have this error) : public void connectDriver() { String url = UtilClass.getSytemValue("url_proxy",LoginConnection.this)+ ":"+ UtilClass.getSytemValue("port_proxy",LoginConnection.this) + "/api/driver/login"; final ProgressDialog pDialog = new ProgressDialog(this); pDialog.setMessage("Connexion..."); pDialog.show(); Log.i("url", url); RequestQueue rq = Volley.newRequestQueue(this); StringRequest postReq = new StringRequest(Request.Method.POST, url, new Response.Listener&lt;String&gt;() { @Override public void onResponse(String response) { Log.d("response connection ", response); pDialog.dismiss(); Gson gson = new Gson(); final Driver driver = gson.fromJson(response.toString(), Driver.class); Log.i("DRIVER GSON", driver.toString()); UtilClass.setSytemValue("driver_id",Integer.toString(driver.getId()),LoginConnection.this); driver.setLogin(mlogin); driver.setPass(util.md5(mPassword)); if (driver.getSignature().isEmpty()) { driver.setSignature(null); } final DriverQuery driverQuery = new DriverQuery(LoginConnection.this); driverQuery.open(); long success = driverQuery.insertDriver(driver); driverQuery.close(); Log.i("connection driver success : ",Long.toString(success)); UtilClass.setSytemValue("driver_id",Integer.toString(driver.getId()),LoginConnection.this); Log.i("DRIVER SEND BEFORE GOTO", driver.toString()); goTo(driver); } }, new Response.ErrorListener…
tagged with: android-volley
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/38589478
tagged with: request

http://stackoverflow.com/a/26896351
accepted answer of: http://stackoverflow.com/q/26896226
has comment: http://stackoverflow.com/comment/42347899
answers question: http://stackoverflow.com/q/26896226
upvote count: 9
has body: The 1 is auto-boxed into an Integer. To learn more about Autoboxing and -unboxing, see Oracle's Docu: https://docs.oracle.com/javase/tutorial/java/data/autoboxing.html On why they are the same: Autoboxing ints to Integers uses a cache. For numbers &lt; 128 (I think) the same Integer-Object will be returned each time instead of a new one being created. So your code essentially inserts the same object twice into the Vector, and for this reason the identity comparison using == returns true. As you don't use generics with your Vector, myv.elementAt(0) will return an Object, which cannot be cast to an int. If you used generics, i.e. Vector&lt;Integer&gt; myv = new Vector&lt;&gt;(), then elementAt would return an Integer which would be auto-unboxed to an int.
has comment: http://stackoverflow.com/comment/42346152
type: AcceptedAnswer
downvote count: 0
score: 9
type: Answer

http://stackoverflow.com/comment/42511930
type: Comment
type: QuestionComment
has text: I already thought about the idea to get rid of the parse-tree at all. In ANTLR the nice thing about parse trees is that they allow you to write a pure grammar (without java commands in it). As a sidenote: the document that I'm parsing is a [Robocup 2D simulation](http://sourceforge.net/projects/sserver/) [logfile](http://fei.edu.br/rcs/2D/2014/finals/final/match_1/201407241009-WrightEagle_3-vs-Gliders2014_2.rcg.gz) of a game. The goal is to build a JavaFX Monitor for those games.
comment on: http://stackoverflow.com/q/26945720
score: 0

http://stackoverflow.com/comment/42268965
type: Comment
comment on: http://stackoverflow.com/a/26848301
has text: I am on mobile now. Let's talk about it tomorrow
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42326325
type: AnswerComment
comment on: http://stackoverflow.com/a/26885854
type: Comment
has text: OP is aware of that. He is asking _how_ to do exactly that.
score: 0

http://stackoverflow.com/q/26850258
has body: I have three Framgments inside a Viewpager and I want to start a new Activity from one of them with a button click. I also want to take some information with me from four Spinner elements. I am able to get the information from the Spinners and save in global variables but when I click the button the variables become null. I just can't figure this out and it's driving me mad! Here is how I make the Fragments and find the correct layout XML: public class SlideFragment extends Fragment { private int currentPageNumber; private View mainView; public static SlideFragment create(int pageNumber, String origin) { SlideFragment myFragment = new SlideFragment(); Bundle args = new Bundle(); args.putInt("page", pageNumber); args.putString("origin", origin); myFragment.setArguments(args); return myFragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentPageNumber = getArguments().getInt("page"); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String origin = getArguments().getString("origin"); // This is the mainActivity Rastimar rastimar = new Rastimar(); if (origin == "profile") { if (currentPageNumber == 0) { mainView = inflater.inflate(R.layout.profile_screen1, container, false); } else { mainView = inflater.inflate(R.layout.profile_screen2, container, false); } } else if (origin == "rastimi") { switch (currentPageNumber) { case 0: mainView = inflater.inflate(R.layout.rastimar, container, false); rastimar.makeSpinners(mainView); rastimar.makeListView(mainView); break; case 1: mainView = inflater.inflate(R.layout.rastima_leit, container, false); rastimar.makeSpinnersForRastimaLeit(mainView); break; case 2: mainView = inflater.inflate(R.layout.rastima_yfirlit, container, false); rastimar.makeExpandableListView(mainView); rastimar.makeSpinnersForYfirlit(mainView); break; } } return mainView; } } Here I get the data from the spinners, this works. private clas…
score: 2
has comment: http://stackoverflow.com/comment/42267526
has title: Moving data from Fragment to new Activity with button click
answer count: 0
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/61333901
tagged with: java
upvote count: 2
has comment: http://stackoverflow.com/comment/42266991
has comment: http://stackoverflow.com/comment/42263537
favorite count: 0
has comment: http://stackoverflow.com/comment/42267831
has comment: http://stackoverflow.com/comment/42267742
tagged with: android

http://stackoverflow.com/comment/42296307
has text: You can show your code ?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26864427
score: 0

http://stackoverflow.com/q/26847896
tagged with: methods
has comment: http://stackoverflow.com/comment/42258725
type: Question
tagged with: math
has answer: http://stackoverflow.com/a/26848074
has comment: http://stackoverflow.com/comment/42258846
has comment: http://stackoverflow.com/comment/42258740
answer count: 1
has title: Loan calculator math incorrect
tagged with: calculator
has comment: http://stackoverflow.com/comment/42258773
has comment: http://stackoverflow.com/comment/42258678
favorite count: 0
has comment: http://stackoverflow.com/comment/42258560
upvote count: 2
accepted answer: http://stackoverflow.com/a/26848074
has comment: http://stackoverflow.com/comment/42258662
has body: I have been working on this program for about a week now and I can't seem to get my math right. It's outputting values, just not the correct ones. I have looked over my values too many times to count. I'm desperate!! My program calculates yearly interests over however many years the length of the loan is. Secondly it calculates how much is left to pay on the original loan yearly over the total length of the loan. import java.util.Scanner; public class mortgageCalc { public static void main(String[] args) { // Other declarations for main program go here Scanner keyboard = new Scanner(System.in); double annualInterest; int loanLength; double loanAmount; // Step 1: prompt for, read in, and store the input values. System.out.print("Enter loan amount: "); loanAmount = keyboard.nextDouble(); System.out.print("Enter length of the loan: "); loanLength = keyboard.nextInt(); System.out.print("Enter interest rate as percent: "); annualInterest = keyboard.nextDouble(); double newMonthlyPayment = payment(annualInterest,loanLength,loanAmount); double totalInterest = (newMonthlyPayment * loanLength*12)-loanAmount; printTotals(newMonthlyPayment, totalInterest,annualInterest,loanLength,loanAmount); double balance = loanAmount; double monthlyInterestRate = annualInterest/1200; for (int year = 1; year &lt;= loanLength; year++) { double remainingMonthlyInterest = getMonthlyInterest (balance, monthlyInterestRate); double remainingInterest = totalInterest + remainingMonthlyInterest; balance = getRemainingBalance(balance, newMonthlyPayment, remainingMonthlyInterest); System.out.println("Monthly interest:"+remainingMonthlyInterest); System.out.println("new balance:"+balance); } } // end of main public static double payment(double annualInterest, int loanLength, double loanAmount) { double i = (annualInterest/1200); double n = (loanLength*12); double e1 = i+1; double e2 = Math.pow(e1,n); double e3 = e2-1; double e4 = i * e2; double e5 = e2-1; double monthlyPayment = loanAmount*(e4/e5); retu…
has comment: http://stackoverflow.com/comment/42258856
has comment: http://stackoverflow.com/comment/42258716
score: -1
type: AnsweredQuestion
tagged with: java
downvote count: 3
tagged with: loops
has comment: http://stackoverflow.com/comment/42258558

http://stackoverflow.com/comment/42352624
has text: I found a solution, though I still don't understand why the problem was happening. See my answer below. Thanks for your comments.
comment on: http://stackoverflow.com/q/26898629
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42366138
has text: `Runtime().exec(new String[]{"sh", "-c", "./adb", "shell", "su 0 pm uninstall " + apkName.trim()});`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26907339
type: QuestionComment

http://stackoverflow.com/comment/42346409
type: AnswerComment
has text: I tried this now some times, keeps giving me the error
type: Comment
comment on: http://stackoverflow.com/a/26895028
score: 0

http://stackoverflow.com/comment/42716980
score: 0
has text: When you say "cannot resolve", what behaviour are you seeing? Do you get an error from the Nucleus when it tries to instantiate your `OMSCustomerInfoMessageListener` component, or does it instantiate it fine, but you get a `NullPointerException` when you try to use `customerInfoUpdateManager` inside the component?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26930811

http://stackoverflow.com/comment/42400961
type: AnswerComment
type: Comment
has text: still there will be processing in maps i want one line solution and want open closed principal
comment on: http://stackoverflow.com/a/26927426
score: 0

http://stackoverflow.com/comment/42276822
type: Comment
type: QuestionComment
score: 2
has text: `if (i == 5) { continue; }` - don't forget to increment `i` also.
comment on: http://stackoverflow.com/q/26857618

http://stackoverflow.com/comment/42425116
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26940506
has text: Have you tried doing that? Defining a method once in a parent so sublcasses inherit it is exactly why you can have subclasses.
score: 0

http://stackoverflow.com/a/26855786
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/26855469
score: 2
accepted answer of: http://stackoverflow.com/q/26855469
type: AcceptedAnswer
downvote count: 0
has body: There are a number of possible solutions. I'm including this for instructional value, not because I think it's better than the other answer. Replace: newNum = original%newBase + newNum; with int digitValue = original % newBase; char digit = (digitValue &lt; 10) ? ('0' + digitValue) : ('A' + (digitValue - 10)); newNum = digit + newNum;

apache-commons-fileupload
tags question: http://stackoverflow.com/q/26969882
type: Tag
tag name: apache-commons-fileupload

http://stackoverflow.com/comment/42297908
comment on: http://stackoverflow.com/a/26869461
type: AnswerComment
score: 0
type: Comment
has text: i guess you could do foundFive = (number == 5;). But that's just my OCD talking.

http://stackoverflow.com/comment/42263600
type: AnswerComment
score: 0
type: Comment
has text: I've linked to multiple solutions - I'm not sure which you are referring to. But yes, any of them could be a possible solution after you read about the methods and figure out how you would implement it.
comment on: http://stackoverflow.com/a/26850347

http://stackoverflow.com/q/26939101
tagged with: spring-security
has body: We have an application using the Spring SAML Extension and we have set it up as an SP that works running on localhost against SSOCircle. We have now deployed in our customer's test environment and we are trying to get it to work with our customer's IDP. We gave our metadata to the IDP, substituting http://myapp-test.acme.com:8080/myapp/saml/SSO for http://localhost:8080/myapp/saml/SSO. After authentication, we see this in the logs: o.s.s.s.m.MetadataGeneratorFilter - Generated default entity base URL http://someappserver.acme.com:8080/myapp based on values in the first server request. org.opensaml.common.SAMLException: Intended destination http://myapp-test.acme.com:8080/myapp/saml/SSO doesn't match any of the endpoint URLs for profile urn:oasis:names:tc:SAML:2.0:profiles:SSO:browser In the browser window, we see that the request goes to http://someappserver.acme.com:8080/myapp/saml/SSO. So http://myapp-test.acme.com:8080/myapp/saml/SSO resolves to http://someappserver.acme.com:8080/myapp/saml/SSO How can we change our code / configuration to handle this? I don't think we should hard-code the metadata to the app server.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26945512
has title: SAML DNS Resolution Issue
tagged with: java
tagged with: spring-saml
type: Question
score: 0
answer count: 1

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/26849787
type: Tag

http://stackoverflow.com/comment/42367737
has text: Or have him set x/y directly: https://docs.oracle.com/javase/tutorial/uiswing/layout/none.html
type: AnswerComment
comment on: http://stackoverflow.com/a/26908972
score: 0
type: Comment

http://stackoverflow.com/comment/42467217
score: 0
has text: **Why** are you trying to use `wine` (an emulator for Windows programs)?
comment on: http://stackoverflow.com/q/26964746
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26978447
has answer: http://stackoverflow.com/a/26978514
has answer: http://stackoverflow.com/a/26978567
has body: I am trying to write a java program where the user enters a testclass and then my program make sure it is a testclass. That is, checking for constructor without parameter, and testing the methods so that they are working (return true or false). Now, what I am confused about is this API reflection. I am trying to follow the tutorial located at https://docs.oracle.com/javase/tutorial/reflect/index.html but I am getting confused and I am wondering if anyone could explain it and maybe help me get started. In the tutorial it says for example how to get the testclass, but you can do it in so many different ways. I tried using the ... Class c = str.getClass(); ... where str is the name of the class I want to look at. How do I proceed from here to obtain information about the class's methods, constructor and their parameters? I simply just want examples and explaining. Not a fully written program. Thanks in advance.
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26978564
accepted answer: http://stackoverflow.com/a/26978564
linked to: http://stackoverflow.com/q/1149703
linked to: http://stackoverflow.com/q/6020719
downvote count: 0
has title: API reflection confusion
possible better answer: http://stackoverflow.com/a/26978567
type: AnsweredQuestion
tagged with: reflection
has comment: http://stackoverflow.com/comment/42491567
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/26985212
type: Answer
has body: You can use a simple for loop to iterate over your ArrayList, and then call the toString() method of the object: for (int = 0; i &lt; arrayList.size(); i++) { System.out.println(arrayList.get(i).toString()); } To override the toString method of your class, just add the method, pretty simple: class Rectangle { //Member variables int width, height; //Example //Member functions getArea { ... } //toString public String toString() { return String.valueOf(getArea()); } }
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26985120
upvote count: 1
has comment: http://stackoverflow.com/comment/42503976

http://stackoverflow.com/q/26939574
upvote count: 1
has comment: http://stackoverflow.com/comment/42426484
type: Question
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/26940052
tagged with: java
has comment: http://stackoverflow.com/comment/42437417
answer count: 1
downvote count: 0
has title: Is it possible to display text on a rich text item in a DocumentContext?
tagged with: lotus-notes
has answer: http://stackoverflow.com/a/26940052
favorite count: 0
has body: I have a form that runs a java agent on the WebQueryOpen event. This agent pulls data from a DB2 database and then puts them into the computed text fields I have placed on the form and are displayed whenever I open the form in the browser. This is working for me. However, when I try to use RichTextFields I get a ClassCastException error. No document is actually saved, I just open the form in the browser using this domino URL - https://company.com/database.nsf/sampleform?OpenForm Sample code of simple text field - Displayed with w/o problems Document sampledoc = agentContext.getDocumentContext(); String samplestr = "sample data from db2"; sampledoc.replaceItemValue("sampletextfield", samplestr); When I tried using rich text field Document sampledoc = agentContext.getDocumentContext(); String samplestr = "sample data from db2"; RichTextItem rtsample = (RichTextItem)sampledoc.getFirstItem('samplerichtextfield'); rtsample.appendText(samplestr); // ClassCastException error Basically, I wanted to use rich text field so that it could accommodate more characters in case I pull a very long string data. Screenshot of the field (As you can see it's a RichText)

http://stackoverflow.com/q/26834919
score: 0
has comment: http://stackoverflow.com/comment/42235918
has answer: http://stackoverflow.com/a/26835192
linked to: http://stackoverflow.com/q/7056749
type: Question
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42235973
has title: Recieving and Returning Methods
has body: Having trouble with a java program dealing with returning and receiving methods. I have no clue how to call my method. The Scanner variable is the only global variable. The variable size will be local to 2 methods. setOcean(): This method prompts for the ocean and returns what is captured from the keyboard. setSize(): This method receives the name of the ocean, prompts for a descriptive size of the ocean and returns what is captured. A list of descriptive sizes is displayed (see sample output). The user selects from the list. Based on the selection a switch is used to determine the descriptive size: Largest, Second Largest, Third Largest, Fourth Largest, Smallest or display the error message: Try again! Re-enter selection. Use a do/while to re-prompt if the choice is anything less than 1 or greater than 5. There'll be 2 variables: one to store the selection from the list and the other to store the size as "Largest" or "Second Largest", etc. The switch uses the first variable to determine the value in the second variable or print the error message. setKilometers(): This method receives the name of the ocean, prompts for the total area of the ocean in kilometers and returns what is captured from the keyboard. calcTotalAreaMiles(): This method receives the number of kilometers and the conversion factor of 0.621, converts the kilometers into miles, and returns the total area calculated as miles. printOceanInfo(): This method receives the ocean name, the size, and the total area in miles and prints this information (see sample output). SAMPLE OUTPUT THE 5 WORLD OCEANS Enter an ocean: Southern Largest Second Largest Third Largest Fourth Largest Smallest From the above list, select the size of the Southern Ocean: 4 Enter the total area for the Southern Ocean in kilometers: 20.327 OCEANS OF THE WORLD Ocean: Southern Size: Fourth Largest Total Square Mile: 12.623 Enter another ocean? y Enter an ocean: Arctic Largest Second Largest Third Largest Fourth Largest Smallest From t…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26835038
has comment: http://stackoverflow.com/comment/42235828

http://stackoverflow.com/comment/42323577
type: QuestionComment
has text: So you want to instantiate other classes than MOrder, but not all classes? How do you decide whether to instantiate or not? Your error is probably caused by MOrder not having a default constructor by the way
comment on: http://stackoverflow.com/q/26883241
score: 0
type: Comment

http://stackoverflow.com/q/26944382
linked to: http://stackoverflow.com/q/26690027
score: 0
answer count: 1
type: UnansweredQuestion
has title: Why Wildfly 8.1.0 final return java.lang.NoClassDefFoundError: when deploying ejb module with a remote application library but glassfish doesn’t?
tagged with: netbeans
tagged with: java
has body: I tried to create a simple EJB remote client sample but I keep getting java.lang.NoClassDefFoundError: any time I tried to deploy the EJB. The Remote Java Library File Structure is: &gt; TestRemoteInterface --Source Package -- bean --TestBeanRemote.java -- Libraries -- Java EE 6 API Library --JDK 1.8 The EJB Module File Structure is: &gt; TestEJBModule --Source Package -- bean --TestBean.java -- Libraries -- TestRemoteInterface – dist/TestRemoteInterface -- Java EE 6 API Library -- JDK 1.8 TestBeanRemote.java package bean; import javax.ejb.Remote; @Remote public interface TestBeanRemote { String getName(String name); } TestBean .java package bean; import javax.ejb.Stateless; @Stateless public class TestBean implements TestBeanRemote { @Override public String getName(String name) { return "Here is my " + name; } } Question: When I try to deploy the TestEJBModule on get the follow log: WARN [org.jboss.modules] (MSC service thread 1-6) Failed to define class bean.TestBean in Module "deployment.TestEJBModule.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link bean/TestBean (Module "deployment.TestEJBModule.jar:main" from Service Module Loader) .... Caused by: java.lang.NoClassDefFoundError: bean/TestBeanRemote at java.lang.ClassLoader.defineClass1(Native Method) [rt.jar:1.8.0_05] .... Caused by: java.lang.ClassNotFoundException: bean.TestBeanRemote from [Module "deployment.TestEJBModule.jar:main" from Service Module Loader] at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final] ... Caused by: java.lang.LinkageError: Failed to link bean/TestBean (Module "deployment.TestEJBModule.jar:main" from Service Module Loader) at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:487) [jboss-modules.jar:1.3.3.Final] ..... Caused by: java.lang.NoClassDefFoundError: bean/TestBeanRemote ..... Caused by: java.lang.ClassNotFoundException: bean.TestBeanRemote from [Module "deployment.TestEJ…
tagged with: ejb-3.1
has comment: http://stackoverflow.com/comment/42437714
type: Question
tagged with: wildfly-8
has answer: http://stackoverflow.com/a/29654019
tagged with: jboss

http://stackoverflow.com/a/26936431
has body: Okay, I can sort of see what you were thinking but you've got some of the semantics incorrect. What you want to define is a method. A method takes the following structure: &lt;access modifier&gt; &lt;return type&gt; &lt;method name&gt; (&lt;method arguments&gt;) So for example public void doSomething(String value) { // This is the public method that returns nothing. It is called doSomething // It expects a string value that it will call "value" } In your case, you want to create one of these, and you want to make a setter and a getter (or accessor and mutator if you're being posh). Your Setter This is just a normal method. Its purpose is to set the value of some class field. So let's define our class.. public class MyClass { private int num; } Now we've got a class MyClass with a field num. But oh no, it's private, so let's create a setter so that the user can update the value.. Following our formula for methods, we start with a public access modifier. We then define the return type, which is void because it returns nothing. The name of the method should follow the java naming convention, which is the word "set" followed by the name of the member and finally the value for the setter.. Or all together: public void setNum(int num) { this.num = num; } This will update the value in the class with the value that you pass in. Excellent! Your Getter Well, this is nice and simple. Following our formula, it is a method that is public because everyone can access it; it returns something (in this case int) so that is the return type; the name follows the convention of "get" followed by the name and it expects no parameters. public int getNum() { return num; } This will return the value of num. Finally, Using them! public class MainClass { public static void main(String[] args) { MyClass myClass = new MyClass(); // Create a new MyClass instance. myClass.setNum(4); // Update the value in the class with the number 4. System.out.println("The number is " + myClass.getNum()); // Out…
downvote count: 0
answers question: http://stackoverflow.com/q/26936382
score: 5
upvote count: 5
type: Answer

http://stackoverflow.com/q/26942178
has answer: http://stackoverflow.com/a/26942413
type: Question
has title: Creating an iterator for Linked List in java without using getEntry
answer count: 2
tagged with: iterator
has answer: http://stackoverflow.com/a/26942308
score: 0
has body: Im trying to create an Iterator that works for an linkedList. I have already created the linked list which I think should work good but now I need help on creating the iterator. I'm trying to make it faster than one that would simply use getEntry() with a for loop, increasing by one each time, because using that method would mean I have to traverse the linked list for each element. I'm trying to solve it quicker than that but dont know where to get started. I know I need to create the next and hasnext methods but not sure how to. Also stuck on the constructor and instance methods. Here's the code I have so far: import java.util.NoSuchElementException; public class SListIterator&lt;T&gt; { private Node firstNode; private int numberOfEntries; public SListIterator() { firstNode = null; numberOfEntries = 0; } public void addToFirst(T aData) { firstNode = new Node(aData, firstNode); numberOfEntries++; } public T getEntry(int givenPosition) { T result = null; if((givenPosition &gt;= 1) &amp;&amp; (givenPosition &lt;= numberOfEntries)) { result = (getNodeAt(givenPosition)).data; } return result; } private Node getNodeAt(int givenPosition) { Node currentNode = firstNode; for(int counter = 1; counter &lt; givenPosition; counter++) { currentNode = currentNode.next; } return currentNode; } public Iterator&lt;T&gt; getIterator() { // TO DO } private class IteratorForSList implements Iterator&lt;T&gt; { // instance variable for IteratorForSList private IteratorForSList() { // constructor } public boolean hasNext() { // need help } public T next() { // need help } public T remove() { throw new UnsupportedOperationException("remove() is not supported by this iterator"); } } private class Node { private T data; private Node next; private Node(T aData, Node nextNode) { data = aData; next = nextNode; } } }
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/42507567
type: QuestionComment
has text: http://stackoverflow.com/questions/2020088/sending-email-in-android-using-javamail-api-without-using-the-default-built-in-a
score: 0
comment on: http://stackoverflow.com/q/26987346
type: Comment

http://stackoverflow.com/comment/42500376
comment on: http://stackoverflow.com/a/26963875
has text: What's not working about it? Post a question with your code and issues you're having and give me the link here and I'll take a look. Can't guarantee as complete of an answer as I gave here but I'll try to point you in the right direction ;)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42447661
has text: Thank you for sharing a link to apache `Commons Configuration`. But My question is different. If I call this `Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);` multiple times, is the config file loaded multiple times?
type: AnswerComment
comment on: http://stackoverflow.com/a/26953666
score: 0
type: Comment

http://stackoverflow.com/q/26939216
type: Question
tagged with: swingworker
has title: Saving to mysql database with jbutton issue
has body: Good day . Can anyone really help me with what i'm facing as issue with my database ? i want to insert to the database by using the pepraredStatement . however whenever i'm adding the database part (connection and pepraredStatement ) the 'UPLOAD' button goes unresponsive . but when i remove anything related to the database , all my buttons are working . you can find here the code http://pastebin.com/euKdWhr2 . I will really appreciate any help or suggestion . probably i'm missing something on the database part . And please it is not a duplicated question , because i did not find the right answer public void actionPerformed(ActionEvent ev) { String file = fileField.getText(); SetGetQuestionFileName pattern = new SetGetQuestionFileName(file); ConnectToDatabase database = new ConnectToDatabase(); try { ///////// check whether textfile is empty or not if( ev.getActionCommand().equals("UPLOAD")) { if(fileField.getText().isEmpty()) { JOptionPane.showMessageDialog(null,"File field can not be empty!!! Please try again.","ALERT", JOptionPane.ERROR_MESSAGE); } else { File fi = new File(fileField.getText()); //////////////// perform upload try { String sql = "INSERT INTO testsystem.questionnaire (category_questions, questions, correct_answer)" + "VALUES (?, ?, ?)"; PreparedStatement st = null; Connection dbconnection = database.getConnection(); st = dbconnection.prepareStatement(sql); if(fi.getAbsoluteFile().exists()) { List&lt;String&gt; lines = Files.readAllLines(Paths.get(fileField.getText()), Charset.defaultCharset()); for (int i = 0; i &lt; lines.size(); i+=10) { String category = lines.get(i); System.out.println(category); String question = lines.get(i+1); System.out.println(question); String answers = lines.get(i+2)+System.lineSeparator() +lines.get(i+3)+System.lineSeparator() +lines.get(i+4)+System.lineSeparator() +lines.get(i+5); System.out.println(answers); String correct = lines.get(i+7); System.out.println("correct answer is: "+correct); System.out.println("-------…
accepted answer: http://stackoverflow.com/a/26939245
answer count: 1
tagged with: jdbc
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26939245
score: 0
tagged with: java

http://stackoverflow.com/a/28379882
answers question: http://stackoverflow.com/q/26947048
score: 0
type: Answer
has body: I could solve this problem by using a different version. As said by one of my friends I think the problem was with the version that I was using. Then I tried it with Eclipse Kepler and the problem was gone :)

http://stackoverflow.com/comment/42464601
type: QuestionComment
score: 0
has text: No. A customer can be a company or a person, however can not be both at the same time.
comment on: http://stackoverflow.com/q/26954994
type: Comment

http://stackoverflow.com/comment/44814627
type: Comment
comment on: http://stackoverflow.com/a/26978075
has text: @Radiodef I understand the OP's confusion with the instance initializers. Many of the GUI builders create a God object with nested initializers for each component to keep the initialization order in scope with the EDT ... it's quite a mess trying to refactor those instances into separate classes...
type: AnswerComment
score: 0

http://stackoverflow.com/q/26955367
answer count: 1
has title: how to get all the file list from all directory in default path in java
score: -1
has comment: http://stackoverflow.com/comment/42450403
has comment: http://stackoverflow.com/comment/42450395
downvote count: 1
has body: these are the folders in my default path in java module1/ module2/ in module1 there are files with file name as following : java.txt php.txt in module2 there are files with file name as following : mySQL.txt Javascript.txt i want to check the existence of a file identified by user input Scanner sc = new Scanner(System.in); String uInput; System.out.println("enter file to check"): sc.nextLine(); File f = new File(uInput+".txt"); for example uInput is "mySQL" then the expected output is as following : mySQL exists in FOLDER module2 and if uInput is "C++" then the expected output is as following : C++ does not exist in module1 , module2
has comment: http://stackoverflow.com/comment/42450428
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/42450386
has comment: http://stackoverflow.com/comment/42450458
has comment: http://stackoverflow.com/comment/42450524
has answer: http://stackoverflow.com/a/26955435
accepted answer: http://stackoverflow.com/a/26955435
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42450430

http://stackoverflow.com/q/26847488
downvote count: 3
type: Question
has body: So I'm just new at java and gui and we have this project to make a java program that will compute for a certain thing with GUI. I'm having this error "Error not a statement in java" can some body help me? And is it possible lessen the space at the textfield to make it more elegant? Here's my code: public class PHYSL_PROJ implements ActionListener { private JFrame f; private JPanel p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13; private JLabel MASS_OF_CALORIMETER, MASS_OF_STIRRER, SPECIFIC_HEAT_OF_CALORIMETER, SPECIFIC_HEAT_OF_STIRRER, MASS_OF_CALORIMETER_AND_WATER, MASS_OF_WATER, INITIAL_TEMP_OF_WATER_CALORIMETER_AND_STIRRER, EQUILIBRIUM_TEMP, MASS_OF_WATER_CALORIMETER_AND_STEAM, MASS_OF_STEAM, COMPUTED_VALUE_OF_HEAT_OF_VAPORIZATION_OF_WATER, ACCEPTED_VALUE_OF_HEAT_OF_VAPORIZATION_OF_WATER, PERCENT_ERROR; private JButton COMPUTE, RESET; private JTextField MASS_OF_CALORIMETER_t, MASS_OF_STIRRER_t, SPECIFIC_HEAT_OF_CALORIMETER_t, SPECIFIC_HEAT_OF_STIRRER_t, MASS_OF_CALORIMETER_AND_WATER_t, MASS_OF_WATER_t, INITIAL_TEMP_OF_WATER_CALORIMETER_AND_STIRRER_t, EQUILIBRIUM_TEMP_t, MASS_OF_WATER_CALORIMETER_AND_STEAM_t, MASS_OF_STEAM_t, COMPUTED_VALUE_OF_HEAT_OF_VAPORIZATION_OF_WATER_t, ACCEPTED_VALUE_OF_HEAT_OF_VAPORIZATION_OF_WATER_t, PERCENT_ERROR_t; public PHYSL_PROJ() { f = new JFrame("Heat of Fusion Calculator"); p0 = new JPanel(); p1 = new JPanel(); p2 = new JPanel(); p3 = new JPanel(); p4 = new JPanel(); p5 = new JPanel(); p6 = new JPanel(); p7 = new JPanel(); p8 = new JPanel(); p9 = new JPanel(); p10 = new JPanel(); p11 = new JPanel(); p12 = new JPanel(); p13 = new JPanel(); MASS_OF_CALORIMETER = new JLabel("Mass of calorimeter"); MASS_OF_STIRRER = new JLabel("Mass of stirrer"); SPECIFIC_HEAT_OF_CALORIMETER = new JLabel("Specific Heat of Calorimeter"); SPECIFIC_HEAT_OF_STIRRER = new JLabel("Specific Heat of Stirrer"); MASS_OF_CALORIMETER_AND_WATER = new JLabel("Mass of calorimeter and water"); MASS_OF_WATER = new JLabel("Mass of water (Mw)"); INITIAL_TEMP…
has answer: http://stackoverflow.com/a/26847547
upvote count: 0
has comment: http://stackoverflow.com/comment/42257826
has comment: http://stackoverflow.com/comment/42257770
answer count: 1
tagged with: user-interface
favorite count: 0
has comment: http://stackoverflow.com/comment/42257787
has comment: http://stackoverflow.com/comment/42257876
type: UnansweredQuestion
score: -3
tagged with: local-variables
tagged with: swing
has comment: http://stackoverflow.com/comment/42257827
has title: Error not a statement in java
tagged with: java

http://stackoverflow.com/q/26944645
tagged with: java
has body: I wanna read category from excel file i cant read it by row number because items may vary. I am using jxl. I can take each cell type but Im getting Type Label for every cell try { Workbook workbook = Workbook.getWorkbook(new File( "path to excel file")); Sheet sheet = workbook.getSheet(0); int colCount = sheet.getRows(); for (int i = 0; i &lt; colCount; i++) { Cell cell = sheet.getCell(0, i); System.out.println(cell.getType() + " " + cell.getContents()); } } catch (BiffException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } I need to take Category names separately.
type: Question
has title: Reading Category and Items From excel
tagged with: jxl
score: 0
has comment: http://stackoverflow.com/comment/42432651
answer count: 1
has comment: http://stackoverflow.com/comment/42432564
has answer: http://stackoverflow.com/a/26944986
type: UnansweredQuestion
tagged with: excel

http://stackoverflow.com/q/26888397
has answer: http://stackoverflow.com/a/26931074
score: 2
type: AnsweredQuestion
has body: I am using bcpkix-jdk15on-151.jar for PEMParser.java class and oracle java 7, But at line PEMParser pemRd = new PEMParser(fRd); I got following exeption Exception in thread "main" java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:800) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at org.bouncycastle.openssl.PEMParser.&lt;init&gt;(Unknown Source) at com.sarang.test.CertificateLoader.getCertificate(CertificateLoader.java:24) at com.sarang.test.CertificateLoader.main(CertificateLoader.java:43) my source code is : publ…
tagged with: java
type: Question
has title: Exception in thread "main" java.lang.VerifyError: class org.bouncycastle.asn1.ASN1Primitive overrides final method equals.(Ljava/lang/Object;)Z
upvote count: 3
answer count: 2
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26996797
accepted answer: http://stackoverflow.com/a/26996797
possible better answer: http://stackoverflow.com/a/26931074

http://stackoverflow.com/comment/42478277
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26970813
has text: I must make an objective method that returns the c same result as the java method.

http://stackoverflow.com/comment/42501544
type: QuestionComment
has text: hey peter my english is not very good i tried my best...i will try to edit it and add more content
comment on: http://stackoverflow.com/q/26983165
score: 0
type: Comment

http://stackoverflow.com/q/26893902
tagged with: java
has answer: http://stackoverflow.com/a/28684727
type: Question
has title: CAdES Digital Signature
has comment: http://stackoverflow.com/comment/42356882
has comment: http://stackoverflow.com/comment/42481084
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42411109
tagged with: digital-signature
favorite count: 0
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/42519389
type: UnansweredQuestion
has body: I've been trying to implement digital signing (CAdES) for PDF files using Portuguese Citizen Card, however I'm having a hard time figuring out the perfectly working solution. Currently I have two sets of code. First one: public void signCAdES(...) { String pkcs11Config = "name=GemPC" + "\n" + "library=C:\\WINDOWS\\SysWOW64\\pteidpkcs11.dll"; ByteArrayInputStream configStream = new ByteArrayInputStream(pkcs11Config.getBytes()); Provider pkcs11Provider = new sun.security.pkcs11.SunPKCS11(configStream); //provider_name: SunPKCS11-GemPC Security.addProvider(pkcs11Provider); javax.security.auth.callback.CallbackHandler cmdLineHdlr = new DialogCallbackHandler(); KeyStore.Builder builder = KeyStore.Builder.newInstance("PKCS11", pkcs11Provider, new KeyStore.CallbackHandlerProtection(cmdLineHdlr)); KeyStore ks= builder.getKeyStore(); PdfReader reader = new PdfReader(src); FileOutputStream os = new FileOutputStream(dest); PdfStamper stamper = PdfStamper.createSignature(reader, os, '\0', new File(tempPath), true); PdfSignatureAppearance appearance = stamper.getSignatureAppearance(); appearance.setReason(reason); appearance.setLocation(location); appearance.setCertificationLevel(level); String alias = "CITIZEN SIGNATURE CERTIFICATE"; //certificates from electronic card and resources folder Certificate[] certs = getSignatureCertificatesChain(ks); PrivateKey pk = (PrivateKey) ks.getKey(alias, null); ExternalSignature es = new PrivateKeySignature(pk, "SHA-1", pkcs11Provider.getName()); ExternalDigest digest = new BouncyCastleDigest(); MakeSignature.signDetached(appearance, digest, es, certs, null, null, null, 0, MakeSignature.CryptoStandard.CADES); } The first one works, however I have a validator given to me that verifies if the signatures of a PDF satisfies the standards, and it seems that one of the attributes is missing (sigining certificate issuer's serial number). The second one is different, and I have to add the attributes manually, however the generated PDF is corrupted (…
has comment: http://stackoverflow.com/comment/42408312
upvote count: 1
has comment: http://stackoverflow.com/comment/42400547
has comment: http://stackoverflow.com/comment/42414875
has comment: http://stackoverflow.com/comment/42517939
score: 1
has comment: http://stackoverflow.com/comment/42476228

http://stackoverflow.com/comment/42417761
has text: Thank you! I will test more for this and accept your answer if it works for all my case, would you please explain why `"\"$0\""` is like this, U an not very understand what it means, would you please update in your answer?
comment on: http://stackoverflow.com/a/26936602
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26886487
tagged with: java
linked to: http://stackoverflow.com/q/26792510
has comment: http://stackoverflow.com/comment/43853735
has body: I created an Android application project in eclipse for APIs 15-21. I imported libraries of appCompat v7, cardView and recyclerView but on adding recyclerView in my XML it gives android.support.v7.widget.RecyclerView failed to instantiate. I have the latest SDK with updated libraries. java.lang.UnsupportedOperationException: Unsupported Service: accessibility at com.android.layoutlib.bridge.android.BridgeContext.getSystemService(BridgeContext.java:465) at android.support.v7.widget.RecyclerView.&lt;init&gt;(RecyclerView.java:290) at android.support.v7.widget.RecyclerView.&lt;init&gt;(RecyclerView.java:266) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:442) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:194) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:782) at android.view.LayoutInflater.inflate(LayoutInflater.java:504) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:401) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:329) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:332) at com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderService.createRenderSession(RenderService.java:517) at com.android.ide.ecl…
type: Question
has comment: http://stackoverflow.com/comment/42327728
has answer: http://stackoverflow.com/a/29555538
score: 18
tagged with: eclipse
has answer: http://stackoverflow.com/a/28558653
has comment: http://stackoverflow.com/comment/59593496
answer count: 3
tagged with: android-support-library
favorite count: 0
has answer: http://stackoverflow.com/a/26887342
type: UnansweredQuestion
tagged with: android
upvote count: 18
linked to: http://stackoverflow.com/q/24440852
downvote count: 0
has title: android.support.v7.widget.RecyclerView failed to instantiate

http://stackoverflow.com/comment/42247656
type: Comment
has text: Try printing `laerer.getSkjemaliste().isEmpty()' directly, what is printed? You should try adding a break point and check the ss type.
score: 1
comment on: http://stackoverflow.com/q/26841806
type: QuestionComment

http://stackoverflow.com/comment/42502182
has text: I think you would be looking to test [side effects](http://junit.org/faq.html#atests_4) of your void methods. You generally want negative and positive tests. A negative test is one where you test the system by giving invalid data. A positive test is one where you pass valid data. Do you only have those 2 methods? If so, you might want to think about splitting that code up into a few methods, each of which does one well defined task. Breaking it down will make it: a) reusable and b) easier to test
score: 0
comment on: http://stackoverflow.com/q/26983926
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42381537
type: Comment
comment on: http://stackoverflow.com/q/26916443
has text: you may want to take a look at [this post](http://stackoverflow.com/questions/1466240/how-to-set-an-image-as-a-background-for-frame-in-swing-gui-of-java)
score: 0
type: QuestionComment

http://stackoverflow.com/q/26991896
has answer: http://stackoverflow.com/a/30051939
score: 1
tagged with: java
tagged with: itext
has comment: http://stackoverflow.com/comment/42516464
type: Question
has comment: http://stackoverflow.com/comment/42516013
answer count: 2
favorite count: 0
linked to: http://stackoverflow.com/q/14042693
has comment: http://stackoverflow.com/comment/42517031
upvote count: 1
tagged with: http://stackoverflow.com/tag/pdf
tagged with: text-extraction
has comment: http://stackoverflow.com/comment/42515195
has answer: http://stackoverflow.com/a/43493180
has comment: http://stackoverflow.com/comment/42515454
tagged with: bouncycastle
downvote count: 0
type: UnansweredQuestion
has body: I want to download and convert pdf files into plain text by using itextpdf.5.4.1. For most of them my code works but for one of them I encountered the error below when I try to read the file. PdfReader reader = new PdfReader(pdf_file_path); Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Primitive Does it mean that this pdf is protected and there is no way to extract the text?
has comment: http://stackoverflow.com/comment/42515545
linked to: http://stackoverflow.com/q/10391271
has title: I am getting java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1Primitive error
has comment: http://stackoverflow.com/comment/42515143

http://stackoverflow.com/comment/42366552
comment on: http://stackoverflow.com/q/26908066
type: Comment
type: QuestionComment
score: 1
has text: I guess you know but.. 1.4 is unsupported regarding security fixes since 2008 and is 4 versions behind now. A way out would be to upgrade the JVM.

http://stackoverflow.com/comment/42468591
comment on: http://stackoverflow.com/a/26965015
type: Comment
score: 0
has text: I can proceed now. Thanks A LOT for your help, Charlie.
type: AnswerComment

http://stackoverflow.com/comment/42336255
type: Comment
score: 0
type: AnswerComment
has text: Look at the linked javadocs, those are the offsets within the cell's text you want the styling to apply to
comment on: http://stackoverflow.com/a/26888659

http://stackoverflow.com/q/26938386
has title: Angularjs + spring security members only section
has body: I'm building a java webapp with a members only section using AngularJs. My question is in regards to AngularJs modules. Should I create two separate Angular modules for the members only and public portions of the app? btw I'm new to angularjs. thanks
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/29953694
tagged with: angularjs
tagged with: angularjs-module
type: UnansweredQuestion

http://stackoverflow.com/a/26930836
type: Answer
has comment: http://stackoverflow.com/comment/42406979
has comment: http://stackoverflow.com/comment/42406859
score: 0
type: AcceptedAnswer
has body: You can't modify any data from SMS content provider since KitKat, see: http://developer.android.com/about/versions/kitkat.html#44-sms-provider So it is not recommended to do what you want.
accepted answer of: http://stackoverflow.com/q/26930696
answers question: http://stackoverflow.com/q/26930696

http://stackoverflow.com/q/26988203
favorite count: 0
type: Question
has body: Using java reflection class A { @two public method1() { } @one public method2() { } @two public method3() { } public method4() { } } In the above given example of the code I want to retrieve annotated methods,non-annotated methods and all types of methods present inside a class as per the choice made by the user. for example- In the example given above I want to retrieve only annotated methods of the class A or only non-annotated methods of the class A or all the methods present inside class A. What should be the code for this example. can someone please help me out...
has title: how to retrieve annotated and non-annotated methods present inside a perticular class
score: 0
tagged with: annotations
upvote count: 1
downvote count: 1
answer count: 1
tagged with: java
linked to: http://stackoverflow.com/q/6593597
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26988533
has comment: http://stackoverflow.com/comment/42508850
has comment: http://stackoverflow.com/comment/42508907
tagged with: jsp

http://stackoverflow.com/q/26932676
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26932937
has comment: http://stackoverflow.com/comment/42410415
tagged with: http
has comment: http://stackoverflow.com/comment/42412726
has title: Manage HTTP method types
has answer: http://stackoverflow.com/a/26932849
has comment: http://stackoverflow.com/comment/42410436
tagged with: servlets
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42410461
linked to: http://stackoverflow.com/q/26881013
type: Question
accepted answer: http://stackoverflow.com/a/26932849
answer count: 2
has body: How do you manage specific HTTP method types for Java? I think has to do with servlets. I tried searching online but I don't quite understand it. I read something to do with extending to the genericServlet which allows implementation of HTTP requests. Then this allows me to utilize HTTP method types? I'm just really confused
has comment: http://stackoverflow.com/comment/42410668
has comment: http://stackoverflow.com/comment/42411172
has comment: http://stackoverflow.com/comment/42410401
possible better answer: http://stackoverflow.com/a/26932937

http://stackoverflow.com/comment/42451956
has text: @EmanuelGraf you should use Google Play Services, not Android SDK. I updated my answer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26956124
type: Comment

http://stackoverflow.com/comment/42342449
has text: I think making page objects as static will create a problem while you run your test in parallel with different browsers as in multi threaded operations static will not be shared between the two/more threads. Just try running a same tests in parallel with different browsers(drivers) and check. Eg: when you use static WebDriver driver and later changing it driver = chrome in one thread and driver = firefox may create problem.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26870858

http://stackoverflow.com/q/26975743
tagged with: selenium
type: Question
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/42527770
has body: I use selenium driver(chrome) to visit a commercial search engine. The problem is that when I click the "next page" button manually, it turns out the next page items,i.e. more search results show up. Surprisingly, when I check the source by right clicking the mouse "view page source" on the "next page", the source codes are the same as the former page! That is to say, something hides the page source of the current(next page) page! When I right click the "save as" to save all information on my local disk, source page of the "next page" does show up! Why is that? More worse, I use chromedriver to find the button "NextItem" and click it, but there is an "not clickable" error like this: unknown error: Element is not clickable at point (452, 202). Other element would receive the click: ... The part of my codes: List&lt;WebElement&gt; nextItems = chrome.findElementsByClassName("nextItem"); nextItems.get(0).click(); String sourePage=chrome.getPageSource(); THEN CRASH.... Why I can manually click the button but it cannot be clicked by the chromedriver? Need help!
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42488291
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26976145
has comment: http://stackoverflow.com/comment/42527481
tagged with: selenium-webdriver
tagged with: selenium-chromedriver
has title: clicking "next page button", the page shows next page but the source codes of the page remains the same
downvote count: 2

http://stackoverflow.com/q/26952639
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/26953189
tagged with: hashmap
has body: I need to sort a hash map, first according to value then according to key. TreeMap&lt;String,Integer&gt; dictionary = new TreeMap&lt;String,Integer&gt;(); For example, the desired output is something like: it - 2 of - 2 the - 2 times - 2 was - 2 best - 1 worst - 1 I tried tree map, but that only sorts it according to key. So basically, I need to sort my first according to the Integer (Highest to Lowest) and then according to the String (First A then B till Z). I searched online and saw that I'm gonna have to use comparator but I'm not sure how to make it work? Any guidance will be appreciated. This is for a Java assignment.
tagged with: java
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42445875
downvote count: 0
score: 1
tagged with: sorting
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26953189
has title: Sorting a hash map first according to value, then key secondarily
possible better answer: http://stackoverflow.com/a/26952969
has answer: http://stackoverflow.com/a/26952969

http://stackoverflow.com/comment/42268201
comment on: http://stackoverflow.com/q/26845806
score: 0
type: Comment
type: QuestionComment
has text: This is a known issue caused by a security update in a recent version of Flash Player; see https://forums.adobe.com/thread/1521470 and https://bugbase.adobe.com/index.cfm?event=bug&id=3759971. @CyanAngel's answer will let you send your request without being blocked by this security check.

http://stackoverflow.com/a/26910297
upvote count: 3
has body: You're adding two java.lang.String's for which class Sun/Oracle have already supplied fitting .hashCode() and .equals() methods for you :-) Note: It's not the collections that need the equals and hash methods - it's the objects you put into them! If you were to add YourOwnClass objects to a JDK collection, you must override both these methods sensibly. Consider this, where YourOwnClass falls back to java.lang.Object's implementations of the methods in point: class YourOwnClass { String a; public YourOwnClass(String a) { this.a = a; } } public void testYourOwnClass() throws Exception { Set<YourOwnClass> set = new HashSet<YourOwnClass>(); System.out.println( set.add( new YourOwnClass( "b" ) ) ); System.out.println( set.add( new YourOwnClass( "b" ) ) ); } This will print true true even though we could argue that the two YourOwnClass objects added should probably be considered identical from a semantic viewpoint. Then, modify YourOwnClass as follows, and try again. class YourOwnClass { String a; public YourOwnClass(String a) { this.a = a; } @Override public int hashCode() { return a.hashCode(); } @Override public boolean equals(Object obj) { return a.equals( ((YourOwnClass)obj).a ); } } Voila - "true false" this time! Cheers,
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/42370912
downvote count: 0
answers question: http://stackoverflow.com/q/26910225
has comment: http://stackoverflow.com/comment/42371508

http://stackoverflow.com/a/26951405
type: Answer
answers question: http://stackoverflow.com/q/26951385
has body: Because it's a collection of utilities to work with arrays. The other examples you've mentioned are actually instances of a particular type of collection. For example, the same naming convention has been followed in Guava for Lists, Sets, Maps etc.
score: 4
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/42455483
type: AnswerComment
has text: If you need to make it more realistic, introduce Switchable, CurrentCarrier and Wire.
type: Comment
comment on: http://stackoverflow.com/a/26938327
score: 0

http://stackoverflow.com/comment/42436888
has text: I tried however this appeared in the server logs. 11/15/2014 03:24:34 PM HTTP JVM: searchresults not instanceof RichTextItem. I also posted a screenshot that I've set the field to RichText type
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26940052

http://stackoverflow.com/comment/42507305
type: Comment
comment on: http://stackoverflow.com/q/26986219
score: 0
has text: I figured out what my problem was, the mousemotionlistener was actually working but getMousePosition() wasn't working, so I fixed it like this: ` public void mouseMoved(MouseEvent e) { mousePosition=new Point( (int)(MouseInfo.getPointerInfo().getLocation().getX() - this.getLocationOnScreen().x) , (int)(MouseInfo.getPointerInfo().getLocation().getY() - this.getLocationOnScreen().y) );`
type: QuestionComment

http://stackoverflow.com/comment/42255989
score: 2
has text: Since the invocation you show does not match the `java` command line you claim doesn't work, I think your problem is with `JAVA_OPTS`, no `$@`.
comment on: http://stackoverflow.com/q/26845314
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26943310
favorite count: 0
has comment: http://stackoverflow.com/comment/42429731
tagged with: android
linked to: http://stackoverflow.com/q/22906936
has title: Rotate a image with one finger keeping one end fixed
downvote count: 0
answer count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42429872
has body: I am creating a layout where it is similar to clock ,I need to fix one end to an axis and able to rotate the other end through gesture, Thank you
upvote count: 1

http://stackoverflow.com/comment/42363337
comment on: http://stackoverflow.com/a/26898570
score: 0
has text: I wasn't saying they were relevant, only that they were different from the standard config and hence *potentially* cause of the problem. Then it works even without changing the name of the root element ?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26916256
has body: You can use Visualizer to get the waveform data MediaPlayer mediaPlayer = new MediaPlayer(); . . . int audioSessionID = mediaPlayer.getAudioSessionId(); // Enable Equalizer if waveform was affected by device volume. // Equalizer equalizer = new Equalizer(0, audioSessionID); // equalizer.setEnabled(true); // Need android.permission.RECORD_AUDIO. Visualizer visualizer = new Visualizer(audioSessionID); visualizer.setCaptureSize(Visualizer.getCaptureSizeRange()[1]); visualizer.setDataCaptureListener(new Visualizer.OnDataCaptureListener() { public void onWaveFormDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) { // Send bytes (waveform) to your custom UI view to show it. } public void onFftDataCapture(Visualizer visualizer, byte[] bytes, int samplingRate) {} }, Visualizer.getMaxCaptureRate() / 2, true, false); visualizer.setEnabled(true); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { public void onCompletion(MediaPlayer mediaPlayer) { visualizer.setEnabled(false); } }); // TODO :: Do not forget to release visualizer onPause. Check this view http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.4.4_r1/com/example/android/apis/media/AudioFxDemo.java#VisualizerView on how to draw the waveform from the data retrieved from the Visualizer if (mPoints == null || mPoints.length &lt; mBytes.length * 4) { mPoints = new float[mBytes.length * 4]; } mRect.set(0, 0, getWidth(), getHeight()); for (int i = 0; i &lt; mBytes.length - 1; i++) { mPoints[i * 4] = mRect.width() * i / (mBytes.length - 1); mPoints[i * 4 + 1] = mRect.height() / 2 + ((byte) (mBytes[i] + 128)) * (mRect.height() / 2) / 128; mPoints[i * 4 + 2] = mRect.width() * (i + 1) / (mBytes.length - 1); mPoints[i * 4 + 3] = mRect.height() / 2 + ((byte) (mBytes[i + 1] + 128)) * (mRect.height() / 2) / 128; } canvas.drawLines(mPoints, mForePaint);
type: Answer
has comment: http://stackoverflow.com/comment/42385425
has comment: http://stackoverflow.com/comment/65177530
score: 0
answers question: http://stackoverflow.com/q/26913667

http://stackoverflow.com/q/26841972
linked to: http://stackoverflow.com/q/8982420
has comment: http://stackoverflow.com/comment/42248244
score: 0
has title: How to run a method with timeout?
has comment: http://stackoverflow.com/comment/42253953
answer count: 0
type: UnansweredQuestion
tagged with: multithreading
tagged with: spring
has body: I'd like to execute a specific method with a timeout. The wrapper method should block as long as the timeout method is still running. How could I best achieve this, preferably using Spring? public boolean run() { long start = System.currentTimeMillis(); try { executeWithTimeout(); //how? } catch (TimeoutException e) { long end = System.currentTimeMillis(); log.info("method could not complete"); return false; } return true; //block as long as the method above is still running }
tagged with: java
tagged with: concurrency
type: Question
linked to: http://stackoverflow.com/q/2275443

http://stackoverflow.com/q/26903213
tagged with: spring
type: AnsweredQuestion
has title: Need to start Oracle Coherence using Tomcat
tagged with: java
tagged with: hibernate
tagged with: oracle-coherence
has body: Can anyone tell me How to start Oracle Coherence using Tomcat? Oracle coherence needs to be started as part of the tomcat startup script. Below is our configuration we have 2 cluster, each cluster has 2 node.totally 4 nodes Each nodes on each physical server running jdk 1.6, spring framework. We are starting tomcat on the 4 physical servers The coherence needs to be started as part of the tomcat startup process on the 4 physical servers. any ref link is appreciated? Thanks in advance –
tagged with: tomcat6
has answer: http://stackoverflow.com/a/26921711
type: Question
has comment: http://stackoverflow.com/comment/42358295
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/28311813
accepted answer: http://stackoverflow.com/a/26921711
possible better answer: http://stackoverflow.com/a/28311813

http://stackoverflow.com/a/26897643
answers question: http://stackoverflow.com/q/26897556
has comment: http://stackoverflow.com/comment/42348839
has comment: http://stackoverflow.com/comment/42348487
type: Answer
has comment: http://stackoverflow.com/comment/42348411
has body: Just enable "show_sql" from Hibernate and copy and paste the generated SQL queries ;). Pseudocode for the loop part: User user = SELECT_USER_FROM_DB; List&lt;Thread&gt; threads = SELECT_THREAD_FROM_DB_WHERE_AUTHOR_ID_EQUALS_USER_ID; user.threads = threads; for(Thread thread : threads) { List&lt;Post&gt; posts = SELECT_POST_FROM_DB_WHERE_THREAD_ID_EQUALS_THREAD_ID; thread.posts = posts; } List&lt;Post&gt; posts = SELECT_POST_FROM_DB_WHERE_AUTHOR_ID_EQUALS_USER_ID; user.posts = posts; for(Post post : user.posts) { Thread thread = SELECT_THREAD_FROM_DB_WHERE_THREAD_ID_EQUALS_POST_THREAD_ID; post.thread = thread; } This will get all threads from the user. And for each of those threads, it will get all posts. Additionally it will get all posts made by this user. And at last, it will fetch all Threads for all user posts.
has comment: http://stackoverflow.com/comment/42348739
has comment: http://stackoverflow.com/comment/42348672
score: 0
has comment: http://stackoverflow.com/comment/42348980

http://stackoverflow.com/comment/42277180
type: Comment
type: QuestionComment
has text: @MadProgrammer or even String.equals
score: 0
comment on: http://stackoverflow.com/q/26857776

http://stackoverflow.com/comment/42273155
comment on: http://stackoverflow.com/q/26844581
type: QuestionComment
has text: Maybe you should review a tool called Hyperjaxb3, that enables integration between jpa and jaxb. Hope it helps.
score: 0
type: Comment

http://stackoverflow.com/comment/42378432
type: Comment
type: QuestionComment
has text: Webapp with servlets. I'm also using Spring.
comment on: http://stackoverflow.com/q/26914456
score: 0

http://stackoverflow.com/q/26870497
has comment: http://stackoverflow.com/comment/42300313
has comment: http://stackoverflow.com/comment/42300241
upvote count: 3
answer count: 1
tagged with: callback
favorite count: 0
linked to: http://stackoverflow.com/q/13901339
tagged with: android-asynctask
tagged with: listener
has title: Android callback listener - send value from pojo in SDK to an application's activity
tagged with: android
has body: I have a java class buried deep in an SDK that performs an action and returns a boolean. It has no knowledge of the application's main activity, but I need the main activity to receive that boolean value. I've seen a lot of questions regarding callbacks, broadcasts, and listeners but they all seem to have knowledge of the activity. My pojo does have an activityContext but I don't know how to get the value back to the application's main activity. I'm already using an AsyncTask in my pojo and I'm trying to figure out how to send the boolean in the onPostExecute method in a way that the application's main activity can receive it. Does anybody know how to do this?
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26871315
type: Question
has answer: http://stackoverflow.com/a/26871315

http://stackoverflow.com/comment/42306791
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26874292
has text: When i worked in j2me we used to remove the class with all the constants to save memory because it is useless after compiling.

http://stackoverflow.com/a/26843561
answers question: http://stackoverflow.com/q/26842239
has body: Multiple "OOP suitability issues" could arise from your solution. The way you expose your problem and solutions is pretty much not oriented to an object oriented solution. You are thinking about actions and operations. In OOP the typical first thinking would be more about identifying/choosing your actors (the objects) and their communication (API or not private method usage). Having said that, looking at the two alternatives you present, plus what you say about your class responsibility, a more broad programming practice is at stake, the Single Responsibility Principle (as pointed in BartoszKP answer for the method responsibility). Your class should represent something more single and narrow than "and other operations".
score: 0
type: Answer

http://stackoverflow.com/q/26938670
answer count: 5
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42421622
upvote count: 1
has answer: http://stackoverflow.com/a/26938878
has answer: http://stackoverflow.com/a/26938763
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26938759
tagged with: java
has comment: http://stackoverflow.com/comment/42421685
tagged with: duplicates
has answer: http://stackoverflow.com/a/26939039
score: 0
accepted answer: http://stackoverflow.com/a/26938878
tagged with: arrays
has body: I am trying to remove duplicated words from an array, and I keep getting null values. I'm not allowed to use java sorting methods so I have to develop my own. Here's my code: public class Duplicate{ public static void main(String[] args){ String[] test = {"a", "b", "abvc", "abccc", "a", "bbc", "ccc", "abc", "bbc"}; removeDuplicate(test); } public static String[] removeDuplicate(String[] words){ boolean [] isDuplicate = new boolean[words.length]; int i,j; String[] tmp = new String[words.length]; for (i = 0; i &lt; words.length ; i++){ if (isDuplicate[i]) continue; for(j = 0; j &lt; words.length ; j++){ if (words[i].equals(words[j])) { isDuplicate[j] = true; tmp[i] = words[i]; } } } for(i=0;i&lt;words.length;i++) System.out.println(tmp[i]); return tmp; } } I tried doing if(words == null) words == ""; But it doesn't work. I also want to return the tmp array with a new size. For example, test array length = 9, after removing the duplicates,I should get a new array with a length of 7.Thank you for your help. EDIT: result i get: a b abvc abccc null bbc ccc abc null
favorite count: 0
possible better answer: http://stackoverflow.com/a/26938999
has title: removing duplicated words from an array
has answer: http://stackoverflow.com/a/26938999

http://stackoverflow.com/q/26846152
type: UnansweredQuestion
has body: I just started a new Java Project and I'm working on Animations atm, my question now is how do I link my res source folder with the project so that I can read images via img = ImageIO.read(getClass().getClassLoader().getResourceAsStream(name)); from that folder? Normally I they can only be read when they are in the
linked to: http://stackoverflow.com/q/9053146
has title: How do I link my res folder to my java project
has comment: http://stackoverflow.com/comment/42255401
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26846253
score: -1
has comment: http://stackoverflow.com/comment/42255636
tagged with: file-io
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42255364
favorite count: 0
has comment: http://stackoverflow.com/comment/42255459

http://stackoverflow.com/a/26946673
type: Answer
answers question: http://stackoverflow.com/q/26946619
score: 2
upvote count: 2
has body: You only draw one rectangle in your paint method, and so it makes sense that only one will show. If you need to draw more, do so, using a for loop that loops through perhaps a Rectangle ArrayList&lt;Rectangle&gt;. Another way is to make shifting local and do a bit of simple math inside paintComponent to see what to draw and where. For instance, draw your completed bars inside of a for loop, for (int i = 0; i &lt; filling / getHeight(); i++) {, and your yet to be completed bar up to filling % getHeight(). You should not draw directly within a JApplet but rather in the paintComponent method of a JPanel. A Swing Timer is easier to use than a thread (for me at least), and can be safer. For example, this can be created by the code below: import java.awt.BorderLayout; 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.KeyEvent; import java.lang.reflect.InvocationTargetException; import javax.swing.*; @SuppressWarnings("serial") public class FillingBar2 extends JApplet { @Override public void init() { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { FillingBarPanel fillingBarPanel = new FillingBarPanel(); add(fillingBarPanel); add(new JButton(new StartAction(fillingBarPanel)), BorderLayout.PAGE_END); setSize(getPreferredSize()); } }); } catch (InvocationTargetException | InterruptedException e) { System.err.println("Big Problems"); e.printStackTrace(); } } } @SuppressWarnings("serial") class StartAction extends AbstractAction { private FillingBarPanel fillingBarPanel; public StartAction(FillingBarPanel fillingBarPanel) { super("Start"); putValue(MNEMONIC_KEY, KeyEvent.VK_S); this.fillingBarPanel = fillingBarPanel; } @Override public void actionPerformed(ActionEvent evt) { fillingBarPanel.start(); } } @SuppressWarnings("serial") class FillingBarPanel extends JPanel { private static final int BAR_WIDTH = 20; private static final int T…
accepted answer of: http://stackoverflow.com/q/26946619
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42492328
score: 0
comment on: http://stackoverflow.com/q/26978791
type: QuestionComment
type: Comment
has text: @StackFlowed Or maybe http://cs.stackexchange.com

http://stackoverflow.com/q/26960877
has comment: http://stackoverflow.com/comment/42460067
tagged with: graphics
tagged with: 2d
tagged with: java
has comment: http://stackoverflow.com/comment/42460130
has title: Drawing graphics2D java
type: Question
downvote count: 0
score: 1
tagged with: lines
has body: I need to draw a circle between 2 lines. When I click on the panel, a line is drawn. When I click a second time, another line is drawn and the color of the line has changed. Also, at the 2nd click, a circle is drawn between the 2 lines. Then, there is a little animation with the circle. Someone helped me yesterday with this code : List&lt;Integer&gt; yClicks = new ArrayList&lt;&gt;(); { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { yClicks.add(e.getY()); repaint(); } }); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D)g.create(); for(int y : yClicks) { g2d.draw(new Line2D.Double(0, y, getWidth(), y)); } g2d.dispose(); } I added this: for(int y : yClicks) { line1= new Line2D.Double(0, y, getWidth(), y); g2d.setColor(Color.blue); g2d.draw(line1); int l2= (yClicks.get(1)); int Diameter=l2-y; g2d.setColor(Color.yellow); g2d.draw(new Line2D.Double(0,l2,getWidth(),l2)); g2d.draw(new Ellipse2D.Double(getWidth()/2,(Diameter),10,10)); } g2d.dispose(); } But there is a problem withe the code and maybe circle are drawn. I never used this form of a for loop, so i don't know. how to add something on the loop. I also tried if(y==2) but it doesn't do anything.
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
linked to: http://stackoverflow.com/q/26950769
tagged with: swing

http://stackoverflow.com/q/26920142
has comment: http://stackoverflow.com/comment/42388601
score: 0
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/42388836
accepted answer: http://stackoverflow.com/a/26920253
has title: Finding Smallest Number in An Array errors
has comment: http://stackoverflow.com/comment/42388808
has comment: http://stackoverflow.com/comment/42388577
has comment: http://stackoverflow.com/comment/42388683
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42388638
tagged with: arrays
has body: I'm trying to find the smallest number in a array of 1000 possible slots but my code keeps returning 0 even though 0 is not one of my inputs. My problem is in the last for loop, the rest of the code works. Here is my code: import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Scanner; public class SmallestNumber { public static boolean isInteger(String num) { boolean again=false; try { int d= Integer.parseInt(num); again=true; } catch(NumberFormatException e) { again=false; } return again; } public static void main(String[] args) { int [] intNum = new int[1000]; int i=0; String num; boolean repeat = false; String done="done"; Scanner inData = new Scanner(System.in); System.out.println("You can enter up to 1000 integers." + "\n" + "Enter 'done' to finish"); while (!repeat) { System.out.print("Int: "); num=inData.next(); repeat=isInteger(num); if (repeat==false) { String entry=num.toUpperCase(); boolean equals=entry.equals("DONE"); if (equals==true) { repeat=true; } else { System.out.println("Error: you did not enter a valid chracter. Please enter a interger or state 'done'"); repeat=false; } } else { int number=Integer.parseInt(num); intNum[i]=number; i=i+1; if(i&lt;1000) { repeat=false; } else { repeat=true; } } } int temp=intNum[0]; for(int j=1;j&lt;intNum.length;j++) { if (intNum[j]&lt;temp) { intNum[j]=temp; } else { } } System.out.print(temp); } }
has comment: http://stackoverflow.com/comment/42388641
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26920382
has comment: http://stackoverflow.com/comment/42388989
has answer: http://stackoverflow.com/a/26920253
has comment: http://stackoverflow.com/comment/42389026
type: Question
possible better answer: http://stackoverflow.com/a/26920380
has comment: http://stackoverflow.com/comment/42388658
has comment: http://stackoverflow.com/comment/42388811
has answer: http://stackoverflow.com/a/26920380

http://stackoverflow.com/a/26853825
has comment: http://stackoverflow.com/comment/42297957
has comment: http://stackoverflow.com/comment/42298459
has comment: http://stackoverflow.com/comment/42297884
has comment: http://stackoverflow.com/comment/42300837
has comment: http://stackoverflow.com/comment/42298043
has comment: http://stackoverflow.com/comment/42298148
answers question: http://stackoverflow.com/q/26853775
downvote count: 0
has body: You should implement onItemclicklistner lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; adapter, View v, int position, long arg3) { //in this method you get position and view of the item clicked the list } });
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/26863012
has title: What's the Best way to accept a 'date of birth' value and store it in a database
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42286110
has comment: http://stackoverflow.com/comment/42285943
has answer: http://stackoverflow.com/a/26870730
has comment: http://stackoverflow.com/comment/42322672
linked to: http://stackoverflow.com/q/9368450
tagged with: netbeans
has body: I created a Swing GUI form in Netbeans to accept Student Details. The details include studentId, Surname, Middle Name, first Name, Date of birth and others. I tried accepting date of birth values with 3 combo boxes. I don't know how to store this combo box values in a database. Note: I created a table and set a column 'dOB' with 'date' data type. If the comboBox can't be used? Any other suggestions?
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/42338216
has comment: http://stackoverflow.com/comment/42285997
tagged with: java
tagged with: database
tagged with: date
type: Question
downvote count: 4
upvote count: 0

http://stackoverflow.com/a/26941807
has comment: http://stackoverflow.com/comment/42427852
has comment: http://stackoverflow.com/comment/42427715
has body: You can use the modulus operator (%) in the printing loops to see if the index is a multiple of ten. If it is, print a newline. Something like this would work: for(...){ System.out.print(...); if(count%10==0 &amp;&amp; count!=0){ // if the index of the number is a multiple of 10 but not the first number System.out.println(); // print a newline to separate rows } } This will add a newline after the 10th, 20th, 30th, etc. numbers.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26941589
has comment: http://stackoverflow.com/comment/42427657
downvote count: 0
has comment: http://stackoverflow.com/comment/42428049
type: Answer

http://stackoverflow.com/q/26967755
has answer: http://stackoverflow.com/a/26978537
favorite count: 0
tagged with: serialization
tagged with: android
tagged with: ormlite
score: -1
accepted answer: http://stackoverflow.com/a/26978537
downvote count: 1
has body: I use ORMLite and now have got a question that I can not answer. Look at my example : I have class implementes Serializable. class Time implements Serializable { private long time; ...blabla } and class Operation that includes Time class Operation implements Serializable { private Time time; ...blabla } Operation is a database table but Time not. As I think Time stored in database as byte array because it is Serializable Object. The question is it right to use ORMLite query like eq(), between() and other like that : OperationDao.queryBuilder().where().between("time_field", timeObject1, timeObject2); I am interested in : How does it work? Can I do queries like this and how? Or it is impossible, because Time is byte array and can not be used for query? Thanks for good answers.
type: AnsweredQuestion
tagged with: java
has title: Android ORMLite, query by Serializable object
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/105013283
comment on: http://stackoverflow.com/a/26838374
has text: You suggest that `parallel().forEach` would distribute the work across threads interleaving i values, e.g. each of 4 threads doing `i+=4` from different starting points. That would make the interface unusably bad for doing anything with an array; surely a sane implementation would break the range up into contiguous sub-ranges of `i` values so each thread only touches some of the cache lines. Thread startup overhead and flawed benchmarking (no warmup for the JVM, CPU frequency, or array page faults) is still enough to explain a big perf difference for a simple memset loop over only 400kB.
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/q/26924281
answer count: 1
has body: We have been using HBase for one of our products. We have many tables, each with different column families and their own configurations related to regions, time to live etc.. Now I want to bundle all the details into an installer program, which upon running will generate all the tables as required. Is there a well known way to do that? All am looking forward to is something similar to what we write in RDBMS tables schema file (like .sql files etc). Or we have to write a program to do the same manually in Java? Kindly help. Thanks.
favorite count: 0
tagged with: hbase
tagged with: nosql
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26931056
score: 1
tagged with: java
has title: HBase schema file for a product
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26931056

ant
tags question: http://stackoverflow.com/q/26873889
tags question: http://stackoverflow.com/q/26843500
tags question: http://stackoverflow.com/q/26984642
tags question: http://stackoverflow.com/q/26865253
tags question: http://stackoverflow.com/q/26853366
tags question: http://stackoverflow.com/q/26918008
type: Tag
tags question: http://stackoverflow.com/q/26845769
tags question: http://stackoverflow.com/q/26950771
tags question: http://stackoverflow.com/q/26848673
tags question: http://stackoverflow.com/q/26865292
tags question: http://stackoverflow.com/q/26938112
tags question: http://stackoverflow.com/q/26966687
tags question: http://stackoverflow.com/q/26839085
tags question: http://stackoverflow.com/q/26981500
tags question: http://stackoverflow.com/q/26949419
tag name: ant
tags question: http://stackoverflow.com/q/26849697
tags question: http://stackoverflow.com/q/26883260
tags question: http://stackoverflow.com/q/26905672
tags question: http://stackoverflow.com/q/26839946
tags question: http://stackoverflow.com/q/26840149
tags question: http://stackoverflow.com/q/26978824
tags question: http://stackoverflow.com/q/26958954

http://stackoverflow.com/q/26838002
tagged with: linkedhashmap
score: 0
tagged with: chart-director
answer count: 1
has title: How to use ChartDirector.XYChart addLineLayer() method with argument as Double;
has answer: http://stackoverflow.com/a/26844103
has body: I want to display my output in graphical format using ChartDirector.XYChart.When I use its addLineLayer()method with arugument as Double Type array, then it shows an error "The method addLineLayer(double[]) in the type XYChart is not applicable for the arguments (Double[])".but When I use double as argument then it takes the value.The values in Double Array holds the LinkedHashMap value. So it cant't be represented in primitive type double array. My code is: //Assign linkedHashMap values to array Double[] avg= (Double[]) averageMap.values().toArray(); char[] time= rs.getString(logtime).toCharArray(); XYChart c = new XYChart(250, 250); c.setPlotArea(30, 20, 200, 200); c.addLineLayer(avg); Error is on c.addlineLayer.How to fix it. thanks in advance.
type: UnansweredQuestion
tagged with: double
tagged with: java
type: Question

http://stackoverflow.com/a/26874292
has comment: http://stackoverflow.com/comment/42306572
has comment: http://stackoverflow.com/comment/42306650
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42306791
answers question: http://stackoverflow.com/q/26874165
has comment: http://stackoverflow.com/comment/42307085
has body: You use constants generated in the R class. They are numeric static constants. Java compiler/optimizer will replace them with the value as they go. There won't be a reference when decompiling.
accepted answer of: http://stackoverflow.com/q/26874165
has comment: http://stackoverflow.com/comment/42306713
type: Answer
has comment: http://stackoverflow.com/comment/42378261
has comment: http://stackoverflow.com/comment/42306773

http://stackoverflow.com/comment/42428447
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26942253
has text: For now I just went ahead and used some synchronized lazy initialization between Task A and Task B, which overcomes the complex dependencies they have with each other, and I called the lazy methods as runnable tasks to get some asynchronous gains. I'll look at dividing the threadpools later.
score: 0

http://stackoverflow.com/q/26907475
tagged with: jaxb
type: Question
answer count: 1
score: 0
has title: How to move namespace declaration from operation to root element?
has answer: http://stackoverflow.com/a/63210893
has body: our soap message looks like the following: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Header&gt; &lt;...&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;ns2:operation xmlns="urn:namespace2" xmlns:ns2="urn:namespace1"&gt; &lt;rootElement&gt; &lt;childElement&gt; &lt;....&gt; &lt;/childElement&gt; &lt;/rootElement&gt; &lt;/ns2:operation&gt; &lt;/soap:Body&gt; But I need the following output: &lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt; &lt;soap:Header&gt; &lt;...&gt; &lt;/soap:Header&gt; &lt;soap:Body&gt; &lt;ns2:operation xmlns:ns2="urn:namespace1"&gt; &lt;rootElement xmlns="urn:namespace2"&gt; &lt;childElement&gt; &lt;..&gt; &lt;/childElement&gt; &lt;/rootElement&gt; &lt;/ns2:operation&gt; &lt;/soap:Body&gt; I've used the wsdl2java from cxf to generate the webservice/jaxb classes. Is it possible to change the behaviour of jaxb so that the namespace is declared in the root elment and not in the operation defined in the wsdl? I think one possibility is to use a CxfOutInterceptor to manipulate the message before sending, but I think there have to be a more easier/faster solution.(like, for example, adding a simple annotation that I don't know to the generated jaxb classes). kind regards, soilworker
tagged with: cxf
has comment: http://stackoverflow.com/comment/42366854
linked to: http://stackoverflow.com/q/16361986
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42366048
tagged with: java
accepted answer: http://stackoverflow.com/a/63210893

http://stackoverflow.com/comment/42519682
comment on: http://stackoverflow.com/q/26963528
has text: Really appreciate you looking at this. Maybe its something I am doing wrong. I've added the code I am using with for the toast in above. Maybe the problem is there?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26936721
tagged with: spring
tagged with: spring-mvc
score: 2
has answer: http://stackoverflow.com/a/26936826
tagged with: spring-integration
has answer: http://stackoverflow.com/a/26937920
tagged with: tcp
tagged with: java
type: Question
upvote count: 2
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/18385361
linked to: http://stackoverflow.com/q/20574038
favorite count: 0
has body: So following this question (how to plug a TCP-IP client server in a spring MVC application), I was successfully able to wire a Gateway into my Spring REST controller. However, I'm confused as to where to go next. Here's what I'm trying to accomplish: 1) When a certain route is hit with a POST request, open a connection to a certain IP (or work with a connection that's already open with this IP) passed from the POST and send a message. @RequestMethod(value = '/sendTcpMessage', method=RequestMethod.POST) public void sendTcpMessage(@RequestParam(value="ipAddress", required=true) String ipAddress, @RequestParam(value="message", required=true) String message) { //send the message contained in the 'message' variable to the IP address located //at 'ipAddress' - how do I do this? } 2) I also need my Spring backend to listen to TCP "messages" passed to it, and store them in a buffer. My Javascript will call a route every 5 seconds or so and read the information out of the buffer. Here is my controller code: @Controller public class HomeController { @Resource(name = "userDaoImpl") private UserDAO userDao; @Resource(name = "receiveTcp") private ReceiveTcp tcpMessageReceiver; @Autowired SimpleGateway gw; String tcpBuffer[] = new String[100]; @RequestMapping(value="/") public String home() { return "homepage"; } @RequestMapping(value = "/checkTcpBuffer", method=RequestMethod.POST) public String[] passTcpBuffer() { return tcpMessageReceiver.transferBuffer(); } } root-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:int="http://www.springframework.org/schema/integration" xmlns:int-ip="http://www.springframework.org/schema/integration/ip" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration/ip http://www.springframework.org/schema/int…
has title: How do I set up a Spring TCP client and server model?
type: UnansweredQuestion

http://stackoverflow.com/comment/42515495
comment on: http://stackoverflow.com/a/26992101
has text: You are right, after removing the code the HTML appeared, but its deformed, I am posting the same output in the question.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26982354
favorite count: 0
has title: Android Application Architecture - Design Pattern
type: UnansweredQuestion
tagged with: android
tagged with: architecture
has answer: http://stackoverflow.com/a/26982457
tagged with: java
has body: Need your valuable suggestions here. :) I have to design an application which is almost similar to Zomato Application, i.e., it has various screens..the content is stored in the central server, and through the API the content is fetched and displayed on the screen. What are generally the design /architectures used in Apps like zomato. How do we make apps that recover after going to the background/ Android Killing the state of the App? Can you please let me know if you have had experience of having built any app similar to Zomato. Thanks for listening.
downvote count: 1
type: Question
score: -1
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/42459430
score: 0
type: AnswerComment
type: Comment
has text: still no luck, but added a comment that might be a problem
comment on: http://stackoverflow.com/a/26959236

http://stackoverflow.com/comment/42312368
type: QuestionComment
score: 1
has text: No your loop is ok. Most probably issue is that you are not setting `handTotal` to 0 before entering the loop.
comment on: http://stackoverflow.com/q/26877611
type: Comment

http://stackoverflow.com/a/27048158
upvote count: 2
has body: We've had a lot of success using setStartDelay (or setStartOffset, depending on which animators you are using). Have a delay variable that starts at 0, and as you walk through your children creating their animations, set the start delay to the current value and add some increment, such as 100 ms.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26934147

http://stackoverflow.com/comment/42514163
type: Comment
type: QuestionComment
has text: Thanks for response but i've added a @GET before the function sayHello in TestSessionBean class but it didn't work: localhost:8080/ejbtest/test/peter? Do you think that i need to import or do something with eclipse configuration?
comment on: http://stackoverflow.com/q/26986718
score: 0

http://stackoverflow.com/comment/42466901
comment on: http://stackoverflow.com/a/26964421
has text: @Tom see my edits. Also, in your comment you are clearly calling `account.getIssuerCode("")` - a blank issuerSymbol
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26849245
has answer: http://stackoverflow.com/a/26849685
type: Question
tagged with: threadpool
score: -1
tagged with: concurrency
downvote count: 1
answer count: 1
has body: I'm new to web crawlers and I'm trying to crawl a website (which is successful) and add the data I want to a synchronized List which is successful. However after the pool of threads has executed, how can I print that list of data. My mind has gone blank but basically if I have a superclass car and subclasses porshe, ferrari etc and the subclasses implement runnable and after a successful crawl the data is added to the superclass list. How can I retrieve this list just for debugging purposes so that I know beforehand I can persist the data to a database. EDIT This is my main method public static void main(String[] args) { System.out.println("thread pool started"); ExecutorService exec = Executors.newFixedThreadPool(2); for (int i=0; i&lt;1; i++){ exec.execute(new Porshe()); exec.execute(new Ferrari()); } exec.shutdown(); try { exec.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS); } catch (InterruptedException ex) { Logger.getLogger(JSoupTest.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("Thread pool exited, printing list"); } I need a list printed here of all cars added to synchronized list This is the superclass public class Cars { public List&lt;JSONObject&gt; list; private int count = 1; public Cars(){ list = Collections.synchronizedList(new ArrayList&lt;JSONObject&gt;()); } public synchronized void addToMap(JSONObject obj){ list.add(obj); }; ...etc This is the subclass that implements runnable so can execute as a thread public class Porshe extends Cars implements Runnable{ private String url = ""; private JSONObject data = new JSONObject(); public Porshe() { super(); this.url = "http://www.autotrader.co.uk" } @Override public void run() { crawl(20); }
has title: Saving the state of threads after execution to print list
favorite count: 0
accepted answer: http://stackoverflow.com/a/26849685
has comment: http://stackoverflow.com/comment/42261320
type: AnsweredQuestion
upvote count: 0
tagged with: list
tagged with: java

http://stackoverflow.com/q/26887628
tagged with: java
type: Question
has body: There is a problem with the pagination predicate in the version Hazelcast 3.3.2, The Hazelcast map contains 20 data, When we try to get the limited data using pagingpredicate (Ex : 10), It is not returning the first 10 data, If I give pagingpredicate.nextPage(), Am getting 10 data where few data are already given in first ten data. I mean to say If I hit pagingpredicate (Ex: 10), It is not properly returning the first 10 data, It is mixing with the remaing data in the map, It happens even for pagingPredicate.nextPage() too.
tagged with: pagination
has title: Paging predicate in hazelcast
has answer: http://stackoverflow.com/a/28940318
score: 0
answer count: 1
tagged with: hazelcast
type: UnansweredQuestion

http://stackoverflow.com/comment/90190162
has text: very good response! re this topic, this paper is also worth a read: http://madeyski.e-informatyka.pl/download/Madeyski10c.pdf: (regarding branch coverage & mutation score) _" ... the benefits of the Test-First practice [...] can be considered minor."_
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/49591709
score: 0

http://stackoverflow.com/a/26947550
has comment: http://stackoverflow.com/comment/42437346
has body: You forgot to assign it to instance public static Loader instance() { if (instance == null) { instance = new Loader(); System.out.println("Loader ready"); } return instance; } And by the way, if thats a singleton then it's wrong (not thread-safe), Here's a way to implement the singleton pattern.
has comment: http://stackoverflow.com/comment/42437407
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/42437210
has comment: http://stackoverflow.com/comment/42437754
downvote count: 0
has comment: http://stackoverflow.com/comment/42437870
has comment: http://stackoverflow.com/comment/42437814
has comment: http://stackoverflow.com/comment/42438757
answers question: http://stackoverflow.com/q/26947534
score: 5

http://stackoverflow.com/q/26939576
has comment: http://stackoverflow.com/comment/42423383
answer count: 0
tagged with: jquery
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42423633
tagged with: java
has body: I have a hash map in java, with key as state code and value as list of county codes. While displaying in jsp i have to check to see if the county list for each state is greater than zero, If the size is greater than zero then i have to display the state code as hyperlink and when clicked on the hyperlink i should show all the county codes in a small overlay. Is there a way i can pass java list to a jquery function and display it in a overlay ?
type: UnansweredQuestion
has title: how to display a java collections in jquery?
has comment: http://stackoverflow.com/comment/42424051

http://stackoverflow.com/comment/42268465
type: QuestionComment
score: 1
has text: The documentation for setClassName(string, string) says public Intent setClassName (String packageName, String className). But it looks like you specified a className for both.
comment on: http://stackoverflow.com/q/26852091
type: Comment

http://stackoverflow.com/comment/42341533
comment on: http://stackoverflow.com/q/26892452
score: 0
type: Comment
type: QuestionComment
has text: I tried moving the method from the abstract class to the child class with no change in the behavior. I've added a link to the logs, but there's nothing particularly interesting there that I can find.

http://stackoverflow.com/q/26966091
favorite count: 0
has comment: http://stackoverflow.com/comment/42469391
has body: I'm having trouble figuring out how to find the occurrence of the numbers inside a 2D array. I'm new to java, so I have to do this program without using maps/advanced solutions. Example: Given Array (by the user): Result: This is what I have so far (the method I have trouble figuring out most is freqOccurrence!!!): public static void main(String[] args) { int i, j; int[][] m = readDimension(); lerMatriz(m); System.out.println(Arrays.deepToString(m)); freqOccurrence(m); } private static int[][] readDimension() { Scanner in = new Scanner(System.in); System.out.println("Number of rows? "); int i = in.nextInt(); while (i &lt; 1) { System.out.println("Please define a valid number of rows. "); i = in.nextInt(); } System.out.println("Number of columns? "); int j = in.nextInt(); while (j &lt; 1) { System.out.println("Please define a valid number of columns. "); j = in.nextInt(); } int[][] m = new int[i][j]; return m; } private static void readMatrix(int[][] m) { Scanner in = new Scanner(System.in); System.out.println("\nInput integers to save in the array:"); for (int i = 0; i &lt; m.length; i++) { for (int j = 0; j &lt; m[i].length; j++) { System.out.print("Element " + i + "," + j + ": "); m[i][j] = in.nextInt(); } } } private static double freqOccurrence(int[][] m) { //?????????????????? int num = 0; int[][] m2 = new int[][]; for (int i = 0; i &lt; m.length; i++) { for (int j = 0; j &lt; m[i].length; j++) { if (m[i] == num) { m2[num]++; } } } } I appreciate all the help!
accepted answer: http://stackoverflow.com/a/26967022
has comment: http://stackoverflow.com/comment/42470940
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has title: Print (in descending order) the number occurrence in a 2D array
type: Question
has comment: http://stackoverflow.com/comment/42470571
tagged with: arrays
has answer: http://stackoverflow.com/a/26966949
has answer: http://stackoverflow.com/a/26967022
answer count: 2
possible better answer: http://stackoverflow.com/a/26966949
has comment: http://stackoverflow.com/comment/42470417
downvote count: 0

http://stackoverflow.com/a/26929312
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/26929259
has body: In Java, you don't compare strings with ==, you use equals (more): if(op.equals("*")) If you're using Java 7 or higher, you can use strings in switch statements, which would make sense for a list of operators like that: switch (op) { case "*": System.out.println("X x Y : "+(x*y)); break; case "+": System.out.println("X + Y : "+(x+y)); // &lt;== Also see note below break; default: System.out.println("X - Y : "+(x-y)); break; } This wouldn't compile in Java 6 and earlier. Separately, as Bobby points out in a comment, you have * where you want + in the + operation in your if/else if. (It's corrected in the switch above.)
downvote count: 0
score: 6

http://stackoverflow.com/q/26963998
has answer: http://stackoverflow.com/a/26976146
favorite count: 0
tagged with: security
has body: I wanted to use the OSGi User Admin service for security but I could not get enough resource about it. I want to authenticate certain bundles that will be installed in the system and represent them by User-Objects after authentication. So that I can later use these User-Object for authorization. I have 2 questions: Since I have more than one user, how can I know which bundle is calling a secured method? (I don't want to pass the user object as a parameter to every method I want to control). How can I relate the bundles with the User-Object representing them? I want to have one bundle as an entry point that will authenticate all these other bundles and have control over them. But I couldn't even find anyone mentioning using User Admin service. Is there another option for OSGi security besides CPA? I would like to use this to secure my console as well.
tagged with: osgi
tagged with: user-permissions
has title: OSGi User Admin Service User Objects
tagged with: user-roles
upvote count: 2
accepted answer: http://stackoverflow.com/a/26976146
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/42258774
comment on: http://stackoverflow.com/q/26847918
has text: a quick browse through the documentation http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/MultipartEntityBuilder.html shows there's a addBinaryBody which might be what you need. have you tried this? it seems to have the content type, filename, file already.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42372974
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26911646
type: AnswerComment
has text: ok, i understand the problem but i really dont know what to do, i mean how can i fix this, is this a code syntax error?

http://stackoverflow.com/a/26853683
has comment: http://stackoverflow.com/comment/42299572
accepted answer of: http://stackoverflow.com/q/26853644
type: Answer
answers question: http://stackoverflow.com/q/26853644
has comment: http://stackoverflow.com/comment/42274336
has comment: http://stackoverflow.com/comment/42274369
has comment: http://stackoverflow.com/comment/42284323
has comment: http://stackoverflow.com/comment/42297593
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/42298214
score: 4
has body: We need to look at what the Java Language Specification says is an acceptable value for an annotation method. It is a compile-time error if the element type is not commensurate with the element value. An element type T is commensurate with an element value V if and only if one of the following is true: If T is a primitive type or String, then V is a constant expression (§15.28). If T is an enum type (§8.9), then V is an enum constant (§8.9.1). PATH_METHOD is not an enum constant. RequestMethod.GET is an enum constant. For String, this public static final String PATH = "my/path"; is a constant variable, which is a constant expression and therefore can be used. It shouldn't work even if the constant was declared in the same file. Please review.
has comment: http://stackoverflow.com/comment/42299304
has comment: http://stackoverflow.com/comment/42274391
type: AcceptedAnswer

http://stackoverflow.com/comment/42451165
score: 0
type: Comment
type: QuestionComment
has text: Do you have spring-web*.jar in WEB-INF/lib?
comment on: http://stackoverflow.com/q/26955833

http://stackoverflow.com/q/26880126
answer count: 2
has title: hibernate many to one foreign key not working
has comment: http://stackoverflow.com/comment/42317398
has answer: http://stackoverflow.com/a/26885261
has comment: http://stackoverflow.com/comment/42317521
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42317539
has comment: http://stackoverflow.com/comment/42316782
type: Question
accepted answer: http://stackoverflow.com/a/26885261
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/26882982
has body: the follwing is my hibernate example for one to many relationship cart java class @Entity @Table(name="cart") public class Solocart { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="carts_id") int id; @Column(name="cust_name") String name; @OneToMany(mappedBy="cartitem") Set&lt;Soloitems&gt;soloitem; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Set&lt;Soloitems&gt; getSoloitem() { return soloitem; } public void setSoloitem(Set&lt;Soloitems&gt; soloitem) { this.soloitem = soloitem; } } next items java file @Entity @Table(name="cartitem") public class Soloitems { @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="cart_id") private int id; @Column(name="no_item") private int number; @ManyToOne @JoinColumn(name="carts_id") private Solocart cartitem; public int getId() { return id; } public void setId(int id) { this.id = id; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } public Solocart getCartitem() { return cartitem; } public void setCartitem(Solocart cartitem) { this.cartitem = cartitem; } impl code Session sn=Util.getSessionFactory().openSession(); sn.beginTransaction(); Solocart crt=new Solocart(); crt.setName("solomon"); Soloitems itm1=new Soloitems(); Soloitems itm2=new Soloitems(); itm1.setNumber(5); itm2.setNumber(8); Set&lt;Soloitems&gt;values= new HashSet&lt;Soloitems&gt;(); values.add(itm1); values.add(itm2); crt.setSoloitem(values); sn.save(crt); sn.save(itm2); sn.save(itm1); sn.getTransaction().commit(); sn.close(); System.out.println("sucessfully created"); here one cart should have many items while running both the tanles were updated but # cart_id, no_item, carts_id '1', ' 8', NULL '2', ' 5', NULL second table # carts_id, cust_name '1', ' solomon' as you see both the tables has been updated but the foreignkey herein this case carts_id d…
has answer: http://stackoverflow.com/a/26882982
score: 0

http://stackoverflow.com/q/26897092
has comment: http://stackoverflow.com/comment/42387463
answer count: 1
linked to: http://stackoverflow.com/q/6255106
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26920200
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42351722
has comment: http://stackoverflow.com/comment/42349659
has comment: http://stackoverflow.com/comment/42354803
tagged with: applet
has body: I made a simple game on a grid in java that involves controlling a white square with the WASD keys. Whenever I press W,S,A, or D, the screen sometimes flickers before drawing the grid again. I am fairly new to coding, so the more you can dumb it down for me, the better. import java.applet.*; import java.awt.*; import java.awt.event.*; /** * DotGame.applet * * A simple game where the player controls a white circle with the WASD keys. * - If the user moves his circle over a green circle, his score will go up by 1, and another red circle will spawn. * - If the user moves his circle over a red circle, his score will go down by 1, and one less red circle will be generated. * - There is no win condition, it is just a test game. * * @author ----------- * @version 11-9-2014 */ public class DotGame extends Applet implements KeyListener, MouseListener { int width,height; int powerup = 1; int click = 0; int x,y; final int size = 40; int ox = size,oy = size; int rx = 0, ry = 0; int reddots = 0; int red[][] = new int[1000][2]; String s = ""; int score = 0; int DrawGrid = 0; String sc = ""; int powerupdots = 1; int yellow[][] = new int[1][2]; int powerupcounter = 0; int shield = 0; int blue[][] = new int[1][2]; public void init() { this.setSize(740,500); width = 640; height = 480; setBackground( Color.black ); x = width/2; y = height/2; s = "CLICK TO START"; addMouseListener( this ); addKeyListener( this ); } public void keyPressed( KeyEvent e ) { } public void keyReleased ( KeyEvent e ) { } public void keyTyped( KeyEvent e ) { char c = e.getKeyChar(); String t = c+""; //This will change the coordinates of the user-controlled circle by the size of the circle based on what button is pressed if(powerupcounter &gt; 0) { powerup = 2; } else if(powerupcounter == 0) { powerup = 1; } if( t.equalsIgnoreCase("w" )&amp;&amp; oy &gt; 0+((powerup-1)*size)) { oy = oy-(size*powerup); } else if( t.equalsIgnoreCase("s") &amp;&amp; oy &lt; height-(size*powerup)) { oy = oy+(size*powerup); } else i…
has title: Java Applet Grid Game Flashing On Refresh/Keypress
type: Question

http://stackoverflow.com/comment/42462659
type: Comment
comment on: http://stackoverflow.com/a/26962097
has text: What you mean is that `num % num` will always give you zero. But even if it didn't, `isPrime !=0 || isPrime != 1` would be true, because no number can be simultaneously `==0` and `==1`.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/118272346
comment on: http://stackoverflow.com/q/26977876
type: Comment
has text: It's time this question received a little love ...
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42298823
type: Comment
comment on: http://stackoverflow.com/a/26863430
has text: no that's what i mean. the system.outs in the jsp show up in the output window in netbeans but the ones in the java classes do not for some reason. or at least which output window? i currently have Java DB database process, Glassfish server 4.1, HelloSpring (run). the jsps system.outs appear in the glassfish window.
score: 0
type: AnswerComment

http://stackoverflow.com/q/26989906
tagged with: spring
has answer: http://stackoverflow.com/a/26990162
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42511431
type: Question
has body: I am working on a Spring-MVC application. I would like to save images in database and display them in the JSP page of the application. Currently I am able to save images in database, but unable to display them in the front end. The image is not displayed, and when I click on view image, I get an Apache error : HTTP Status 404 - /product/%5BB@a2e6ab9 I generally use to think, this will be binary image, and the image displayed will show full binary data when clicked on view, but thats not the case. Now I will paste controller, entity and JSP code I am using for display. Controller : @RequestMapping(value = "/product/{id}/image") public byte[] retrieveimage(@ModelAttribute("product") ProductBasic productBasic,@PathVariable("id")Integer id){ User user = userService.getCurrentlyAuthenticatedUser(); ProductBasic productBasic1 = productBasicService.getProductById(id); BASE64Encoder base64Encoder = new BASE64Encoder(); byte[] data = org.apache.commons.codec.binary.Base64.decodeBase64(productBasic1.getProductimage()); return data; } @RequestMapping(value="/product/show",method= RequestMethod.GET) public String listProducts(@ModelAttribute("product") ProductBasic productBasic,Model model){ User user = userService.getCurrentlyAuthenticatedUser(); model.addAttribute("product", new ProductBasic()); model.addAttribute("listProducts",this.productBasicService.listProduct(user)); BASE64Encoder base64Encoder = new BASE64Encoder(); if(productBasic.getProductimage()==null){ System.out.println("getProductImage is null"); // This is always returning null when I check return "product"; }else { String image = "data:image/png;base64," + base64Encoder.encode(productBasic.getProductimage()); model.addAttribute("saveimage", image); return "product"; } } JSP : Product List <c:if test="${!empty listProducts}"> Product ID Product image Product name Product description Product condition Product age Product EAN Product ISBN Product ordernumber Product owners id Edit Delete <c:forEach items="${listP…
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42511587
score: 0
has answer: http://stackoverflow.com/a/26990041
answer count: 2
tagged with: jsp
has title: Unable to display image retrieved using Hibernate on a JSP file
has comment: http://stackoverflow.com/comment/42511618
has comment: http://stackoverflow.com/comment/42511803

http://stackoverflow.com/a/26955434
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42450780
answers question: http://stackoverflow.com/q/26955056
has body: The problem here is that your list is using all the space of the screen (Layout_height=match_parent, layout_width=match_parent) and the button has the attribute layout_below, then it is shown below the entire screen. To solve this, just remove the attribute layout_below: android:layout_below="@+id/list_tasks_final"

http://stackoverflow.com/comment/42384188
has text: so the graphDatabase bean would be created and injected by Spring? It looks like the @EnableNeo4jRepositories annotation will scan base package "hello" for repositories and auto generate the implementation. I am guessing that the way the annotation and scanning works in the Spring Java application doesn't exactly work out the same way with your grails application. If we can figure out how that bean is supposed to be created, then we could find a solution to this problem. If it's possible to put your code on github, I could take a look later today.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26897734
type: Comment

http://stackoverflow.com/q/26843079
tagged with: unit-testing
tagged with: testing
has title: How to test api using Mockito? Do we need to mock all the class variables?
has comment: http://stackoverflow.com/comment/42330652
tagged with: mockito
type: AnsweredQuestion
has body: I want to test an API which uses so many class variables, and also in the method there are so many others method calls, I don't know how to mock them all or do I need a different approach. Please help me fix this, I am providing the code below: public class LoginController implements Initializable { protected static BorderPane choose; protected static VBox menu; @FXML private BorderPane loginPane; @FXML private Label errorText; @FXML private PasswordField password; @FXML private Label databaseName; @FXML private Label host; @FXML private Button login; @FXML private TextField userId; BaseFrame mainController = BaseFrame.getMainController(); @Override public void initialize(URL arg0, ResourceBundle arg1) { assert login != null : "fx:id=\"login\" was not injected: check your FXML file 'Login.fxml'."; OSSDatabase ossDatabase = (OSSDatabase) OSSConfigurationTool.getContext().getBean("ossDatabase"); this.databaseName.setText(ossDatabase.getName()); this.host.setText(ossDatabase.getHost()); login.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { String username = userId.getText().trim(); String credentials = password.getText().trim(); if (isValid(username) &amp;&amp; isValid(credentials)) { errorText.setText(""); UserManager userManager = (UserManager) OSSConfigurationTool.getContext().getBean("UserManager"); try { userManager.login(username, credentials, true); FXMLLoader menuLoader = new FXMLLoader(LoginController.class.getResource("/com/capsilon/oss/configuration/tool/view/mainMenu.fxml")); try { mainController.getMenuPane().setVisible(true); mainController.getMenuPane().add((VBox) menuLoader.load(), 0, 1); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (OSSException e) { e.printStackTrace(); errorText.setText(e.getErrorCode().name()); errorText.setTooltip(new Tooltip(e.getMessage())); } } else { errorText.setText("Username or Password is empty"); } } }); } } While creating …
has comment: http://stackoverflow.com/comment/42282304
has answer: http://stackoverflow.com/a/26844301
type: Question
answer count: 1
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26844301

http://stackoverflow.com/comment/42275912
score: 0
has text: Thanks :), I'v added sample code :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26856917

http://stackoverflow.com/q/26950605
has comment: http://stackoverflow.com/comment/42442788
type: Question
has comment: http://stackoverflow.com/comment/42446927
score: -2
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26951078
favorite count: 0
has comment: http://stackoverflow.com/comment/42447005
type: UnansweredQuestion
has body: i have lot of qt that i want to transform to Json code this codes mostly like : ApplicationWindow { title: qsTr("Hello World") width: 640 height: 480 menuBar: MenuBar { Menu { title: qsTr("File") MenuItem { text: qsTr("&amp;Open") onTriggered: console.log("Open action triggered"); } MenuItem { text: qsTr("Exit") onTriggered: Qt.quit(); } } } Button { text: qsTr("Hello World") anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter }} this code is User interface code i want to transform it to Json code i try artistically coding way but i don't have a good result, there is a library in java or websites to do this?
has title: qt code to json transformation
tagged with: qt
has comment: http://stackoverflow.com/comment/42446943
has comment: http://stackoverflow.com/comment/42446909
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 2

http://stackoverflow.com/q/26839410
has comment: http://stackoverflow.com/comment/42247469
upvote count: 2
type: UnansweredQuestion
tagged with: spring
tagged with: spring-boot
has body: I'm a little bit confused on the usage of @Beforestep in an ItemReader in Spring Batch. When I use public class MyItemReader implements ItemReader&lt;String&gt; { long teller = 0L; @BeforeStep public void beforeStep(StepExecution se) { } @Override public String read() throws Exception, UnexpectedInputException, ParseException, NonTransientResourceException { if(teller == 11) return null; return String.valueOf(++teller); } } I do get an exception: Caused by: java.lang.IllegalArgumentException: The method [beforeStep] on target class [MyItemReader] is incompatible with the signature [(StepExecution)] expected for the annotation [BeforeStep]. This situation does not cause an exception: @BeforeStep public void beforeStep() { } However, the first situation is described in the documentation. What is expected? And how do I send the SendExecution object to the object when I cannot add it to the argument list? I'm using spring-boot-starter-batch-1.1.6.RELEASE
tagged with: java
has comment: http://stackoverflow.com/comment/42244094
has comment: http://stackoverflow.com/comment/42256619
type: Question
answer count: 1
downvote count: 0
has title: Beforestep annotation does not take an argument
has comment: http://stackoverflow.com/comment/42247724
has answer: http://stackoverflow.com/a/34612499
favorite count: 0
tagged with: spring-batch
score: 2

http://stackoverflow.com/comment/42236285
score: 0
has text: what is error you get?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26835190

http://stackoverflow.com/q/26845806
answer count: 1
has body: I have an action script function in a file which sends a pdf file as binary content to a servlet as shown below. private function savePDF(pdfBinary:ByteArray, urlString:String):void{ try{ Alert.show("in savePDF urlString" +urlString); //result comes back as binary, create a new URL request and pass it back to the server var header:URLRequestHeader = new URLRequestHeader("Content-type", "application/octet-stream"); var sendRequest:URLRequest = new URLRequest(urlString); sendRequest.requestHeaders.push(header); sendRequest.method = URLRequestMethod.POST; sendRequest.data = pdfBinary; Alert.show("in savePDF calling sendToURL"); sendToURL(sendRequest); }catch(error:*){ Alert.show("in savePDF err" +error); trace(error); } } This code works fine in flashplayers versions like 10,11,13 But fails in flashplayers of higher versions like 14.0.0.126 or above. I get the following error SecurityError: Error #3769: Security sandbox violation: Only simple headers can be used with navigateToUrl() or sendToUrl(). Any suggestions on how to resolve this ?
score: 0
tagged with: java
tagged with: flash
has comment: http://stackoverflow.com/comment/42268201
type: UnansweredQuestion
tagged with: actionscript
linked to: http://stackoverflow.com/q/5157089
has comment: http://stackoverflow.com/comment/42278251
type: Question
has title: How to send binary content to a servlet in Action Script
has comment: http://stackoverflow.com/comment/42281991
tagged with: actionscript-3
has answer: http://stackoverflow.com/a/26845927

http://stackoverflow.com/q/26931540
type: AnsweredQuestion
upvote count: 2
tagged with: material-design
type: Question
tagged with: java
tagged with: floating-action-button
has body: I am currently setting up a floating action button in my app i am making. My problem is that when i click the button, the listview behind the button also receives the click event. I need to make it so that the button consumes the entire click event. I am using this library to create the button: https://github.com/FaizMalkani/FloatingActionButton If someone could point me in the right direction regarding how to achieve this, it would be much appreciated. I have included the xml layout i am using below. Thanks Corey :) <android.support.v4.view.ViewPager android:id="@+id/viewPager" android:layout_width="match_parent" android:layout_height="0px" android:layout_weight="1"> </android.support.v4.view.ViewPager> <com.bacon.corey.audiotimeshift.FloatingActionButton android:id="@+id/fabbutton" android:layout_width="72dp" android:layout_height="72dp" android:layout_gravity="bottom|right" android:layout_marginBottom="16dp" android:layout_marginRight="16dp" app:colour="@color/holo_red_light" app:drawable="@drawable/ic_content_new" />
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26932199
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26932199
has title: How to make floating action button consume click event?
score: 2

http://stackoverflow.com/a/26878501
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26878484
answers question: http://stackoverflow.com/q/26878484
type: AcceptedAnswer
downvote count: 0
score: 1
has body: So, if your question is "can I use array lists instead of the arrays on codingbat?", the answer is yes. Just a couple of small points change. With arrays, you'd use array.length to get the size. For arraylists, it is arraylist.size() To access elements in an array, you use array[0]. For an arraylist, it is arrayList.get(0). Finally, it initialize an array, you use int[] array = new int[10];. For an arraylist, you'd use ArrayList&lt;Intenger&gt; name = new ArrayList&lt;Integer&gt;();. You typically won't assign it a size. To add elements to it, use name.add(5). Just make sure to add import java.util.ArrayList; at the top of your class so that you can actually access all of these methods. I hope that helps. Good luck :)
type: Answer

http://stackoverflow.com/q/26857282
has answer: http://stackoverflow.com/a/26877116
tagged with: java
type: Question
answer count: 1
has body: Using Registry key factor I am able to find the major, minor and rev version, but I need the build version from the Registry Editor. For instance, I'd like to get the "3" in the sequence "4.5.5.3". I am using the code below to get the major, minor and rev version. major = new Integer(rKey.getIntValue(VersionMajor)); minor = new Integer(rKey.getIntValue(VersionMinor)); rev = new Integer(rKey.getIntValue(VersionRev)); Please help me to find the Build(subversion) version in the same way as mentioned above.
tagged with: registrykey
has title: How to get major, minor, rev and build version from Windows Registy Editory using java code
score: 0
type: UnansweredQuestion
tagged with: registry

http://stackoverflow.com/q/26915518
has comment: http://stackoverflow.com/comment/42379896
has title: A runnable .jar file with libraries
tagged with: java
downvote count: 2
tagged with: libraries
tagged with: eclipse
has body: Want to warn you, that I have been tinkering around the site for some minutes and didn't find any suitable answers. So, my question is - What certainly, step by step, should I do from having the code done in Eclipse to make an executable program even on other PC's? I'm using Eclipse, JRE7. I have tried that before, but that executable .jar worked just on my PC. I heard about keeping the .jar with lib files, but have no more ideas about that. Your help would help a lot. You have my anticipated thanks. I have 4 class-files in my project located in the "src" folder.
type: Question
score: -2
tagged with: executable
has answer: http://stackoverflow.com/a/26915744
upvote count: 0
answer count: 1
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/42379925
has comment: http://stackoverflow.com/comment/42379869
accepted answer: http://stackoverflow.com/a/26915744
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42379970

http://stackoverflow.com/q/26833669
linked to: http://stackoverflow.com/q/18793606
tagged with: tomcat8
favorite count: 0
tagged with: maven
accepted answer: http://stackoverflow.com/a/26833941
type: AnsweredQuestion
tagged with: eclipse-luna
score: 1
tagged with: java
has body: I'm trying to use Tomcat 8 as the server for a new web application. I'm going to use a lot of the java EE 7 web profile technologies, among them, the EJB Lite specification. The web app project consists, in fact, of several other maven projects. I have a rest-api project (which uses JAX-RS 2.0), a business project (currently packaged as a jar) and domain project (also a jar). I have some set of common dependencies, which i packaged in a separate module "common-deps" (pom package). Among theses dependencies, is the java ee 7 web profile specification. All the other projects depend on the "common-deps" project. Next is the pom.xml for the common-deps project: 4.0.0 .... commons-deps 0.0.1-SNAPSHOT pom Common dependencies <cdi.version>1.1</cdi.version> <sl4j.version>1.7.7</sl4j.version> <log4j.version>1.2.17</log4j.version> <junit.version>4.11</junit.version> javax javaee-web-api 7.0 provided org.slf4j slf4j-api ${sl4j.version} org.slf4j slf4j-log4j12 ${sl4j.version} log4j log4j ${log4j.version} junit junit ${junit.version} test The thing is that when i try to create a stateless session bean with the @Stateless annotation, this annotation is not found. I don't know why is this, perhaps the javaee-web-api scope shouldn't be provided? But, as far as i understand, tomcat 8 should support this profile... perhaps it is because i'm missing a concrete implementation of some of the java ee apis? If this is indeed the case, should i specify the implementation for every api inside the java ee web profile? And, what implementation should i choose for the ejb lite api? I searched everywhere but i could not find any tutorial about developing a java ee 7 web app with tomcat 8, and as i'm new to the java ee stack (coming from Spring) i must be doing something wrong. I'm using Eclipse Luna as IDE. Excuse my poor english!
upvote count: 1
tagged with: java-ee-7
type: Question
has title: Tomcat 8 + Maven + Java EE 7 Web Profile
has answer: http://stackoverflow.com/a/26833941
has comment: http://stackoverflow.com/comment/42233833
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/42310289
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26876303
has text: @KhaledKabalan If `makeDeposit` is required to return nothing, what do you expect is the value of `hi` after that method call?
score: 0

http://stackoverflow.com/comment/42303714
type: QuestionComment
type: Comment
has text: @nu11p01n73R I edited the post with some matching and not matching examples. thank you for the input.
score: 0
comment on: http://stackoverflow.com/q/26872490

http://stackoverflow.com/comment/80146388
comment on: http://stackoverflow.com/a/31891805
type: AnswerComment
score: 5
type: Comment
has text: For more recent versions of IntelliJ (e.g. 2017) you have to enable the Spring Data plugin and then you don't need any of the above workarounds. There's another answer below that tells you how to do that.

http://stackoverflow.com/comment/42279889
type: Comment
type: QuestionComment
has text: Maybe problem with it - Reflection not support anonymous inner classes.
comment on: http://stackoverflow.com/q/26846078
score: 0

http://stackoverflow.com/comment/42376705
score: 0
type: AnswerComment
type: Comment
has text: @RedBaron Use a SpEL expression for the value.
comment on: http://stackoverflow.com/a/26913249

http://stackoverflow.com/q/26926193
tagged with: spring
tagged with: jakarta-ee
tagged with: spring-mvc
tagged with: model-view-controller
type: AnsweredQuestion
has title: Issue with Spring Framework static resource set up
tagged with: java
has answer: http://stackoverflow.com/a/26926569
has answer: http://stackoverflow.com/a/26926775
type: Question
has body: I have configured my spring project to cater to static resources using below settings in XML file: &lt;annotation-driven /&gt; &lt;resources mapping="/resources/**" location="/resources/" /&gt; But when I try to access the static content directly, say using below URL: http://localhost:8080/main/resources/css/app.css Instead of showing up the static CSS content in the browser, the request is going to the following method in Controller: @RequestMapping(value = "/{countryID}/{stateId}/{cityId}", method = RequestMethod.GET) public String city(@PathVariable("countryID") String countryID, @PathVariable("stateId") String stateId, @PathVariable("cityId") String cityId, Locale locale, Model model) { System.out.println("input "+stateId); System.out.println("input "+countryID); System.out.println("input "+cityId); model.addAttribute("serverTime", ""); return "home"; } Once the request leads to this method instead of showing up the staic CSS file, I see the JSP page returned by return call "home". I have checked and rechecked but dont really sight any issue with set up. Please have a look and let me what might be going wrong here. Below is the Main Controller that my application is using. import java.util.Locale; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/") public class MainController { @RequestMapping(value = "/", method = RequestMethod.GET) public String country(Locale locale, Model model) { System.out.println("nothing but home page"); return "home"; } @RequestMapping(value = "/{countryID}", method = RequestMethod.GET) public String country(@PathVariable("countryID") String countryID, Locale locale, Model model) { System.out.println("input country "+countryID); return "home"; } @RequestMapping(value = "/{countryID}/{sta…
has comment: http://stackoverflow.com/comment/42398980
has comment: http://stackoverflow.com/comment/42399110
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26926381
accepted answer: http://stackoverflow.com/a/26926569
possible better answer: http://stackoverflow.com/a/26926381

http://stackoverflow.com/comment/42474650
score: 1
has text: possible duplicate of [select maven profile based on git branch](http://stackoverflow.com/questions/12220517/select-maven-profile-based-on-git-branch)
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26967175

http://stackoverflow.com/comment/42488135
type: Comment
comment on: http://stackoverflow.com/q/26976698
score: 0
has text: The bottom line is that the source code you've provided doesn't harmonize with question you're asking. I don't think you understand the problem you are trying to solve
type: QuestionComment

http://stackoverflow.com/comment/42496726
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26980703
has text: read the doc for `openFileOutput`. In particular, the possible values of the parameters.

http://stackoverflow.com/comment/42332375
comment on: http://stackoverflow.com/a/26887814
type: AnswerComment
has text: You don't have to create a new flavor. In Android Gradle, the concept of flavor is tied to the concept of Variant. A Variant is BuildType + Flavor. For example, if you have a buildType Debug and a Flavor flavor1, the full variant is flavor1Debug. With my solution, you are using a custom buildType to have more Variants on the same Flavors. You just have to define a new BuildType and all your already defined Flavors will have a new Variant.
type: Comment
score: 1

java.util.scanner
tags question: http://stackoverflow.com/q/26976698
tags question: http://stackoverflow.com/q/26948563
tags question: http://stackoverflow.com/q/26921126
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/26874831
tags question: http://stackoverflow.com/q/26935458
tags question: http://stackoverflow.com/q/26906752
tags question: http://stackoverflow.com/q/26918854
type: Tag
tags question: http://stackoverflow.com/q/26941651
tags question: http://stackoverflow.com/q/26970827
tags question: http://stackoverflow.com/q/26878111
tags question: http://stackoverflow.com/q/26947833
tags question: http://stackoverflow.com/q/26946592
tags question: http://stackoverflow.com/q/26835282
tags question: http://stackoverflow.com/q/26900449
tags question: http://stackoverflow.com/q/26952698
tags question: http://stackoverflow.com/q/26947814

http://stackoverflow.com/comment/42294963
comment on: http://stackoverflow.com/q/26867276
score: 0
has text: your canny thresholds are much too low. Try to display your intermediate images, you'll see something very "noisy" ;)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42367532
type: QuestionComment
comment on: http://stackoverflow.com/q/26908726
has text: You could create a `Validation` interface and create several implementations, iterate over them in your `onUserChange` method. This would allow to split things (maybe reuse some validations?) and probably be more testable.
score: 0
type: Comment

http://stackoverflow.com/comment/42513384
has text: Ok, 1) i understand, but how would you do 2). Can you please provide an example?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26916644
type: Comment

http://stackoverflow.com/q/26841573
type: Question
has answer: http://stackoverflow.com/a/26841614
score: 0
has answer: http://stackoverflow.com/a/26841649
answer count: 2
tagged with: string
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Android xml increasing variable
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42278076
tagged with: java
upvote count: 1
downvote count: 1
has body: Say I have these lines in strings.xml: Video Photo Text And these lines in my menu.xml file: <item android:id="@+id/video" android:icon="@drawable/ic_game_50" android:title="@string/video" /> <item android:id="@+id/photo" android:icon="@drawable/ic_help_50" android:title="@string/photo" /> <item android:id="@+id/text" android:icon="@drawable/ic_help_50" android:title="@string/text" /> I'd like to change this, so that instead of a constant strings of "Video", "Photo", "Text", it would be "Video[i]", etc.. when i is the step number and increases itself according to the times I'm running some intent. Is it possible?

http://stackoverflow.com/q/26991070
accepted answer: http://stackoverflow.com/a/26991684
answer count: 1
has comment: http://stackoverflow.com/comment/42514236
has comment: http://stackoverflow.com/comment/42515578
has comment: http://stackoverflow.com/comment/42515490
has answer: http://stackoverflow.com/a/26991684
has comment: http://stackoverflow.com/comment/42513629
has comment: http://stackoverflow.com/comment/42514109
type: AnsweredQuestion
tagged with: reflection
tagged with: java
has comment: http://stackoverflow.com/comment/42513760
has comment: http://stackoverflow.com/comment/42514309
has comment: http://stackoverflow.com/comment/42514149
has comment: http://stackoverflow.com/comment/42513548
type: Question
has title: Loading class using a Class instance
has body: Is there any simple way, to load a class given a class instance? I know that I can load a class by calling Class.forName(nameOfClass); where the nameOfClass is the name of the class which I want to be loaded. I also know that by instantiating a class this way clazz.newInstance(); where clazz is an instance of Class, the class loads if it was not loaded before, but I don't want to instantiate if it's not necessary. My question is that, is there any simple way to load a class given a Class instance? I could solve the problem this way: try { Class.forName(clazz.getName()); } catch (ClassNotFoundException ex) { assert false : "No way!"; } but I think this is overcomplicated.
score: 0

stack-overflow
tags question: http://stackoverflow.com/q/26910992
tag name: stack-overflow
type: Tag
tags question: http://stackoverflow.com/q/26954119

http://stackoverflow.com/comment/42463617
score: 1
has text: GP does have a runtime API and component as well. This API can for instance be used to personalize the applet. So although you can certainly upload and install a pure Java Card applet, larger applets that require centralized personalization often include GP functionality.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26952054

http://stackoverflow.com/a/26953189
type: AcceptedAnswer
has body: The Map interface has no concept of "order", but you could sort the entries: Map&lt;String, Integer&gt; map; // populated List&lt;Map.Entry&lt;String, Integer&gt;&gt; entries = new ArrayList&lt;&gt; (map.entrySet()); Collections.sort(entries, new Comparator&lt;Map.Entry&lt;String, Integer&gt;&gt;() { public int compareTo(Map.Entry&lt;String, Integer&gt; a, Map.Entry&lt;String, Integer&gt; b) { return a.getValue().equals(b.getValue()) ? a.getKey().compareTo(b.getKey()) : Integer.compareTo(b.getValue(), a.getValue()); } }); for (Map.Entry&lt;String, Integer&gt; entry : entries) System.out.println(entry.getKey() + " - " + entry.getValue()); If java 8 is available, it becomes a lot neater: Map&lt;String, Integer&gt; map; // populated map.entrySet().stream() .sorted( (a, b) -&gt; a.getValue().equals(b.getValue()) ? a.getKey().compareTo(b.getKey()) : Integer.compareTo(b.getValue(), a.getValue())) .map(e -&gt; entry.getKey() + " - " + entry.getValue()) .forEach(System.out::println); If absolutely need a map, load them into aLinkedHashMap, which "preserves order" in that it iterates over its entries in the same order they were inserted.
has comment: http://stackoverflow.com/comment/42500765
type: Answer
has comment: http://stackoverflow.com/comment/42447018
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26952639
answers question: http://stackoverflow.com/q/26952639
score: 3
has comment: http://stackoverflow.com/comment/52406418
upvote count: 3
has comment: http://stackoverflow.com/comment/42501605

http://stackoverflow.com/q/26972192
possible better answer: http://stackoverflow.com/a/27016459
tagged with: java-8
has answer: http://stackoverflow.com/a/27016459
type: AnsweredQuestion
has title: javac crashes when compiling codes with java 1.8 features: Flow$AbstractAssignAnalyzer.visitIdent(Flow.java:2380)
accepted answer: http://stackoverflow.com/a/28629953
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42504159
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42480041
has comment: http://stackoverflow.com/comment/42482046
has body: Recently I upgraded my java codes to 1.8 and applied many 1.8 features (lambda, stream, etc). They can be run properly under Eclipse but failed to be built by maven because javac always threw the following exception: [INFO] Compiling 38 source files to /root/chess-wizard-base/target/classes An exception has occurred in the compiler (1.8.0_25). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you. java.lang.NullPointerException at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitIdent(Flow.java:2380) at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1376) at com.sun.tools.javac.tree.TreeScanner.visitReference(TreeScanner.java:268) at com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:1973) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1376) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExpr(Flow.java:1627) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExprs(Flow.java:1639) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitNewClass(Flow.java:2241) at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1516) at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49) at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:398) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1376) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.analyzeTree(Flow.java:2423) at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.analyzeTree(Flow…
has comment: http://stackoverflow.com/comment/42481947
answer count: 2
has comment: http://stackoverflow.com/comment/42552093
has answer: http://stackoverflow.com/a/28629953
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42511926
has comment: http://stackoverflow.com/comment/42555275
has comment: http://stackoverflow.com/comment/42481230
tagged with: javac

http://stackoverflow.com/comment/42260517
type: Comment
has text: What about mysqlconnector version compatibility with jdk you are using!!
comment on: http://stackoverflow.com/a/26848670
score: 0
type: AnswerComment

http://stackoverflow.com/q/26970581
has answer: http://stackoverflow.com/a/26992320
has body: Pls support me I can not find any solution for my problem now. I have 2 projects which use spring-web-flow, they use the same data base, after export them I have 2 war files to deploy. I use server Geronimo 3.0 to deploy them. When I deploy one by one war file, it's run well. But I have request from my customer is : I need to merge them to become 1 war file. And after deploy, they can working with 2 projects like deploy one by one. I can not use Maven because my environment is not support to do it. Best thank for your support. DT
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42477879
tagged with: spring
type: Question
tagged with: java
answer count: 1
has title: Spring web flow : merge 2 war files
score: 0
tagged with: web-deployment

http://stackoverflow.com/comment/42442783
score: 0
type: Comment
type: QuestionComment
has text: You want to produce a random value between 1 and 1024 bits in length? Why not `BigInteger.probablePrime(512, r)`?
comment on: http://stackoverflow.com/q/26950813

http://stackoverflow.com/q/26881826
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42319837
has comment: http://stackoverflow.com/comment/42320488
type: Question
has comment: http://stackoverflow.com/comment/42322341
has comment: http://stackoverflow.com/comment/42320799
score: 0
has body: I just finished an assignment for class and uploaded it to a website desgined to give the program the argument when uploaded and run. Since the site just shows your output and the coding goes "behind the scenes" just for the professor to read I cant see it actually running. I was wondering how I woud input an Args.txt file into netbeans so that I may know how to do it and test projects on my own in the future. Here is the output code for my file : public static void main(String[] args){ In in = new In(args[0]); Graph G = new Graph(in); GraphProperties gp = new GraphProperties(G); System.out.println("diameter: " + gp.diameter()); System.out.println("radius: " + gp.radius()); System.out.println("center: " + gp.center()); } I tried putting it into properties but didn't get anywhere. Thanks in advance!
has comment: http://stackoverflow.com/comment/42322053
tagged with: args
type: UnansweredQuestion
has title: How to read a .txt as an argument for netbeans
tagged with: text
tagged with: netbeans

http://stackoverflow.com/comment/42510600
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26976473
has text: Yes, this solution properly cancels the timer, had something similar in my mind as well. However, when applied to my code, what is executed in what corresponds to `doNothing()` is not rolled back. This could be because of my more complex scenario with chained EJB calls. I agree that this should work.
score: 0

http://stackoverflow.com/q/26934202
tagged with: java
has comment: http://stackoverflow.com/comment/42413507
type: Question
tagged with: phaselistener
has comment: http://stackoverflow.com/comment/42413426
has body: I would like to generate a dynamic XML file, after performing a button action method, in JSF 2 and Primefaces. If I enable ajax on that button, the output stream is not downloaded to the client If I desable ajax, the output stream is downloaded sucessfully, but validation doesn't perform as expected The action method looks like this: public void someAction() { FacesContext context = FacesContext.getCurrentInstance(); ExternalContext ec = context.getExternalContext(); try { Object someResult = manager.doSomeBusinessLogic(); String contentType = "application/some-type;charset=utf-8"; ec.responseReset(); ec.setResponseContentType(contentType); ec.setResponseHeader("Content-Disposition", "attachment; filename=\"test.x\""); OutputStream outputStream = ec.getResponseOutputStream(); writeDataToStream(outputStream, someResult); } catch (... ex) { log.error("error", ex); } finally { context.responseComplete(); } } Is there any way to do this having Ajax enabled and having the file downloaded at the end of the request? Note: I have also tried to use a PhaseListener to intercept the execution, but I don't know how to pass parameters to the request so that the afterPhase is able to process parameters accordingly - and I'd rather not do some redirect in order to enter the PhaseListener. Any ideas? Edit: I'm using Omnifaces 1.6.3 and Primefaces 5.1. Here is the xhtml: &lt;o:form&gt; &lt;h:inputText id="field" value="#{bean.someField}" /&gt; &lt;p:commandButton value="Ajax submit button" action="#{bean.someAction}" /&gt; &lt;f:phaseListener type="com.company.package.SomePhaseListener"/&gt; &lt;/o:form&gt; Here is my give-it-a-go at the phase listener implementation; the only limitation is adding the someParam parameter to the HttpServletRequest on the action method. public class SomePhaseListener implements PhaseListener { @Override public PhaseId getPhaseId() { return PhaseId.RENDER_RESPONSE; } @Override public void beforePhase(PhaseEvent event) { ... } @Override public void afte…
downvote count: 0
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/42413937
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: file
linked to: http://stackoverflow.com/q/25687625
has comment: http://stackoverflow.com/comment/42413774
has title: How to stream generated file download after ajax submit on JSF 2?
score: 3
tagged with: jsf

http://stackoverflow.com/comment/42290238
type: Comment
has text: not sure how to implement the iterator? Haven't done it yet in classes
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26864292

http://stackoverflow.com/q/26853803
score: 1
tagged with: java
tagged with: quartz-scheduler
has title: Using custom code to repopulate cache instead of Spring + Quartz integration
type: Question
accepted answer: http://stackoverflow.com/a/26862603
has body: Reading about the configuration of implementing a scheduled refresh of a ehcache it seems that implementing a Quartz scheduler is required. I may be over simplifying but is below code not achieving same result : import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; import org.springframework.beans.factory.annotation.Autowired; public class MyCacheScheduler { public void repopulateCache(){ ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5); @SuppressWarnings({ "rawtypes", "unchecked" }) ScheduledFuture scheduledFuture = scheduledExecutorService.schedule(new Callable() { public Object call() throws Exception { myCache.clearCache(); myCache.populateCache(); return ""; } }, 30, TimeUnit.SECONDS); try { System.out.println("result = " + scheduledFuture.get()); } catch (Exception e) { e.printStackTrace(); } } @Autowired private MyCacheManagerImpl myCache; } I'm just attempting to refresh the cache every X minutes. So when the cache TTL is exceeded multiple users are not all populating cache at same time. There is a risk this could still occur - if user accesses cache at exact time the TTL is exceeded and scheduled job has not re-populated cache. Configuring Quartz and integrating with Spring appears to be more work that using a Java ScheduledExecutorService but there could be potential issues using above code that I'm not aware of ?
tagged with: caching
has answer: http://stackoverflow.com/a/26862603
upvote count: 1
answer count: 1
tagged with: scheduled-tasks
favorite count: 0
tagged with: spring
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/42441856
score: 0
comment on: http://stackoverflow.com/a/26950112
has text: At that point, consider allowing the end user to provide the path themselves in the running of the program. Hard coding the path is usually a last-ditch effort.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42588860
type: AnswerComment
score: 0
type: Comment
has text: Anybody has more comments? Please help!
comment on: http://stackoverflow.com/a/26968897

http://stackoverflow.com/comment/42266250
score: 4
comment on: http://stackoverflow.com/q/26851973
type: Comment
has text: Are you sure you should be doing `addPositSuccess = true` within an `if`? What does `=` do?
type: QuestionComment

http://stackoverflow.com/a/26870933
has comment: http://stackoverflow.com/comment/42300483
has comment: http://stackoverflow.com/comment/42300590
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/42300532
downvote count: 0
has comment: http://stackoverflow.com/comment/42300397
has body: You json String contains a &lt;br /&gt; tag so it can't be parsed. Try you url in a browser and check that the result is pure json.
score: 3
answers question: http://stackoverflow.com/q/26870860
has comment: http://stackoverflow.com/comment/42300640

http://stackoverflow.com/comment/42269349
type: AnswerComment
type: Comment
has text: The first problem with that is that I am using an H2 database, and I'm not sure how to connect an H2 database to iReport. I can't find it in the list. The second problem is that if, in the future, I want to order the reports by a specific column, I don't know if I would be able to do that. The link that you sent me to won't get me anywhere, mostly due to the first problem.
score: 0
comment on: http://stackoverflow.com/a/26851050

http://stackoverflow.com/comment/42253231
comment on: http://stackoverflow.com/q/26834433
type: QuestionComment
type: Comment
has text: Actually, SpriteBatch is used also to draw scene2d stuff, but I think what you're asking is if you can draw with and without scene2d in the same screen, right? You can draw your "regular" stuff, along with `spriteBatch.end`, and then call `stage.draw` to have your scene2d drawn right over everything else. Your second question can surely be done, although I haven't made custom scene2d.ui widgets before, which is what you'll need to do to wrap your special type of text class.
score: 0

http://stackoverflow.com/a/26841602
accepted answer of: http://stackoverflow.com/q/26841380
answers question: http://stackoverflow.com/q/26841380
score: 1
type: AcceptedAnswer
downvote count: 0
has body: The easiest method is to use Android GCM for server to client communication, and a RESTful API for client to server communication. You can even try Parse library, that comes with their own SDK and solves most of the configuration.
type: Answer
upvote count: 1

http://stackoverflow.com/a/26850139
has comment: http://stackoverflow.com/comment/42323696
score: 15
has comment: http://stackoverflow.com/comment/42263192
has comment: http://stackoverflow.com/comment/42263013
type: Answer
has comment: http://stackoverflow.com/comment/42311686
has comment: http://stackoverflow.com/comment/42263725
accepted answer of: http://stackoverflow.com/q/26850095
has comment: http://stackoverflow.com/comment/42262973
has comment: http://stackoverflow.com/comment/42263530
answers question: http://stackoverflow.com/q/26850095
upvote count: 15
type: AcceptedAnswer
downvote count: 0
has body: The problem is that you have provided a wrong equals: it should be equals(Object), not equals(Car). Essentially, you have provided an overload instead of an override, so HashMap keeps calling the equals from the base class. Fixing this problem is simple: add an override that does the cast, and calls the equals method that you wrote, like this: @Override public boolean equals(Object other) { return (other instanceof Car) &amp;&amp; equals((Car)other); } Note the use of @Override annotation. It helps Java help you spot issues like this automatically. Note: with this problem out of the way, consider implementing your hashCode method in a more "frugal" way. Rather than creating a throw-away (this.getCarName() + this.getCarModel()) string simply for the purpose of obtaining its hash code, consider rewriting the method as follows: public int hashCode() { return 31*getCarName().hashCode() + getCarModel().hashCode(); } or in Java 1.7+ you could write public int hashCode() { // Thanks, fge, for a nice improvement! return Objects.hash(carName, carModel); }

http://stackoverflow.com/q/26903799
duplicate of: http://stackoverflow.com/q/5951464
has title: How is the final variable System.out changing its reference?
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26903925
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26903962
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26903962
has body: import java.io.*; class SetOutExample { public static void main(String...s)throws IOException { FileOutputStream fout=new FileOutputStream("abc123.txt"); PrintStream ps=new PrintStream(fout); System.out.println("hello"); System.setOut(ps); System.out.println("hi"); } } Here the output of hi is printed on a file abc123.txt. How does the PrintStream-type variable out which is final and has the reference to print on screen get modified and start pointing to file abc123.txt? How does setOut work.
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/5951464
favorite count: 0
has answer: http://stackoverflow.com/a/26903925

http://stackoverflow.com/comment/42435107
has text: Please show a couple of lines of your csv file.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26946212
type: Comment

http://stackoverflow.com/a/26983777
score: 5
type: AcceptedAnswer
has body: Use the bitwise OR operator: value |= 0xFFFF 11111111111111112 = 216 - 1= FFFF16
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/26983718
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26983718

http://stackoverflow.com/q/26853879
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42270736
type: Question
has comment: http://stackoverflow.com/comment/42271010
has comment: http://stackoverflow.com/comment/42271059
tagged with: performance
tagged with: android-canvas
has title: Faster way of displaying offscreen bitmap using android/java
downvote count: 0
has body: I have started to learn android and java using the android studio beta. As a first simple test app I am trying to get a basic Mandelbrot renderer working. I have gotten it to display, but now I want it faster. Can anyone give advice on the following? The docs say canvas.drawbitmap is depreciated. What should I use instead? What is the fastest ways to show a bitmap onscreen? How can I show the progress of the calculations? If I unremark the 2 lines marked "update display after each line has been calculated" there is no updating during the calculations and the extra calls to canvas.drawbitmap really slow it all down (79 seconds compared to 31 seconds without it). Is there anything I can do to speed up the general math calls? I have tried to keep it as simple as possible for this example. Many thanks for any tips for a newbie. I don't want to learn bad habits from the start if possible. The layout has a single imageview aligned to the screen. The full code is import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Point; import android.os.Bundle; import android.os.SystemClock; import android.view.Display; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import java.text.DecimalFormat; import java.util.Random; import static android.graphics.Color.argb; import static android.graphics.Color.rgb; public class myActivity extends Activity { myView myview; Bitmap bmp; Canvas myCanvas; ImageView img; Paint paint; Boolean started=false; Integer ih,iw,i,redraws,fw,fh; long startms,finishms; Random rnd; double xmin,xmax,ymin,ymax,padding,bailout,bailout_squared,stepx,stepy,x,y,magnitude; double realiters,tweenval; Integer col,colval1,colval2; Integer iterations,maxiterations,superx,supery,samplepixels,square_samplepixels,xloop,yloop; double zr,zi,cr,ci,xlo…
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: drawbitmap
tagged with: bitmap
score: 2

http://stackoverflow.com/q/26866001
accepted answer: http://stackoverflow.com/a/26866056
answer count: 1
has comment: http://stackoverflow.com/comment/42291297
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/42291270
type: AnsweredQuestion
tagged with: naming-conventions
tagged with: java
downvote count: 3
has title: What to do when I have to use 'isSomething' as name of a Boolean variable?
type: Question
tagged with: boolean
upvote count: 0
has body: The question itself is I have to use 'is' as a name of a Boolean variable for reasons, and I don't know if it's better to find a way to change it's name, or that's not that big problem to use 'isSomething' for the variable and 'isSomething()' for the getter?
tagged with: getter
has answer: http://stackoverflow.com/a/26866056

http://stackoverflow.com/q/26972988
has title: Spring servlet mapping is not working after successful login
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42482021
has comment: http://stackoverflow.com/comment/42482558
has comment: http://stackoverflow.com/comment/42481783
has comment: http://stackoverflow.com/comment/42482514
linked to: http://stackoverflow.com/q/26325524
tagged with: servlets
score: 0
has answer: http://stackoverflow.com/a/26973687
answer count: 1
tagged with: spring-security
has comment: http://stackoverflow.com/comment/42482151
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42482084
tagged with: spring
has body: I have controller which handles request to / and returns corresponding jsp. After switching to annotation based configuration and adding Spring security I got HTTP 404 when log in is successful. It seems to me like all config is in place. What's wrong? AppConfig @EnableWebMvc @Configuration @ComponentScan({"app.controller.*"}) @Import({SecurityConfig.class}) @PreAuthorize("hasRole('ROLE_ADMIN')") public class AppConfig { @Bean public InternalResourceViewResolver viewResolver(){ InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); viewResolver.setViewClass(JstlView.class); viewResolver.setPrefix("/WEB-INF/pages"); viewResolver.setSuffix(".jsp"); return viewResolver; } public void addResourceHandlers(ResourceHandlerRegistry registry){ registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/"); } SecurityConfig @Configuration @EnableWebMvcSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception{ auth.inMemoryAuthentication().withUser("admin").password("admin").roles("ADMIN"); } @Override protected void configure(HttpSecurity http) throws Exception{ http.authorizeRequests() .antMatchers("/**").access("hasRole('ROLE_ADMIN')") .and().formLogin(); } } SpringMvcInitializer public class SpringMvcInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class[]{AppConfig.class}; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return null; } @Override protected String[] getServletMappings() { return new String[]{"/"}; } } Controller @Controller @RequestMapping("/") public class AppController { @RequestMapping(value = "/", method= RequestMethod.GET) public String getRequestPage(Model model){ .....} } UPDATE changing in SpringMvcInitializer to following code didn't help: @Override protected String[] getSer…
tagged with: spring-mvc

http://stackoverflow.com/comment/42444485
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/65016/discussion-between-qed-and-jon-skeet).
comment on: http://stackoverflow.com/a/26951112
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42432990
comment on: http://stackoverflow.com/q/26945192
has text: You dont need to call intValue method. You could define a method on your customised value (All wrapper's Integer/Double etc are immutable in java) and can say m.get(key).increment();
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26909772
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42370519
has answer: http://stackoverflow.com/a/26910717
has comment: http://stackoverflow.com/comment/42369561
tagged with: vlcj
score: 3
answer count: 1
downvote count: 0
favorite count: 0
tagged with: media-player
type: UnansweredQuestion
has body: I'm playing a video file (full screen) and I want an audio file to play once the video has finished playing. The thing is: I'm able to play a video file in full screen; I'm able to detect when the video file has finished playing: while(!mpu.getMediaPlayer().getMediaPlayerState().toString().equalsIgnoreCase("libvlc_Ended")) { System.out.println("It's being played"); estado = mpu.getMediaPlayer().getMediaPlayerState(); } But those lines make my video leave it's full screen.... I need the video file to keep at full screen.
has title: vlcj MediaPlayer: how to detect when video has finished playing
tagged with: video
tagged with: libvlc
has comment: http://stackoverflow.com/comment/42369494
upvote count: 3

http://stackoverflow.com/q/26952959
favorite count: 0
tagged with: time
accepted answer: http://stackoverflow.com/a/26952974
has title: Java Files.getLastModifiedTime Returning Unexpected Result
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I'm writing a program that goes through files in a directory and checking each file's last modified date and comparing it with another variable. If the variable matches then I copy said file. I thought this was going to work like a charm but the last modified date being returned seems to be incorrect or there is a weird time zone thing happening. I'm in the middle of a loop and the file currently being looked at is from 2014-08-18 and was actually last modified at 11:58 PM on that date but the getLastModifiedTime returns 2014-08-19T03:58:37.685611Z. So what gives???? Is this some kind of wacky time off set that I need to handle? This is important because if the last modified date is not accurate I won't know which file to copy....Anyone immediately know what's wrong? This is my first time using this way of iterating through files so I may be missing something. //Creating a DirectoryStream inside a try-with-resource block try (DirectoryStream&lt;Path&gt; ds = Files.newDirectoryStream(FileSystems.getDefault().getPath(dir.getAbsolutePath()))) {for (Path p : ds) { String lastMod = Files.getLastModifiedTime(p).toString(); String[] splitDte = lastMod.split("T"); if(dateSrc.equals(splitDte[0].toString())) { File fileToCopy = p.toFile(); copyFile(fileToCopy, tempWorkingDir + "\\" + addLeadingZero(logM, 2) + "" + addLeadingZero(logDy, 2) + "\\" + fixedValue + "\\" + logType + "\\" ); fileCountProcsd++; } } } catch (IOException e) { e.printStackTrace(); }
has comment: http://stackoverflow.com/comment/42454638
tagged with: date
has answer: http://stackoverflow.com/a/26952974
has comment: http://stackoverflow.com/comment/42453748
answer count: 1
downvote count: 0

http://stackoverflow.com/a/26931062
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26926874
has body: It is an interesting question, but IMHO the answer depends on : the size of the uploaded files the number of concurrent sessions the capacity of the server The only thing that seems clear to me is that data should not go into definitive tables in database before validation, unless there is a special field in it saying it is still not validated and should not be used. But anyway, it would add unnecessary complexity. That being said, you have to persist some session related data across different requests for a short period of time. So depending of the parameters cited at the beginning or the post, you can use : a cookie if data is small (about 1 kbyte since cookie max capacity is 4 kbytes) object(s) in session if data is small regarding the available memory and few concurrent sessions form data in eventually hidden fields is data structure is simple - it is an option to considere if you display all (or almost all) of data to user for validation with possibility to modify some fields a file in a folder on server , with only the name of file in session. It is a nice solution, but you have to implement cleaning in a session listener if the session is closed without the user has validated its data, and a catch all cleaning at server restart in case of abnormal stop of the application.
answers question: http://stackoverflow.com/q/26926874
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43329668
type: QuestionComment
comment on: http://stackoverflow.com/q/26958073
has text: Yes, it's called the Classes-with-interfaces-and-common-ancestor pattern ;-)
score: 0
type: Comment

http://stackoverflow.com/q/26923348
has title: GridBagLayout elements behaviour when resizing window
tagged with: gridbaglayout
answer count: 2
has body: I'm new to Java Swing and was trying to make a simple layout (I thought), but I have a lot of problems reaching the behavior I want. Here's my code : setSize(800, 600); setLocationRelativeTo(null); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); equipementPanel.setPreferredSize(new Dimension(275, 300)); grillePanel.setPreferredSize(new Dimension(300, 600)); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.anchor = GridBagConstraints.NORTHWEST; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; this.add(equipementPanel, c); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.SOUTHWEST; c.gridwidth = 1; c.gridheight = 2; c.weightx = 0.0; c.weighty = 0.0; this.add(informationPanel, c); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 1; c.gridy = 0; c.anchor = GridBagConstraints.NORTHEAST; c.weightx = 1.0; c.weighty = 1.0; this.add(grillePanel, c); c.fill = GridBagConstraints.BOTH; c.gridx = 1; c.gridy = 1; c.anchor = GridBagConstraints.SOUTHEAST; c.weightx = 1.0; c.weighty = 0.0; this.add(commandePanel, c); this.validate(); Screen of my laptop is a good result of what I want. equipementPanel = green grillePanel = gray But on my bigger screen...it is the gray one that should stretch. Red it's okay. And a total disaster when I size it down . What I want it to do is The Gray should not have fixed height and width. The Yellow should always have the fixed height but not width. The Red should always have fixed width but not height. The Green should always have both fixed. The smallest the window could become would be set to the height of the Green + Yellow one. and width of Green + whatever nice to display. I know that the weird behavior with the small window is because I go under 300 + 600 of my preferred size...but I need to fix some size somewhere!?!? If I can reach the same behavior with another layout, I'd be glad to try it. If I change and use some ScrollPanel, do…
downvote count: 0
tagged with: layout-manager
has answer: http://stackoverflow.com/a/26923591
score: 1
accepted answer: http://stackoverflow.com/a/26923959
has comment: http://stackoverflow.com/comment/42394148
favorite count: 0
possible better answer: http://stackoverflow.com/a/26923591
type: AnsweredQuestion
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/26923959
tagged with: java

http://stackoverflow.com/a/26991285
accepted answer of: http://stackoverflow.com/q/26990428
has body: Try the following, you have just to test what's the input: public static void main(String[] args) { A a=new A(); Scanner in= new Scanner(System.in); String x=in.next(); if(x.equals("a")){ // the input is "a"; String y= a.a; System.out.println(y); } else if(x.equals("b")){ // the input is "b"; String y= a.b; System.out.println(y); } else System.out.println("Input a or b please !!!"); } If you write a.x the compiler will fetch for x as a variable of your class A and not the input value.
answers question: http://stackoverflow.com/q/26990428
score: 0
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/a/26942599
upvote count: 2
downvote count: 0
has body: Regarding your questions: 1) Can I make the button clickable without multithreading? I just started Java Swing and I have no previous experience with multithreading so I don't know if there's a simpler solution. The direct answer is no, you must use some form of multithreading, but you could do your threading indirectly by using a Swing Timer to do the delays for you. For details, check the tutorial. For your program, you'd likely use the actualSpeed to set the delay time of your Timer object. 2) If multithreading is necessary, how would I implement that in the above code? Any tips or suggestions would be great. Thanks! This question is a bit broad, perhaps overly broad, and in this situation, I find that the best answer is for you to read the tutorials. For Swing Threading, check Concurrency in Swing. Then after digesting this information if later you have a more specific question, it will be much more easily answered with a specific answer.
type: Answer
answers question: http://stackoverflow.com/q/26942576
score: 2

http://stackoverflow.com/comment/42450661
comment on: http://stackoverflow.com/a/26949818
score: 0
type: AnswerComment
has text: Ten hundred thousand is, as far as I know, one million. By adding "million", "billion" and converting from Integer to Long I think I fixed that. Also, "five-hundred thousand" should work from now on. I'm now working on nine-hundred-ninety-nine thousand.
type: Comment

jakarta-ee
tags question: http://stackoverflow.com/q/26863407
tags question: http://stackoverflow.com/q/26908618
tags question: http://stackoverflow.com/q/26897624
tags question: http://stackoverflow.com/q/26903751
tags question: http://stackoverflow.com/q/26961600
tags question: http://stackoverflow.com/q/26875047
tags question: http://stackoverflow.com/q/26977173
tags question: http://stackoverflow.com/q/26922710
tags question: http://stackoverflow.com/q/26904668
tags question: http://stackoverflow.com/q/26854252
type: Tag
tags question: http://stackoverflow.com/q/26898995
tags question: http://stackoverflow.com/q/26964288
tags question: http://stackoverflow.com/q/26973948
tags question: http://stackoverflow.com/q/26971599
tags question: http://stackoverflow.com/q/26933284
tags question: http://stackoverflow.com/q/26932451
tags question: http://stackoverflow.com/q/26894558
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/26952130
tags question: http://stackoverflow.com/q/26858230
tags question: http://stackoverflow.com/q/26883281
tags question: http://stackoverflow.com/q/26926193
tags question: http://stackoverflow.com/q/26844497
tags question: http://stackoverflow.com/q/26894055
tags question: http://stackoverflow.com/q/26893657
tags question: http://stackoverflow.com/q/26906732
tags question: http://stackoverflow.com/q/26878979
tags question: http://stackoverflow.com/q/26937482
tags question: http://stackoverflow.com/q/26976063
tags question: http://stackoverflow.com/q/26942455
tags question: http://stackoverflow.com/q/26871881
tags question: http://stackoverflow.com/q/26944089
tags question: http://stackoverflow.com/q/26944994
tags question: http://stackoverflow.com/q/26924749
tags question: http://stackoverflow.com/q/26980985
tags question: http://stackoverflow.com/q/26857079
tags question: http://stackoverflow.com/q/26929483
tags question: http://stackoverflow.com/q/26900778
tags question: http://stackoverflow.com/q/26989634
tags question: http://stackoverflow.com/q/26908066
tags question: http://stackoverflow.com/q/26860936
tags question: http://stackoverflow.com/q/26901832
tags question: http://stackoverflow.com/q/26925073
tags question: http://stackoverflow.com/q/26910008
tags question: http://stackoverflow.com/q/26904283
tags question: http://stackoverflow.com/q/26852164
tags question: http://stackoverflow.com/q/26850059
tags question: http://stackoverflow.com/q/26991619
tags question: http://stackoverflow.com/q/26973336
tags question: http://stackoverflow.com/q/26892729
tags question: http://stackoverflow.com/q/26980448
tags question: http://stackoverflow.com/q/26882839
tags question: http://stackoverflow.com/q/26936641
tags question: http://stackoverflow.com/q/26950279
tags question: http://stackoverflow.com/q/26974963
tags question: http://stackoverflow.com/q/26841534
tags question: http://stackoverflow.com/q/26973933
tags question: http://stackoverflow.com/q/26891728
tags question: http://stackoverflow.com/q/26934461

http://stackoverflow.com/comment/42352242
comment on: http://stackoverflow.com/q/26899631
score: 0
type: Comment
type: QuestionComment
has text: @Loafayyy good, if it is for entertainment only, then learn to use an external library (in this case, Guava) and use a Multiset

http://stackoverflow.com/q/26905626
tagged with: jbutton
tagged with: object
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26926909
tagged with: java
type: Question
has title: Adding attributes to jButton [JAVA]
has answer: http://stackoverflow.com/a/26905881
upvote count: 3
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26905884
has body: Lets say i have an array of 100 employees. Each employee in the array, is an instance of the class Employee, that have many attributes, such as name, direction, salary, etc. I want to display, 1 button for each employee in the array, and when you click one, you get the information of that employee. What i don't know, is how can i link a button to an specific employee. I Was thinking on, somehow, attaching an Integer variable to the button, so i know which employee is related to that specific button, but, i don't really know how to do that. Anyone cares to give me some advice on this?
type: UnansweredQuestion

http://stackoverflow.com/comment/42441879
score: 0
has text: Oh and instead of same file, can I use singleton to write to different files?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26950186

http://stackoverflow.com/a/26890509
downvote count: 0
score: 1
has body: You can download the extensions in Jdeveloper from Help -> Check for updates. Filter only Oracle Extension, then select Oracle Extension SDK. After installation you can create extension projects.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26854151

http://stackoverflow.com/comment/42281084
score: 0
type: QuestionComment
has text: the first dimension is of size m and the 2nd of size n, why does it seem reverse to you??
comment on: http://stackoverflow.com/q/26860190
type: Comment

http://stackoverflow.com/q/26886476
tagged with: enums
score: 1
has answer: http://stackoverflow.com/a/26886638
tagged with: java
accepted answer: http://stackoverflow.com/a/26886638
tagged with: jaxb
type: Question
upvote count: 1
answer count: 1
has body: I am using Jaxb for marshalling &amp; unmarshalling. from xml i want data unmarshalled to a java object having an enum attribute which is like the one shown below with the constructor, getter &amp; setter for the enum field. public enum MyEnum { P_E("p e") private String type; } I understand from other stackoverflow questions that jaxb does not require setters for setting the value. in xml if i give value as "P_E" it works well. is there a way to use "p e" and set the enum value in object?. Also without using the setter, how does jaxb work?
has title: Unmarshalling in jaxb for enum type
favorite count: 0
downvote count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/26882863
upvote count: 5
has title: Add object in pool with Apache Commons Pool 2
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26883028
tagged with: apache-commons-pool
type: AnsweredQuestion
tagged with: java
has body: I want to create a pool of Object P with Apache Commons Pool 2. I create a P object with variable and method. I create a PPool like this: public class PPool extends GenericObjectPool&lt;P&gt;{ /** * Constructor. * * It uses the default configuration for pool provided by * apache-commons-pool2. * * @param factory */ public PPool(PooledObjectFactory&lt;P&gt; factory) { super(factory); } /** * * * @param factory * @param config */ public PPool(PooledObjectFactory&lt;P&gt; factory, GenericObjectPoolConfig config) { super(factory, config); } } And after that I create a PFactory: public class PhantomJsFactory extends BasePooledObjectFactory&lt;Phantom&gt; { @Override public P create() throws Exception { // TODO Auto-generated method stub return new P(); } @Override public PooledObject&lt;P&gt; wrap(P phantomjs) { // TODO Auto-generated method stub return new DefaultPooledObject&lt;P&gt;(phantomjs); } } Now if I want to add, for example, 10 instances of P object how do I do that? I try with this: GenericObjectPoolConfig config = new GenericObjectPoolConfig(); config.setMaxIdle(1); config.setMaxTotal(10); config.setTestOnBorrow(true); config.setTestOnReturn(true); pool = new PPool(new PFactory(), config); but now?
type: Question
accepted answer: http://stackoverflow.com/a/26883028
score: 5

http://stackoverflow.com/q/26935453
score: 14
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/42419398
tagged with: java
has title: The blank final field INITIAL may not have been initialized
has answer: http://stackoverflow.com/a/26935530
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42415416
type: Question
has answer: http://stackoverflow.com/a/26935525
has body: I'm programming in Java. I have added comments to every method to explain what they're supposed to do (according to the assignment). I have added what I know to the stub of Password.java (which I created after researching a javadoc provided by the school). My question is not about several functions, I know there are mistakes in testWord and setWord, but I'll handle that myself. My question is about this line: public static final java.lang.String INITIAL; This line is provided by the school, so I gotta assume that it is correct, I cant find any documentation anywhere about the constant field value INITIAL, so if anyone could provide me with info on that that would be amazing (eg. how is is handled? what does it store? if anything? type?). Also Im getting an error on this line in Eclipse: The blank final field INITIAL may not have been initialized Why is this error here? Thanks in advance about the comments. FYI the code from Password.java: package ss.week1; public class Password extends java.lang.Object { // ------------------ Instance variables ---------------- /** * The standard initial password. */ public static final java.lang.String INITIAL; // ------------------ Constructor ------------------------ /** * Constructs a Password with the initial word provided in INITIAL. */ public Password() { } /** * Tests if a given string is an acceptable password. Not acceptable: A word * with less than 6 characters or a word that contains a space. * * @param suggestion * @return true If suggestion is acceptable */ // ------------------ Queries -------------------------- public boolean acceptable(java.lang.String suggestion) { if (suggestion.length() &gt;= 6 &amp;&amp; !suggestion.contains(" ")) { return true; } else { return false; } } /** * Tests if a given word is equal to the current password. * * @param test Word that should be tested * @return true If test is equal to the current password */ public boolean testWord(java.lang.String test) { if (test == INITIAL) { return t…
upvote count: 14
possible better answer: http://stackoverflow.com/a/26935525
answer count: 3
linked to: http://stackoverflow.com/q/513832
accepted answer: http://stackoverflow.com/a/26935494
has comment: http://stackoverflow.com/comment/108926483
favorite count: 0
has comment: http://stackoverflow.com/comment/108943038
tagged with: final
has answer: http://stackoverflow.com/a/26935494

http://stackoverflow.com/a/26983817
has comment: http://stackoverflow.com/comment/42541951
has comment: http://stackoverflow.com/comment/42541718
has comment: http://stackoverflow.com/comment/42542016
upvote count: 1
has comment: http://stackoverflow.com/comment/42542621
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26983563
score: 0
has comment: http://stackoverflow.com/comment/42542071
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26983563
has body: You can use split to return an array of Strings, then use a StringBuilder to build your return string. An advantage of this approach is being able to easily return the first four strings, two strings, ten strings, etc. int limit = 3, current = 0; StringBuilder sb = new StringBuilder(); // Used as an example of input String str = "test,west,best,zest,jest"; String[] strings = str.split(","); for(String s : strings) { if(++current &gt; limit) { // We've reached the limit; bail break; } if(current &gt; 1) { // Add a comma if it's not the first element. Alternative is to // append a comma each time after appending s and remove the last // character sb.append(","); } sb.append(s); } System.out.println(sb.toString()); // Prints "test,west,best" If you don't need to use the three elements separately (you truly want just the first three elements in a chunk), you can use a Matcher with the following regular expression: String str = "test, west, best, zest, jest"; // Matches against "non-commas", then a comma, then "non-commas", then // a comma, then "non-commas". This way, you still don't have a trailing // comma at the end. Matcher match = Pattern.compile("^([^,]*,[^,]*,[^,]*)").matcher(str); if(match.find()) { // Print out the output! System.out.println(match.group(1)); } else { // We didn't have a match. Handle it here. }
type: Answer

http://stackoverflow.com/comment/42358182
has text: kocko, I would call these methods using, for instance, QuickSort.Sort(A);
type: QuestionComment
comment on: http://stackoverflow.com/q/26903243
score: 0
type: Comment

http://stackoverflow.com/q/26914243
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/4619211
type: Question
tagged with: performance
has comment: http://stackoverflow.com/comment/42386755
has comment: http://stackoverflow.com/comment/42377937
tagged with: monitoring
duplicate of: http://stackoverflow.com/q/25033458
tagged with: memory
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42386841
favorite count: 0
has comment: http://stackoverflow.com/comment/42399884
has body: Is it possible to get size of retained heap memory by a given Thread without creating memory dump programatically? I know that it's possible to get the size of memory in runtime context like: Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); but i need to calculate memory occupied by given Thread without creating memory dump. UPDATE: A Thread allocates object while execution. At any given moment JVM knows which objects has been allocated by which Thread. So I need to extract size of memory for objects that have been allocated by given Thread. Is it possible?
has answer: http://stackoverflow.com/a/26922202
linked to: http://stackoverflow.com/q/25033458
type: UnansweredQuestion
has title: Is it possible to get size of retained heap memory by a given Thread without creating memory dump programatically?
tagged with: memory-management
has comment: http://stackoverflow.com/comment/42384470

http://stackoverflow.com/a/26970359
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/26970296
answers question: http://stackoverflow.com/q/26970296
type: Answer
has body: This way works if you do it properly. Here's your issue: Caused by: java.io.FileNotFoundException: class path resource [C:/prov-eng-2/prov-eng/provfwk/pf-core/src/main/config/core/config.properties] cannot be opened because it does not exist You're reading this file from the CLASSPATH, but that path is not part of it. You don't include /src in your CLASSPATH. I'd put that .properties file in a /resources directory and package that into your CLASSPATH (e.g. a relative path under /classes).

http://stackoverflow.com/a/26842400
answers question: http://stackoverflow.com/q/26841757
score: 0
type: Answer
has body: First of all assign id to your RelativeLayout in XML, android:id="@+id/rlyt" Then make correction in line 31 in java file, that is layout = (View)findViewById(R.layout.activity_main); to layout = (View)findViewById(R.id.rlyt); and don't use setContentView in OnClick

http://stackoverflow.com/comment/42339743
comment on: http://stackoverflow.com/a/26871315
score: 0
type: Comment
has text: I ended up using the Observer/Observable pattern...worked like a charm! Thank you nana and codeMagic. :)
type: AnswerComment

http://stackoverflow.com/q/26895455
tagged with: java
has comment: http://stackoverflow.com/comment/42345291
type: Question
linked to: http://stackoverflow.com/q/9554636
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26895696
has answer: http://stackoverflow.com/a/26895624
has answer: http://stackoverflow.com/a/26895663
tagged with: jframe
accepted answer: http://stackoverflow.com/a/26895696
has body: What's the name of the JFrame when the class extends JFrame ie: public class FrameClass extends JFrame{ public FrameClass (){ super("name") } Basically, I want to use it in an ItemListener for a JRadioButton so I have an internal method. Would I just have to not extend the JFrame class and make a JFrame object to use it inside the internal method, or is there a name I could reference it by, such as FrameClass. EDIT: I guess there is a slight confusion towards what I put in text above. This is how I'm trying to use it: public void itemStateChanged(ItemEvent e) { setUndecorated(true); setResizable(false); vc.setFullScreenWindow(); } I cannot use this because that uses ItemEvent e.
possible better answer: http://stackoverflow.com/a/26895624
has comment: http://stackoverflow.com/comment/42345189
type: AnsweredQuestion
has title: How do I reference the JFrame when the class extends JFrame

http://stackoverflow.com/comment/42402865
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26926503
has text: I removed the setting of the version by myself => now the version always stays 0. But: I think i don't get a second transaction (all test methods seems to run in the same transaction)... so may be everything is right, just my test is wrong (until i'am in the same transaction, i don't get a new version number, that would make sense). I will have a look on it and try to create a new transaction between the test-methods. Another thing: I edited my initial post (why did the Cascade-Behavior change?!). Any idea?

http://stackoverflow.com/a/26970615
type: Answer
has comment: http://stackoverflow.com/comment/42507613
answers question: http://stackoverflow.com/q/26963158
has body: If you want to get the Java implementation of a priority queue to order your nodes by weight, you have to make your node class implement the "comparable" interface. This means putting a "compareTo" method in your node class and defining the comparison by weight, e.g: private static class Node implements Comparable&lt;Node&gt;{ public int compareTo(Node n) { if(this.weight &lt; n.weight){ return -1; }else if(this.weight &gt; n.weight){ return 1; }else return 0; } }
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42478035
accepted answer of: http://stackoverflow.com/q/26963158

http://stackoverflow.com/a/26925920
has comment: http://stackoverflow.com/comment/42398721
has comment: http://stackoverflow.com/comment/42399037
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/42398483
has body: You can use HashMaps too keep track of the values you have previously seen : public static void main(String[] args) { System.out.println(allEquivalents(new String[][] { { "1", "3" }, { "1", "1", "3" } })); // true System.out.println(allEquivalents(new String[][] { { "1" }, { "1", "1", "1" }, { "1", "1", "2" } })); // false } public static boolean allEquivalents(String[][] arrays) { final HashMap&lt;String, Integer&gt; foundValues = new HashMap&lt;String, Integer&gt;(); for (int i = 0; i &lt; arrays.length; i++) { for (final String key : arrays[i]) { // we have a value not seen in the previous array, return false if (i &gt; 0 &amp;&amp; (!foundValues.containsKey(key) || foundValues.get(key) &lt; i - 1)) { return false; } foundValues.put(key, i); } } // check if all the values where in the last array for (final Integer i : foundValues.values()) { if (i &lt; arrays.length - 1) { return false; } } return true; } You are iterating only once on each value, and once on the values in the HashMap. So, the complexity is O(n), with n your total number of values.
answers question: http://stackoverflow.com/q/26925575
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26925575
has comment: http://stackoverflow.com/comment/42398626

http://stackoverflow.com/q/26853644
tagged with: java-8
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: annotations
linked to: http://stackoverflow.com/q/11773441
has title: Compiler says an annotation's "value must be a constant"
has comment: http://stackoverflow.com/comment/42269987
type: Question
accepted answer: http://stackoverflow.com/a/26853683
score: 3
has body: I have a Spring1 @Controller annotated class with @RequestMapping annotated methods. I want to reference values for the @RequestMapping parameters, value and method, from another class, rather than hard coding them into the annotation. Example Instead of @Controller public class MyController { @RequestMapping(value="my/path", method=RequestMethod.GET) public String handlePath() { // etc... } } I want two files, @Controller public class MyController { @RequestMapping(value=Constants.PATH, method=Constants.PATH_METHOD) public String handlePath() { // etc... } } and public class Constants { public static final String PATH = "my/path"; public static final RequestMethod PATH_METHOD = RequestMethod.GET; } Unfortunately, this fails with the following compile-time error: error: an enum annotation value must be an enum constant @RequestMapping(value=Constants.PATH, method=Constants.PATH_METHOD) ^ Question Why does this work in the case of String but does not work for enums? Notes This question is not Spring specific, this is just an (hopefully) accessible example of this issue. I happen to be using Java 8
has answer: http://stackoverflow.com/a/26853683
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42273830

http://stackoverflow.com/comment/42272034
score: 0
has text: Sorry @chaitanya, I think I wasn't clear on the question so I added some clarification. Thanks for the quick reply :)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26854204

http://stackoverflow.com/q/26978692
favorite count: 0
accepted answer: http://stackoverflow.com/a/26978766
type: AnsweredQuestion
has body: I have a small problem. I am reading sort.txt in which there are words ordered like this: a b c asv sad dda Below you can see my code which converts all of those to UPPERCASE. However I am getting following result: ABCASVSADDDA Which should be: A B C ASV and so on So as you can see it makes them UpperCase but why not every word in each line? public class vlke_crke { public static void main (String[] args) { try { FileReader fr = new FileReader("sort.txt"); BufferedReader br = new BufferedReader(fr); PrintWriter out = (new PrintWriter(new FileWriter("final.txt"))); String s=""; while((s = br.readLine()) != null) { out.write(s.toUpperCase()+"\n"); } out.close(); } catch(Exception e) { e.printStackTrace(); } } }
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26978766
has comment: http://stackoverflow.com/comment/42491906
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42492219
possible better answer: http://stackoverflow.com/a/26978776
has title: Read file and convert all to UpperCase
has answer: http://stackoverflow.com/a/26978776

http://stackoverflow.com/comment/42298503
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26868020
has text: If you don't believe me, try Quizzie's solution. Then explain how >>HE<< manages to get his code to work without instantiating the class.
score: 0

http://stackoverflow.com/q/26948777
score: 14
has title: How can I make rJava use the newer version of java on osx?
linked to: http://stackoverflow.com/q/30738974
has comment: http://stackoverflow.com/comment/74330010
has comment: http://stackoverflow.com/comment/42439327
favorite count: 0
has comment: http://stackoverflow.com/comment/42439305
type: Question
has body: I am following this tutorial on rJava: http://cran.r-project.org/web/packages/helloJavaWorld/vignettes/helloJavaWorld.pdf I have made all the files as specified in the tutorial and installed the helloJavaWorld package, but once I run the helloJavaWorld() function, it complains: &gt; helloJavaWorld() Error in .jnew("HelloJavaWorld") : java.lang.UnsupportedClassVersionError: HelloJavaWorld : Unsupported major.minor version 52.0 So I tried to check the java version that rJava is using: .jinit() jvm = .jnew("java.lang.System") jvm.props = jvm$getProperties()$toString() jvm.props &lt;- strsplit(gsub("\\{(.*)}", "\\1", jvm.props), ", ")[[1]] jvm.props [1] "java.runtime.name=Java(TM) SE Runtime Environment" [2] "sun.boot.library.path=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Libraries" [3] "java.vm.version=20.65-b04-466.1" [4] "awt.nativeDoubleBuffering=true" [5] "gopherProxySet=false" [6] "mrj.build=11M4716" [7] "java.vm.vendor=Apple Inc." [8] "java.vendor.url=http://www.apple.com/" [9] "path.separator=:" [10] "java.vm.name=Java HotSpot(TM) 64-Bit Server VM" [11] "file.encoding.pkg=sun.io" [12] "user.country=US" [13] "sun.os.patch.level=unknown" [14] "java.vm.specification.name=Java Virtual Machine Specification" [15] "user.dir=/private/tmp" [16] "java.runtime.version=1.6.0_65-b14-466.1-11M4716" [17] "java.awt.graphicsenv=apple.awt.CGraphicsEnvironment" [18] "java.endorsed.dirs=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/endorsed" [19] "os.arch=x86_64" [20] "java.io.tmpdir=/var/folders/5d/44ctbbln4dsflgzxph1dm8wr0000gn/T/" [21] "line.separator=\n" [22] "java.vm.specification.vendor=Sun Microsystems Inc." [23] "os.name=Mac OS X" [24] "sun.jnu.encoding=MacRoman" [25] "java.library.path=.:/Users/kaiyin/Library/Java/Extensions:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java" [26] "java.specification.name=Java Platform API Specification" [27] "java.class.version=50.0" [28] "sun.management.compiler=HotSpot 64-Bit…
upvote count: 14
linked to: http://stackoverflow.com/q/10077689
tagged with: java
has comment: http://stackoverflow.com/comment/42439570
has answer: http://stackoverflow.com/a/35852152
tagged with: rjava
answer count: 4
has answer: http://stackoverflow.com/a/35641371
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32544358
has answer: http://stackoverflow.com/a/26949061
tagged with: http://stackoverflow.com/tag/r

http://stackoverflow.com/a/26970813
score: -1
has body: There right solution is: + (NSData *)AESKeyForPassword:(NSString *)password salt:(NSData *)salt { NSMutableData * derivedKey = [NSMutableData dataWithLength:kAlgorithmKeySize]; int result = CCKeyDerivationPBKDF(kCCPBKDF2, // algorithm password.UTF8String, // password [password lengthOfBytesUsingEncoding:NSUTF8StringEncoding], // passwordLength salt.bytes, // salt salt.length, // saltLen kCCPRFHmacAlgSHA1, // PRF kPBKDFRounds, // rounds derivedKey.mutableBytes, // derivedKey derivedKey.length); // derivedKeyLen // Do not log password here NSAssert(result == kCCSuccess, @"Unable to create AES key for password: %d", result); return derivedKey; } I found this code in this article: http://robnapier.net/aes-commoncrypto
has comment: http://stackoverflow.com/comment/42477659
downvote count: 1
has comment: http://stackoverflow.com/comment/42478277
type: Answer
answers question: http://stackoverflow.com/q/26969150
upvote count: 0

http://stackoverflow.com/a/26931903
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26931552
upvote count: 1
has body: It looks like the first call to sort(values, i) puts all the integers whose lowest bit is 0 at the start of the array, and all the integers whose lowest bit is 1 at the end of the array. The second call puts all the integers whose seconds lowest bit is 0 at the start of the array, and all the integers whose seconds lowest bit is 1 at the end of the array (without changing the internal order of each group). ... The last call puts all the integers whose 31st bit is 0 at the start of the array, and all the integers whose 31st bit is 1 at the end of the array (without changing the internal order of each group) Thus the sort(int[] values) sorts the array in ascending order, assuming that it only contains positive integers (since it ignores the sign bit).
score: 1

http://stackoverflow.com/q/26942614
tagged with: generics
has body: Hello guys i'm trying to search for a particular country in my list that i created. First of all i was successfully able to create the list and able to print out to the console. but when i search for a country that was printed out on a console i tried entering one of the countries displayed on the screen to verify it and it displayed it wasn't found even when the displayed country is on the screen. Please this is my first programming experience with generics in java> i have tried debugging it but to no avail. Please could some one help. Node class holds a generic parameter and class LinkedList creates the list for node objects. Node class holds generic parameter that takes class country. The overridden method is written in class country that stores each country names. I have put below the class LinkedList, class Node and the overridden method in class country as well as the search function in the driver class and the output received from the console. public class LinkedList&lt;T&gt;{ private Node&lt;T&gt; first; public LinkedList() { this.first = null; } public boolean isEmpty() { return (first==null); } public T contains(T obj) { if(this.isEmpty()) { System.out.println("Sorry list is empty"); return null; } else { Node&lt;T&gt; current = first; while(current != null) { if(current.getT().equals(obj)) { return current.getT(); } current = current.getNext(); } return null; } } Node class that has generic detail: public class Node&lt;T&gt; { private T data; private Node&lt;T&gt; next; public Node(T data){ this.data = data; this.next = null; } public Node(T objectT, Node&lt;T&gt; next) { this.data = objectT; this.next = next; } public void setNode(Node&lt;T&gt; next) { this.next = next; } public Node&lt;T&gt; getNext() { return this.next; } public T getT() { return data; } } overriden equals method in a different class. public boolean equals(Country obj) { return this.countryNames.equalsIgnoreCase(obj.getName()); } my search function in the main class. private void testR…
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
has title: Trouble with java generics with a link list
has answer: http://stackoverflow.com/a/26942758
answer count: 1

http://stackoverflow.com/a/26911498
score: 1
answers question: http://stackoverflow.com/q/26911374
upvote count: 1
has comment: http://stackoverflow.com/comment/42377859
has body: The main-method is a static method. Static methods do not reference single objects, think of them as methods of a class instead of an object - they do not need any objects to work. Read this for further explanations.
type: Answer
downvote count: 0

http://stackoverflow.com/a/26985491
downvote count: 0
has comment: http://stackoverflow.com/comment/61044143
accepted answer of: http://stackoverflow.com/q/26985390
has comment: http://stackoverflow.com/comment/42504631
type: Answer
answers question: http://stackoverflow.com/q/26985390
has comment: http://stackoverflow.com/comment/42504731
has comment: http://stackoverflow.com/comment/60948298
has comment: http://stackoverflow.com/comment/42504688
upvote count: 5
has body: The call method of the Callable interface returns a value of type T. Your lambda is simply shorthand for the call method, and likewise should return a T value. Any interface that meets the requirements of a FunctionalInterface can be substituted by a lambda expression. Such an interface will have a single abstract method, one with no default implementation. For your question, the interface is Callable, and the abstract method is call. The lambda expression then acts as the body of that abstract method in an anonymous implementation of that interface. Let's take as an example a method doStuff(Callable&lt;Integer&gt; stuff). To satisfy this interface, you could give an anonymous class: doStuff(new Callable&lt;Integer&gt;(){ public Integer call(){ return 5; } }); Or you could use a lambda: doStuff( () -&gt; { return 5; } ); Or even more succinctly: doStuff( () -&gt; 5 ); If your method doesn't have a return type, perhaps Runnable would be a better fit. See also: Lambda Expressions (Oracle) - 'Use Standard Functional Interfaces with Lambda Expressions'
has comment: http://stackoverflow.com/comment/42505118
has comment: http://stackoverflow.com/comment/42504955
has comment: http://stackoverflow.com/comment/42504592
score: 5
type: AcceptedAnswer

http://stackoverflow.com/a/26956170
has body: Use BufferedReader instead.This will fix your problem.:- BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); i=counter; while(i&lt;=bandMembers){ System.out.println("Enter band member "+i+" name:-"); String bName=br.readLine(); System.out.println("What instrument does "+bName+" play?"); String bNamePlay=br.readLine(); list = list + i + ":" + " " + bName + " - " + bNamePlay+ "\n"; i++; }
accepted answer of: http://stackoverflow.com/q/26946866
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26946866
score: 0
type: Answer

http://stackoverflow.com/q/26840701
answer count: 2
tagged with: android-listview
has answer: http://stackoverflow.com/a/26841072
tagged with: android
has comment: http://stackoverflow.com/comment/42245695
has answer: http://stackoverflow.com/a/26841827
accepted answer: http://stackoverflow.com/a/26841827
has comment: http://stackoverflow.com/comment/42246870
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42247267
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42245903
has comment: http://stackoverflow.com/comment/42361404
type: Question
possible better answer: http://stackoverflow.com/a/26841072
has comment: http://stackoverflow.com/comment/42247455
has body: Hi i have trouble in achieving pagination for listview in android. My task is to add Values from editTextto ListView and i need to add pagination to the list. But I tried and i am to insert only one value . While i try to add next values i end up in errors. Please kindly tell me the error on my code. i have added my layout,Activity and Log MainActivity.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/agnes2_back" 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.vivek.projectone.MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="65dp" android:layout_marginTop="15dp" android:gravity="right" android:text="@string/welcome" android:textColor="#58FA58" /> <TextView android:id="@+id/userView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="25dp" android:layout_marginTop="15dp" android:text="@string/userLabel" android:textColor="#FF0000" /> <requestFocus /> </RelativeLayout> MainActivity.java public class MultipleActivity extends Activity implements OnItemClickListener { Button addToList; EditText viewListItem1, viewListItem2; ListView customItemList; PackageManager packageManager; ArrayList<String> checkedCustomItem; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_multiple); addToList = (Button) findViewById(R.id.adToListBtn); viewListItem1 = (EditText) findViewById(R.id.viewEditItem1); viewListItem2 = (EditText) findViewById(R.id.viewEditItem2); packageManager = getPackage…
has title: Android Pagination ListView
has comment: http://stackoverflow.com/comment/42246810
tagged with: listview
score: 0

http://stackoverflow.com/comment/42235364
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26834568
type: AnswerComment
has text: Great ! As I suspected, List.indexOf must check the class before comparing values with equals(). But I suspect this is android-specific

http://stackoverflow.com/a/26875249
upvote count: 3
has comment: http://stackoverflow.com/comment/42308277
type: AcceptedAnswer
has body: Import it in its original folder structure (as named in the package declaration of the original files) then when it compiles no complaints rename the package folder and it will rename the folders and change the package declaration in all files. (Good comment that refactor->rename is the canonical way to performs a rename where you want eclipse to search for all occurrences of the name and change it in a batch manner. It's worth spending time figuring out what everything on that menu does and the keyboard shortcut for rename so you can rename any variable when you realise a more descriptive name for it, or class, or method, or constant, ...)
downvote count: 0
has comment: http://stackoverflow.com/comment/42308274
accepted answer of: http://stackoverflow.com/q/26875107
type: Answer
has comment: http://stackoverflow.com/comment/95011814
answers question: http://stackoverflow.com/q/26875107
score: 3

http://stackoverflow.com/comment/42411172
score: 0
type: Comment
type: QuestionComment
has text: Thanks everyone, all your answers were really helpful and exactly what I needed :D. I could only pick 1 correct one unfortunately. But they were all really useful. Thanks!!
comment on: http://stackoverflow.com/q/26932676

http://stackoverflow.com/a/27122806
has body: Hi i think that you want is the modification time of each input File that enters in your mapper. If it is the case you just have to add a few lines to the mpkorstanje solution: FileSystem fs = FileSystem.get(URI.create(uri), conf); long moddificationTime = fs .getFileStatus((FileSplit)context.getInputSplit()) .getPath()).lastModified(); With this few changes you can get the fileStatus of each inputSlipt and you can add it to your key in order to use later in your process or make a multipleOutput reduce and write somewhere else in your reduce phase. I hope this will be usefull
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42750472
has comment: http://stackoverflow.com/comment/108223148
type: Answer
answers question: http://stackoverflow.com/q/26936932
accepted answer of: http://stackoverflow.com/q/26936932
upvote count: 10
score: 10
downvote count: 0

http://stackoverflow.com/q/26966063
has comment: http://stackoverflow.com/comment/42469914
tagged with: jxtable
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26966525
has title: JXTable Incorrect Sorting
upvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/42469562
has comment: http://stackoverflow.com/comment/42469349
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42469600
has comment: http://stackoverflow.com/comment/42469853
tagged with: java
has comment: http://stackoverflow.com/comment/42469442
type: Question
has comment: http://stackoverflow.com/comment/42469414
has answer: http://stackoverflow.com/a/26966525
downvote count: 0
tagged with: swingx
tagged with: sorting
has comment: http://stackoverflow.com/comment/42469541
has body: I am using a JXTable to display, filter, and sort some data. However, I'm getting some unexpected behavior when sorting. As you can see, the values are not ascending as expected, but sorted how a string would be sorted. To address the comments, I am sure this column is getting parsed in the correct part of the code (i.e. the Float.valueOf() block.) I know this through debugging. Also, I am sorting the column by clicking on the jxtable's header. I am not doing it programmatically. Just to be clear, I am adding them as Floats: class FantasyProTableModel extends DefaultTableModel { void loadData() throws BiffException, IOException { Workbook workbook = Workbook.getWorkbook(new File("Input.xls")); Sheet sheet = workbook.getSheet(0); int numCols = sheet.getColumns(); for(int col=0;col&lt;numCols;col++) { addColumn(sheet.getCell(col,0).getContents()); } for(int rownum=1;rownum&lt;sheet.getRows();rownum++) { Object[] row = new Object[numCols]; for(int col=0;col&lt;numCols;col++) { try { row[col] = Float.valueOf(sheet.getCell(col,rownum).getContents()); //parseFloat() doesn't work either } catch(NumberFormatException e) { row[col] = sheet.getCell(col,rownum).getContents(); } } addRow(row); } workbook.close(); } } What can I do to get it to sort in the correct, ascending order, by value?

http://stackoverflow.com/comment/42305321
score: 0
has text: Tried testing a few things, and I check the 2d arraylist contents and it seems the loop always stops adding at i=depends on size j=1, can't figure out why!
comment on: http://stackoverflow.com/q/26872454
type: Comment
type: QuestionComment

android-networking
tags question: http://stackoverflow.com/q/26968864
tag name: android-networking
type: Tag
tags question: http://stackoverflow.com/q/26963950

http://stackoverflow.com/q/26970767
tagged with: jfilechooser
type: Question
answer count: 1
tagged with: jsch
has title: remote FileChooser using OtrosVFSBrowser
has answer: http://stackoverflow.com/a/26980318
upvote count: 1
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has body: I'm trying to do a remote filechooser. I read a lot of information but I don't get it. The best site I've seen is (https://code.google.com/p/otrosvfsbrowser/) because is exactly what I want but I don't fine more information. Are Someone of you using this tool? where are any example code? I already use JSCH library to transfer via SFTP, but I want a tool to choose the remote path. I'm starting in Java. sorry for my English.
tagged with: otroslogviewer
score: 1
tagged with: java

http://stackoverflow.com/q/26989477
has answer: http://stackoverflow.com/a/26990451
type: Question
tagged with: jtree
answer count: 1
tagged with: directory
tagged with: expand
upvote count: 1
has comment: http://stackoverflow.com/comment/42510858
has comment: http://stackoverflow.com/comment/42600929
has body: I would like to create a JTree which reflect directory structure but is loaded succesive. I have dir structure: c:\root -------\dir1 ------------\file1 ------------\file2 -------\dir2 I know how to load to JTree node structure of directories of first level (dir1, dir2). But i don't want to search files in each directory only when user will expand specific node in order to save time and resources. Because of above i would like to add plus icon (or equivalent for particular java style) to each node even if it will be empty, in order to suggest user in this direcory can be files. Also when user will expand node (and search will be performed) when dir is empty i would like to remove any icon. Is any way to do it?
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: swing
has title: JTree with expandable empty parents
score: 1
tagged with: java

http://stackoverflow.com/comment/42400823
type: QuestionComment
score: 0
type: Comment
has text: @Funtik Yes switch operates on String after java 7 [see](https://docs.oracle.com/javase/7/docs/technotes/guides/language/strings-switch.html)
comment on: http://stackoverflow.com/q/26927301

http://stackoverflow.com/q/26955007
type: Question
has answer: http://stackoverflow.com/a/31572268
has answer: http://stackoverflow.com/a/27046987
has comment: http://stackoverflow.com/comment/42682469
has comment: http://stackoverflow.com/comment/51099027
has title: Apache sqoop is not compiling
tagged with: hadoop
answer count: 2
tagged with: apache
has body: I am trying to compile apache sqoop from source code as I need to build an extension of it. The code compilation is failing. Code version from Git - 1.6. - https://github.com/apache/sqoop ivy dependency can't be resolved for org.mortbay.jetty#jetty;6.1.26!jetty.zip ant package command is giving following error [ivy:resolve] [FAILED ] org.mortbay.jetty#jetty;6.1.26!jetty.zip: (0ms)
tagged with: sqoop
favorite count: 0
has comment: http://stackoverflow.com/comment/51098324
has comment: http://stackoverflow.com/comment/51098136
type: UnansweredQuestion
tagged with: bigdata
score: -1
linked to: http://stackoverflow.com/q/17302119
linked to: http://stackoverflow.com/q/7408545
tagged with: java
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/51098250

http://stackoverflow.com/q/26862513
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42290873
has comment: http://stackoverflow.com/comment/42291892
tagged with: java
has answer: http://stackoverflow.com/a/26866900
has comment: http://stackoverflow.com/comment/42290212
type: Question
has comment: http://stackoverflow.com/comment/42291633
answer count: 1
has title: Relative path using Level hierarchy(../../)
tagged with: relative-path
has body: I want to use the relative path in xml files in our project. I have the files in the following location. D:/SDC-Builds/SRDM2.3.0/SRDM/Svr/IdP/IdPserver/conf/attribute-r.xml I have other xml file which needs to ref the above location, I use the following relative path to be independent of machines and folder names. In D:/SDC-Builds/SRDM2.3.0/SRDM/Svr/IdP/IdPserver/others/service.xml, i am using the code like below service.xml &lt;srv:ConfigurationResource="../../../../../../IdP/IdPserver/conf/attribute-r.xml"&gt; &lt;/srv&gt; Please tell me am i using proper convention to refer the attribute-r.xml ?
score: 0
has comment: http://stackoverflow.com/comment/42292249
has comment: http://stackoverflow.com/comment/42291322
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42286364

http://stackoverflow.com/comment/42255600
type: QuestionComment
comment on: http://stackoverflow.com/q/26835911
has text: well, as a worst-case you could always do your own custom build, add a manually-written pom.xml to it (or build it as well?) and throw in a scripted invocation of the maven install/deploy plugin(s) to "mavenize" the resulting artifacts. my ide of choice is intellij, and even though it doesnt pick up everything from maven it does pick up most of the config. what are you doing in maven that isnt IDE-friendly? maybe there's a way around that
score: 0
type: Comment

http://stackoverflow.com/q/26957516
tagged with: reflection
accepted answer: http://stackoverflow.com/a/26978725
tagged with: java
has comment: http://stackoverflow.com/comment/42464256
type: Question
has body: I have to retrieve the value of all fields in a class loaded from a jar. So I need an instance to do that : field.get(gameClassInstance); for each field. Here the code that load the class and try to create an instance : private Loader() throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { File jarFile = new File(System.getProperty("user.dir")+File.separator+"games"+File.separator+gameName+".jar"); // Create the URLClassLoader URL url = jarFile.toURI().toURL(); URL[] urls = new URL[]{url}; URLClassLoader cl = new URLClassLoader(urls); // Search the class JarFile jar = new JarFile(jarFile.toString()); Enumeration&lt;JarEntry&gt; e = jar.entries(); while (e.hasMoreElements()) { JarEntry je = (JarEntry) e.nextElement(); if(je.isDirectory() || !je.getName().endsWith(".class")){ continue; } if (je.getName().contains(gameName)){ String className = je.getName().substring(0,je.getName().length()-6); // Remove ".class" className = className.replace('/', '.'); gameClass = cl.loadClass(className); gameClassInstance = gameClass.newInstance(); // Create an instance of the class } } jar.close(); cl.close(); } Here the loaded class : public class Solitaire { public Board board = new Board("Board1", ""); public Layout layout = new Layout(); public Player player = new Player(); public Solitaire() { } } There is a StackOverflowError at the line where I create an instance.
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26978725
tagged with: classloader
tagged with: urlclassloader
type: AnsweredQuestion
has title: Retrieve the value of fields in a class loaded from a jar
tagged with: instance

http://stackoverflow.com/a/26919092
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42386625
type: Answer
upvote count: 2
score: 2
has body: You could try and iterate in nested for loops like this: for (int i = 0; i &lt; aryLines.length; i += 10) { // every iteration brings you to the beginning of a new question for (int j = 0; j &lt; 6; j++) { System.out.println(aryLines[i + j]); } }
has comment: http://stackoverflow.com/comment/42386854
accepted answer of: http://stackoverflow.com/q/26918856
has comment: http://stackoverflow.com/comment/42386554
answers question: http://stackoverflow.com/q/26918856
has comment: http://stackoverflow.com/comment/42386614

http://stackoverflow.com/a/26924711
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26924569
has comment: http://stackoverflow.com/comment/42397023
has comment: http://stackoverflow.com/comment/42396587
answers question: http://stackoverflow.com/q/26924569
type: AcceptedAnswer
downvote count: 0
has body: And why should it roll back... You are opening new sessions yourself and managing transactions yourself also. How should Spring know that. Your daos are wrong in multiple ways. Never store the session/transaction in a instance variable Never use openSession when using Spring to manage your transactions Never manage your own transactions if you want container managed transactions. So in short fix your daos. public class CustomerDaoServiceImpl implements CustomerDaoService{ @Autowired SessionFactory sessionFactory; @Override public boolean saveCustomer(Customer customer) throws Exception { Session session = sessionFactory.getCurrentSession(); session.save(customer); return false; } } Is all you need (of course that goes for all your daos). In addition your config is also wrong, you only need the &lt;tx:annotation-driven /&gt; you don't need the &lt;tx:advice /&gt; and &lt;aop:config /&gt; remove those. All of this is explained in the reference guide.
type: Answer

http://stackoverflow.com/comment/42360685
has text: This might help http://stackoverflow.com/questions/11198297/how-to-initialize-a-java-date-object-in-spring-xml-configuration-file
type: QuestionComment
comment on: http://stackoverflow.com/q/26904781
type: Comment
score: 2

http://stackoverflow.com/a/27020644
type: Answer
answers question: http://stackoverflow.com/q/26965683
score: 1
upvote count: 1
downvote count: 0
has body: The login form resides inside an iframe, i.e. before accessing the elements you have to switch the context of the driver, .e.g. driver.switchTo().frame("gadget-0"); (assuming "gadget-0" is the id of the frame which contains the login box). I'm not an expert for the IDE->WebDriver conversion, but it seems that the context switch got lost. If you want to implement UI automation for JIRA, have a look at the JIRA PageObjects which really ease many of the common tasks. A sample how they can be employed is available at the Atlassian documentation pages or here: https://blog.codecentric.de/en/2014/07/part-3-agile-testing-jira-plugins-system-tests/. This blog entry is part of a short series we wrote b/c we had similar issues and wanted to share what we learned.

http://stackoverflow.com/comment/42358199
type: AnswerComment
comment on: http://stackoverflow.com/a/26903312
type: Comment
has text: Yes that's right. Use Object of QuickSort to perform sorting operation.
score: 0

http://stackoverflow.com/comment/42234600
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26833969
has text: +1 I had to read that several times, but finally got it, thank you a lot! :) So, the returned type must be "flexible" (must be of a type which user of the class gave), not "hard-coded"... makes sense now :)

http://stackoverflow.com/comment/42343485
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26891728
has text: not sure what sorting criteria you are using, but how is it possible for 1.2 to come before 1.10?

http://stackoverflow.com/q/26859738
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42282808
has comment: http://stackoverflow.com/comment/42283235
type: Question
accepted answer: http://stackoverflow.com/a/26861648
has comment: http://stackoverflow.com/comment/42282683
tagged with: csrf
has comment: http://stackoverflow.com/comment/42282327
has comment: http://stackoverflow.com/comment/42282267
score: 0
has title: How to prevent CSRF attack in a legacy Java application?
has comment: http://stackoverflow.com/comment/42280392
answer count: 1
has comment: http://stackoverflow.com/comment/42282569
has body: I'm working on a 12+ year old Java Web application. It follows client's unique framework and not any of the industry standard framework! Recently an Appscan report was generated for the application, as per which this application is having highly critical security problems like it is prone to CSRF, SQL Injection etc. Now I have to implement something purely in Java, without using any framework and get rid of this CSRF Attack. I did some google and came to know that we have to append a temporary token in the URL and then validate it. Is it the only way. I couldn't get much practical solutions. Anyone experienced in dealing with such a scenario? Please Help me!
has comment: http://stackoverflow.com/comment/42282862
has answer: http://stackoverflow.com/a/26861648

http://stackoverflow.com/comment/42448362
has text: Here's my code for sumOfArray.
comment on: http://stackoverflow.com/q/26954066
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42357543
type: Comment
has text: Which is precisely the problem illustrated by your question :)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26902920

http://stackoverflow.com/comment/42514057
type: Comment
score: 1
has text: Seems you need to examine [that](https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html)
type: QuestionComment
comment on: http://stackoverflow.com/q/26991291

http://stackoverflow.com/comment/42512193
type: Comment
has text: It says I have the latest version. As I said version checker on java.com shows I have everything up to date
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26990083

http://stackoverflow.com/q/26859158
type: Question
tagged with: date
has title: Date and time in java not working
duplicate of: http://stackoverflow.com/q/12575990
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42279384
duplicate of: http://stackoverflow.com/q/14460531
has comment: http://stackoverflow.com/comment/42279361
tagged with: time
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/42279377
linked to: http://stackoverflow.com/q/12575990
has body: I need to take date in the format date/month/year hours:minutes (time in 12 hour format) in java and I write the following code to save the date in datetoday. But it does not work for me. The output is shown in the following format Tue Nov 11 12:10:00 IST 2014. Can anyone help me regarding the issue? Thanks in advance. Date datetoday; void todaysdate() { Date date = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("DD/MM/yyyy HH:mm"); String inputString2 = sdf.format(date); try { datetoday = sdf.parse(inputString2); } catch (ParseException ex) { System.out.println(ex.getMessage()); } System.out.println(datetoday); }
has answer: http://stackoverflow.com/a/26859193
tagged with: java
linked to: http://stackoverflow.com/q/14460531

http://stackoverflow.com/comment/42364273
type: QuestionComment
comment on: http://stackoverflow.com/q/26906789
has text: i ran as u mentioned Gimby but still it shows the error..have i done any mistake in my code?
score: 0
type: Comment

http://stackoverflow.com/comment/42473127
comment on: http://stackoverflow.com/q/26939483
type: Comment
has text: Ofc it relies to application code, but I am wondering does it make sense to use this combination. I am wondering maybe because programmers prefer tomcat or jetty, there is some reason for it.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26837640
has comment: http://stackoverflow.com/comment/42240478
tagged with: format
has title: Need to change format of date in my Android app
tagged with: java
answer count: 3
tagged with: date
has comment: http://stackoverflow.com/comment/42240624
has comment: http://stackoverflow.com/comment/42240494
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42240593
has comment: http://stackoverflow.com/comment/42240556
has comment: http://stackoverflow.com/comment/42242098
linked to: http://stackoverflow.com/q/26352609
score: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has answer: http://stackoverflow.com/a/26837921
has body: UPDATE. I'm really struggling with the answers given (they're not bad answers, I'm just struggling) It would really help for more detailed answers I'm pulling in an RSS feed into my app, the pubDate is currently showing up as for example Mon, 10 Nov 2014 03:34:38 +0000. I need it to show up in a more user friendly manner. I've looked at all the options, SimpleDateFormat..etc, I'm sort of new to Java so all previous suggestions are just going over my head, I'm looking for what I actually need to put in my code. Code is as follows AndroidXMLParsingActivity.java package com.example.myapp; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Locale; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.text.Html; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import java.util.Calendar; import java.util.Date; import java.text.DateFormat; import java.text.SimpleDateFormat; public class AndroidXMLParsingActivity extends ListActivity { // All static variables static final String URL = "http://example.xml"; // XML node keys static final String KEY_ITEM = "item"; // parent node static final String KEY_DATE = "pubDate"; static final String KEY_DESC = "description"; static final String KEY_ID = "title"; static final String KEY_LDESC = "content:encoded"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ArrayList&lt;HashMap&lt;String, String&gt;&gt; menuItems = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); XMLParser parser = new XMLParser(); String xml = parser.getXmlFromU…
type: Question
has answer: http://stackoverflow.com/a/26838022
tagged with: android
has answer: http://stackoverflow.com/a/26840206
upvote count: 1
linked to: http://stackoverflow.com/q/4772425

http://stackoverflow.com/q/26852699
tagged with: class
answer count: 1
has title: set in array from one method and get from another method in java (necessary!!)
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42267958
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/26852847
type: Question
has body: I have made an array from class student student [] stu=new student[100]; I'm in class student op and I want to insert name and code from method insert to array stu. Until now everything worked, but when I want to get my name and code from another method like delete in class student op, it shows that my array stu is empty. Where is the problem? if I delet the line stu[0]=new student(); in delet method Net beans show an error!! public class studentop { student [] stu=new student[100]; private int counter=0; int con=0; public int edd; public void insert(int edame){ String ans; Scanner input=new Scanner(System.in); for(int i=edame;i&lt;100;i++){ System.out.println("add more student? "); ans=input.next(); if(ans.equals("y")){ String thename; stu[i]=new student(); System.out.println("insert name "+(i+1)+" : "); thename = input.next(); stu[i].setname(thename); System.out.println("insert code "+(i+1)+" : "); int thecode; thecode = input.nextInt(); stu[i].setcode(thecode); System.out.println(stu[i].getcode()); for(int m=0;m&lt;=3;m++){ System.out.println("add mark "+(m+1)+" ? "); String ans2; ans2=input.next(); if(ans2.equals("y")){ switch (m){ case 0: System.out.println("mark"+(m+1)+" : "); int mark; mark=input.nextInt(); stu[i].setmark(mark); break; case 1: System.out.println("mark"+(m+1)+" : "); // int mark; mark=input.nextInt(); stu[i].setMark2(mark); break; case 2: System.out.println("mark"+(m+1)+" : "); // int mark; mark=input.nextInt(); stu[i].setMark3(mark); break; case 3: System.out.println("mark"+(m+1)+" : "); // int mark; mark=input.nextInt(); stu[i].setMark4(mark); break; } } else{ break; } } System.out.println(stu[i].getname());//aztarighe get name az } else { edame=i; edd=edame; break; } }//end for } public void delete(){ stu[0]=new student();//if I delet this line it shows an error! System.out.println(stu[0].getcode()); } } and here is my class student public class student { public String name; public int code; public double mark; private double mark2; private…
has comment: http://stackoverflow.com/comment/42267939
upvote count: 0
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/42268145
has comment: http://stackoverflow.com/comment/42268055
linked to: http://stackoverflow.com/q/26804645

http://stackoverflow.com/comment/42355739
type: Comment
comment on: http://stackoverflow.com/a/26901340
has text: Yes it is correct Thilo.The above code is a good example usage of PushbackInputStream
score: 0
type: AnswerComment

http://stackoverflow.com/q/26906732
type: Question
tagged with: jakarta-ee
has title: Error in Eclipse IDE while starting a project
score: -2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26906861
tagged with: eclipse
answer count: 2
upvote count: 0
favorite count: 0
has body: i have trouble while opeing eclipse like "location of android sdk has not been setup in the preference". what i have to do for this error in eclipse IDE?
tagged with: android
linked to: http://stackoverflow.com/q/16731126
has answer: http://stackoverflow.com/a/26906842
duplicate of: http://stackoverflow.com/q/16731126
type: UnansweredQuestion
downvote count: 2

http://stackoverflow.com/a/32871527
has body: The comment of zella was helpful for me. Did not work: DatumFunction&lt;Double&gt; datumFunction = new DatumFunction&lt;Double&gt;(){ @Override public Double apply(int d) { String result = "" + d; return value; } }; Does work: DatumFunction&lt;Double&gt; datumFunction = new DoubleDatumFunction(); with public class DoubleDatumFunction implements DatumFunction&lt;Double&gt; { @Override public String apply(int d) { String result = "" + d; return value; } } If I would remove the public modifier from the class for the second example, the example would not work any more.
answers question: http://stackoverflow.com/q/26846078
score: 0
type: Answer

http://stackoverflow.com/q/26935862
has title: Need help converting an array of JTS Geometry objects to a shape file
upvote count: 2
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26975475
has comment: http://stackoverflow.com/comment/42461376
tagged with: java
tagged with: geotools
type: Question
tagged with: jts
has body: I have an array of JTS Geometry objects that I need to put in a shape file. I also have some other attributes that needs to go in a DBase file. I need to index the spatial objects as well and if required create the projection file. Is there a way to do this using JTS/GeoTools. I tried ShapeFileWriter but that doesn't seem enough (no dbf support for instance). public Shape(String shpFileName, String shxFileName) throws FileNotFoundException { RandomAccessFile shpFile = new RandomAccessFile(shpFileName, "rw"); this.shpChannel = shpFile.getChannel(); RandomAccessFile shxFile = new RandomAccessFile(shxFileName, "rw"); this.shxChannel = shxFile.getChannel(); } public void createShapeFile(GeometryCollection geometries, ShapeType shapeType) throws IOException { ShapefileWriter writer = new ShapefileWriter(this.shpChannel, this.shxChannel); writer.write(geometries, shapeType); writer.close(); }
has comment: http://stackoverflow.com/comment/42438654
has answer: http://stackoverflow.com/a/26975475
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/42513929
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26991163
has text: Try this, to get SimpleDateFormat working http://stackoverflow.com/questions/10284564/gwt-use-datetimeformat-on-client-and-simpledateformat-on-server

http://stackoverflow.com/q/26862943
has answer: http://stackoverflow.com/a/26863331
accepted answer: http://stackoverflow.com/a/26863331
downvote count: 0
has body: I am trying to get the value/values specified inside an Annotation. eg: If @SuppressWarnings("unchecked") is the annotation, i want to to get the value - unchecked. public boolean visit(SingleMemberAnnotation annotation) { // returns the type name of the annotation - SuppressWarnings annotation.getTypeName(); return true; } Didn't see any methods inside the Annotation class to retrieve the same. Any help/pointers are appreciated
has answer: http://stackoverflow.com/a/26862988
has answer: http://stackoverflow.com/a/26863615
possible better answer: http://stackoverflow.com/a/26862961
favorite count: 0
has title: Getting value from Annotation
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse-jdt
upvote count: 1
has answer: http://stackoverflow.com/a/26862961
type: Question
tagged with: abstract-syntax-tree

http://stackoverflow.com/comment/42337795
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26891683
has text: Can you just use a `HBox` instead?

http://stackoverflow.com/comment/42321204
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26844493
has text: My point is that you use it during compilation but you remove it during packaging. (or for testing, delete it from the war/web-inf/lib after you have compiled).

http://stackoverflow.com/a/26966624
upvote count: 2
has body: did you mean something like this Collections.sort(PL, new Comparator&lt;FootballClub&gt;() { @Override public int compare(FootballClub footballClub1, FootballClub footballClub2) { return footballClub1.inName.compareTo(footballClub2.inName); } });
type: Answer
answers question: http://stackoverflow.com/q/26966397
score: 2
downvote count: 0

http://stackoverflow.com/q/26852650
tagged with: null
answer count: 1
has comment: http://stackoverflow.com/comment/42268235
tagged with: pointers
favorite count: 0
has body: I guess I am way of with my code, so you dont need to look to much into that, just check the first lines of code.I cant understand what is wrong with where the error happens. public boolean add(E x) { System.out.println(x); System.out.println(root); if(root.equals(null)){ root.equals(x); return true; } if(root.equals(x)){ return false; } BinaryNode&lt;E&gt; save = root; //create new nod copy of root while((!save.left.equals(x)) &amp;&amp; (!save.left.equals(null))){ //check so save.nex isnt x and that save.next exists save=save.left; } if(save.left.equals(null)){ save = root; //puts save back to root again while((!save.right.equals(x)) &amp;&amp; (!save.right.equals(null))){ save=save.right; } if(save.right.equals(null)){ save.right.equals(x); return true; } } return false; } I get the error at the line if(root.equals(null)){ It's just an if statement, I am not trying to acess something that doesnt exist??
tagged with: binary-search-tree
has title: binary search tree null pointer exception
has answer: http://stackoverflow.com/a/26852989
downvote count: 2
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26852989
tagged with: tree
type: AnsweredQuestion
tagged with: java
score: -1

http://stackoverflow.com/q/26965134
has comment: http://stackoverflow.com/comment/42505711
type: UnansweredQuestion
has body: Hey guys I am trying to initialize this piece of code ClassCastException. I read a little about it, but I can't seem to understand why my code doesn't work. public MyHash(HashFunction&lt;KeyType&gt; h1, HashFunction&lt;KeyType&gt; h2){ this.hash1 = h1; this.hash2 = h2; this.arr = (Node&lt;KeyType, ValueType&gt;[])new Object[DEFAULT_ARRAY_SIZE]; } private static class Node&lt;KeyType, ValueType&gt;{}
upvote count: 0
tagged with: java
favorite count: 0
tagged with: nodes
type: Question
has answer: http://stackoverflow.com/a/26986308
tagged with: hashmap
score: -1
tagged with: data-structures
has comment: http://stackoverflow.com/comment/42467812
has title: Fixing a ClassCastException in a HashMap
answer count: 1
downvote count: 1

http://stackoverflow.com/q/26859706
has answer: http://stackoverflow.com/a/26859854
accepted answer: http://stackoverflow.com/a/26859854
has body: I was wondering if somebody could help me on that topic, I'm currently trying to do a kind of fuzzy matching. Basically I wan't to derive relationships from unstructured text and identified common patterns for these relationships. Nevertheless the input strings are a bit arbitrary - as usual to human produced input. E.g. this two input strings: ENTITY is typically bigger than ENTITY ENTITY is ... a few other words... bigger than ENTITY I've successfully to matched those two strings with the following regex: (ENTITY) is (.+?(?=bigger))bigger than (ENTITY) But since .+? matches everything up to it reaches bigger there can be an arbitrary amount of words in between "is" and "bigger". This leads to false matches in certain cases therefore I want to limit the number of "words" in between "is" and "bigger". I've defined a word as a at least one non whitespace followed by at least one whitespace character. I know that this is not actually a word but for my purpose it should be ok. If i want to match e.g. up to 5 words this would be (\S+\s+){0,5} Combining this with the previous regex leads me to (ENTITY) is ((\S+\s+){0,5}?(?=bigger))bigger than (ENTITY) But this does not work out. Can somebody give me advice on this? Can I actually match this with regex? This is a Java Project. For readability I've removed the escaping backslashes in the regex patterns.
has comment: http://stackoverflow.com/comment/42280379
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42280420
type: Question
has comment: http://stackoverflow.com/comment/42280243
has title: Regex - how to match a certain number of arbitrary words followed by a specific Word
upvote count: 1
answer count: 1
tagged with: regex
favorite count: 0
tagged with: pattern-matching

http://stackoverflow.com/a/26924704
has body: You have to 1. Create a custom adapter class 2. With custom adapter, you will create custom view for each row, 3. In getView method of adapter you can change background color as you wish, just like you did to listView.
answers question: http://stackoverflow.com/q/26924654
downvote count: 0
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/26836798
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26837018
score: 0
tagged with: android
has title: (Android) Cookie problems in HttpClient, URL and HttpURLConnection
has body: I am going to add a captcha validation in the registration form in android apps. But I found that server gives signal to me that there is no session. Finally, I found that the cookie of my application stored nothing. I cannot register account even though the validation is correct. I am sure that there is no problem in my php server because I have tested that in browser. I have made three types of connection to test the cookie issue. 1) HttpClient HttpResponse response = httpclient.execute(httppost); 2) URL Bitmap bitmap = BitmapFactory.decodeStream((InputStream)new URL("http://www.example.com/abc.png").getContent()); 3) HttpURLConnection private void send_post(HttpURLConnection connection,String variable_set) throws Exception { connection.setDoOutput(true); connection.setDoInput(true); connection.setInstanceFollowRedirects(false); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("charset", "utf-8"); connection.setRequestProperty("Content-Length", "" + Integer.toString(variable_set.getBytes().length)); connection.setUseCaches(false); DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); wr.writeBytes(variable_set); wr.flush(); wr.close(); } Also, I add this code to setup cookie. CookieManager cookieManager = new CookieManager(); CookieHandler.setDefault(cookieManager); Unfortunately, only HttpURLConnection successes to use cookie and server shows there are some session variables. Yet, my application is mainly using URL and HttpClient. Could anyone tell me how to enable cookie in HttpClient and URL?
type: UnansweredQuestion
tagged with: php
tagged with: captcha
tagged with: cookies
tagged with: java

http://stackoverflow.com/q/26882183
has body: Currently I'm using the code present in http://www.apkbus.com/android-178853-1-1.html for handling listview swipe.It works very well for right to left swipe but I'm unable to make it work for left to right swipe. Your Help would be appreciated ty. Below is the few piece of code from the example public boolean onTouch(final View view, MotionEvent event) { if (mViewWidth &lt; 2) { mViewWidth = mListView.getWidth(); smallWidth = mViewWidth/7; textwidth2 = mViewWidth/3; textwidth = textwidth2; largewidth = textwidth+textwidth2; } int tempwidth = 0; if(SwipeType==1) tempwidth = smallWidth; else tempwidth = textwidth2; switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: { if (mPaused) { return false; } Rect rect = new Rect(); int childCount = mListView.getChildCount(); int[] listViewCoords = new int[2]; mListView.getLocationOnScreen(listViewCoords); int x = (int) event.getRawX() - listViewCoords[0]; int y = (int) event.getRawY() - listViewCoords[1]; ViewGroup child; for (int i = 0; i &lt; childCount; i++) { child = (ViewGroup) mListView.getChildAt(i); child.getHitRect(rect); if (rect.contains(x, y)) { mDownView_parent = child; mDownView = (ViewGroup) child.findViewById(R.id.list_display_view_container); if(mDownView_parent.getChildCount()==1){ textheight = mDownView_parent.getHeight(); if(SwipeType==Dismiss){ HalfColor = singleColor; HalfDrawable = activity.getResources().getDrawable(R.drawable.content_discard); } SetBackGroundforList(); } if(old_mDownView!=null &amp;&amp; mDownView!=old_mDownView){ ResetListItem(old_mDownView); old_mDownView=null; return false; } break; } } if (mDownView != null) { mDownX = event.getRawX(); mDownPosition = mListView.getPositionForView(mDownView); mVelocityTracker = VelocityTracker.obtain(); mVelocityTracker.addMovement(event); } else { mDownView = null; } //mSwipeDetected = false; temp_position = mListView.pointToPosition((int) event.getX(), (int) event.getY()); view.onTouchEvent(event); return true; } case MotionEvent.ACTIO…
tagged with: android
has comment: http://stackoverflow.com/comment/42320118
score: 0
tagged with: java
has title: Android list view to handle only Left swipes
has comment: http://stackoverflow.com/comment/42320333
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: android-listview

http://stackoverflow.com/a/26889635
has comment: http://stackoverflow.com/comment/42333496
downvote count: 0
has comment: http://stackoverflow.com/comment/42359951
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42333423
type: Answer
has comment: http://stackoverflow.com/comment/42333556
has body: Seems like your raceDice.getSum() return type is void.
accepted answer of: http://stackoverflow.com/q/26889560
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26889560
has comment: http://stackoverflow.com/comment/42486432

http://stackoverflow.com/comment/42293136
has text: see http://pastebin.com/Whcue12w
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26864092
type: QuestionComment

http://stackoverflow.com/comment/42465304
comment on: http://stackoverflow.com/q/26963690
type: QuestionComment
has text: Try declaring `Bucket` as `private class Bucket<K,V> {`, then you can use something like `private Bucket<K,V> buckets[];` and `buckets = new Bucket[10];`...
type: Comment
score: 1

http://stackoverflow.com/comment/42517605
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26991962
has text: I cant comment, since my points are less than 50. And HogRider asked for a link and thats why added there.
type: AnswerComment

http://stackoverflow.com/q/26856400
answer count: 0
has comment: http://stackoverflow.com/comment/42275548
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42275069
has comment: http://stackoverflow.com/comment/42274778
tagged with: java
has body: I try to compare two strings in Java as the following: String a="String 1"; String b = "String 1"; if(a==b) { System.out.println("Equal"); } else System.out.println("Not Equal"); System.out.println("----------------"); if(a.equals(b)) System.out.println("Equal"); else System.out.println("Not Equal"); I got warning message in NetBeans when I use a==b. Why it like this? But, when I use equals, it has no problem.
duplicate of: http://stackoverflow.com/q/513832
has title: Why I get warning message in NetBeans when I use == to compare two strings?
type: Question
has comment: http://stackoverflow.com/comment/42274866
has comment: http://stackoverflow.com/comment/42274928
score: 0
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/a/26889959
score: 0
answers question: http://stackoverflow.com/q/26889885
type: Answer
has body: Even though you are creating an instance of square, you are assigning it to shape, which is the superclass. And it does not have the function defined, and hence the compilation error. Instead of shape newObject=new square(); use: square newObject=new square();

http://stackoverflow.com/q/26951194
tagged with: android
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26951204
type: AnsweredQuestion
has title: Why aren't my buttons working?
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26951204
tagged with: eclipse
has body: So I recently made my first app and went out to test it. When I opened the app on my phone I got 2 problems. The menu off my app does have 3 buttons, 1 to start a "1player game" 1 to start a "2player game" and 1 to exit the app. When I press the button to play a "1player game" there happens nothing. When I press the "2player game" button, the app closes with the error "unfortunately testjk was closed". I have literally no idea what I did wrong in my code. I also have no erros in my problems tab. Some help would be appreciated. MainMenuScreen.java: package com.wouter.testjk; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; public class MainMenuScreen extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main_menu); //1player findViewById(R.id.two_player).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Log.d("DEBUG", "One Player Button Pressed!"); Intent intent = new Intent(MainMenuScreen.this, TicTacToeGame.class); intent.putExtra("gameType", true); startActivityForResult(intent, 0); } }); //2players findViewById(R.id.two_player).setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Log.d("DEBUG", "Two Player Button Pressed!"); Intent intent = new Intent(MainMenuScreen.this, TicTacToeGame.class); intent.putExtra("gameType", false); startActivityForResult(intent, 0); } }); //exit game findViewById(R.id.exit_game).setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Log.d("DEBUG", "Exit Game Button Pressed!"); MainMenuScreen.this.finish(); } }); } } MainActivity.java: package com.wouter.testjk; import android.app.Activity; import android.graphics.Color; impor…
type: Question
downvote count: 0
upvote count: 1

http://stackoverflow.com/comment/42410436
type: QuestionComment
type: Comment
has text: Don't hand-write servlets. Use Spring MVC or Jersey to handle all of that low-level detail for you.
comment on: http://stackoverflow.com/q/26932676
score: 0

http://stackoverflow.com/q/26895439
score: 0
has answer: http://stackoverflow.com/a/26895493
type: AnsweredQuestion
has body: I use Spring security in this question but its knowledge might not be required to answer this question. I am trying to understand how Spring security's blowfish encryption class (BCrypt) verifies a given password. I tried to : Generate a Salt with BCrypt.gensalt(10); Encode a password using this salt with BCrypt.hashpw(clearText, salt). It worked well.Then, I wanted to store the used salt in the database in order to be able to reuse it when the users enter a password. I realized that BCryptPasswordEncoder does not use the salt when it checks the password. Instead, it crypts the password with its hashed password as salt : public boolean matches(CharSequence rawPassword, String encodedPassword) { [...] return BCrypt.checkpw(rawPassword.toString(), encodedPassword); } So I tried this piece of code : public static void main(String[] args) { String salt = BCrypt.gensalt(12); String clearText="test"; String hashed = BCrypt.hashpw(clearText, salt); String reHashed = BCrypt.hashpw(clearText, hashed); System.out.println("salt : " + salt); System.out.println(hashed); System.out.println(reHashed); } output : salt : $2a$12$gzUymsNBoW.f1OfkLpb2se $2a$12$gzUymsNBoW.f1OfkLpb2seFZrniorawujSOp6Qe.PWDIHJvmYSP6y $2a$12$gzUymsNBoW.f1OfkLpb2seFZrniorawujSOp6Qe.PWDIHJvmYSP6y This seems to confirm that : good password =&gt; hashed = hash(clearPassword, hashed) Am I understanding it wrong? Does it mean that the salt is useless for password checking? Hence, does it mean that I do not need to store the salt in database?
tagged with: java
tagged with: blowfish
type: Question
accepted answer: http://stackoverflow.com/a/26895493
has title: Blowfish password verifying
answer count: 1
tagged with: spring-security

http://stackoverflow.com/comment/58145861
has text: Java 8 and later **now has such a parser built-in**, in the java.time framework. See [my Answer](http://stackoverflow.com/a/26905439/642706).
comment on: http://stackoverflow.com/a/26899623
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/73547131
has body: I solved it by adding spring.jpa.generate-ddl=true spring.jpa.hibernate.ddl-auto=update spring.jpa.defer-datasource-initialization=true
downvote count: 0
answers question: http://stackoverflow.com/q/26881739
score: 6
type: Answer
upvote count: 6

http://stackoverflow.com/comment/42352742
comment on: http://stackoverflow.com/q/26900012
score: 0
type: Comment
type: QuestionComment
has text: whats the exact problem?

http://stackoverflow.com/q/26909362
tagged with: apache
downvote count: 0
tagged with: jsp
has title: Getting error while accessing webservices through apache axis2
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: web-services
score: 2
answer count: 0
tagged with: java
tagged with: apache-axis
type: Question
has body: The following is the error, can anybody help me in fixing this error. Is this any package missing error? org.apache.jasper.JasperException: Unable to compile class for JSP: An error occurred at line: 47 in the jsp file: /axis2-web/include/httpbase.jsp The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files 44: public String calculateHttpBase(HttpServletRequest aRequest) { 45: StringBuffer stringBuffer = new StringBuffer(); 46: if (frontendHostUrl != null) { 47: stringBuffer.append(frontendHostUrl); 48: } else { 49: String scheme = aRequest.getScheme(); 50: stringBuffer.append(scheme); Any help?

http://stackoverflow.com/comment/42438551
type: Comment
type: QuestionComment
has text: Android 4.2.2 and 4.4.2 so far. I don't use any Spans at all in my code (don't even know what they are...).
score: 0
comment on: http://stackoverflow.com/q/26948302

http://stackoverflow.com/q/26843567
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26843687
has comment: http://stackoverflow.com/comment/42250681
type: Question
has comment: http://stackoverflow.com/comment/42250779
has body: The variable view of Eclipse Java Debug mode allows to inspect the values of variables. If the type of a variable has several sub-types, how to find out the actual type of the value? Eclipse Standard/SDK Version: Luna Service Release 1 (4.4.1) Build id: 20140925-1800
score: 4
answer count: 3
has answer: http://stackoverflow.com/a/63629200
accepted answer: http://stackoverflow.com/a/26843687
tagged with: debugging
has title: Eclipse Java debug mode: how to get actual type of value?
possible better answer: http://stackoverflow.com/a/26843803
tagged with: java
has answer: http://stackoverflow.com/a/26843803
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42250454
upvote count: 4

http://stackoverflow.com/comment/42492072
has text: I'm new to RSA but will try to help. If you generated a p value, then q must be larger than p+2^512 to get the difference of 2^512..so If you can have a look from SecureRandom class and can somehow use one of the methods like next() or nextBytes() https://docs.oracle.com/javase/7/docs/api/java/security/SecureRandom.html which specify the next random number generated, it might help I dunno
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26978189
score: 0

http://stackoverflow.com/comment/42242311
comment on: http://stackoverflow.com/q/26838145
score: 0
type: QuestionComment
type: Comment
has text: @harsha posting your code for constructing the table might help you to get the answer

http://stackoverflow.com/a/26854997
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26854631
answers question: http://stackoverflow.com/q/26854631
score: 1
upvote count: 1
has body: I implemented a sample application a while ago that displays a list of currently installed applications. It uses getInstalledApplications() as Commonsware suggests. You can find a link to the application's source code in this blog post.
type: AcceptedAnswer

gmail
type: Tag
tags question: http://stackoverflow.com/q/26935737
tag name: gmail

http://stackoverflow.com/a/63243173
downvote count: 0
has body: Kotlin solution. Improvement over @Pulkit Goyal private fun zoomToMultipleGeoCoordinates(boundingList: List&lt;GeoCoordinates&gt;, isPaddingRequired: Boolean) { var north = Double.MIN_VALUE var south = Double.MAX_VALUE var east = Double.MIN_VALUE var west = Double.MAX_VALUE boundingList.forEach { loc -&gt; north = loc.latitude.coerceAtLeast(north) south = loc.latitude.coerceAtMost(south) west = loc.longitude.coerceAtMost(west) east = loc.longitude.coerceAtLeast(east) } if (isPaddingRequired) { val padding = 0.01 north += padding south -= padding west -= padding east += padding } return BoundingBox.fromLngLats(west, south, east, north) }
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26891776

http://stackoverflow.com/a/29627222
downvote count: 0
score: 6
accepted answer of: http://stackoverflow.com/q/26939140
type: Answer
answers question: http://stackoverflow.com/q/26939140
upvote count: 6
has body: Why do you write each message per line? I think you can just use writeDelimitedTo, then the messages can write one by one. And reading is very simple. User user = User.newBuilder().setUid(1).build(); User user2 = User.newBuilder().setUid(2).build(); try { FileOutputStream output = new FileOutputStream(path); user.writeDelimitedTo(output); user.writeDelimitedTo(output); user2.writeDelimitedTo(output); output.close(); } catch (Exception e) { System.out.print("Write error!"); } try { FileInputStream input = new FileInputStream(path); while (true) { User user_ = User.parseDelimitedFrom(input); if (user_ == null) break; System.out.println("read from file: \n" + user_); } } catch (Exception e) { System.out.println("Read error!"); }
has comment: http://stackoverflow.com/comment/47397606
type: AcceptedAnswer

http://stackoverflow.com/q/26883735
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42383404
accepted answer: http://stackoverflow.com/a/26885536
tagged with: weblogic
has title: convert weblogic admin server into managed server
score: 0
answer count: 1
favorite count: 0
has body: I'm currently having 2 Weblogic admin servers in 2 different domains created on the same machine. I want to convert one of the admin server to a managed server and then use them together to deploy a Java application. Is this feasible? If yes, how? I'm currently using Weblogic Server 10.3. PS: I'm quite new to Weblogic domain creation and administration. Please revert for any more details needed.
has answer: http://stackoverflow.com/a/26885536
upvote count: 1
downvote count: 1

http://stackoverflow.com/a/26976222
has body: I don't see why it isn't possible. Infact there is a docker-jboss-jrebel container publicly available already. I have not tested it myself so I can't say for sure if there are issues.Have your tried running JRebel? did you see any problems?
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26922606
has comment: http://stackoverflow.com/comment/42500806
has comment: http://stackoverflow.com/comment/42497821
has comment: http://stackoverflow.com/comment/42498265
accepted answer of: http://stackoverflow.com/q/26922606
has comment: http://stackoverflow.com/comment/42505626

http://stackoverflow.com/comment/42436216
score: 0
has text: if the asker expects there to be a value other than zero, yes. And i was only focusing on the switch, others have touched on the heart of the problem, which is that the asker is recreating the array in each method call.
type: Comment
comment on: http://stackoverflow.com/a/26947031
type: AnswerComment

http://stackoverflow.com/q/26980932
accepted answer: http://stackoverflow.com/a/26981197
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42496174
downvote count: 1
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/42496190
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26981197
has body: I have a LinkedList populated with 500,000 or more of my items. These objects have within two coordinates (x, y) set randomly. Then I have a variable of type Double (radius) that contains a value. The algorithm should give me back a LinkedList containing only objects (selected from 500,000), which are within the range set in the variable. Obviously, the algorithm will need to know what are my coordinates that correspond to the middle of the beam, is then instantiated in part an object that corresponds to myself. Can someone help me make this algorithm in the form of code java / Android? Thanks !! This is my algorithm, but with 500000 elements takes too long: double radius = 0; String text = search_distance.getText().toString(); if (text.equals("")) { ArrayAdapter&lt;Users&gt; adapter = new MyUsersAdapter(); elenco.setAdapter(adapter); } else { try { radius = Double.parseDouble(text); } catch(NumberFormatException e){ Log.e("DEBUG", "Errore: " + e); } if(!Double.isNaN(radius) &amp;&amp; radius &gt; 0) { List&lt;Users&gt; listaTemporanea = new LinkedList&lt;Users&gt;(); for(int i = 0; i &lt; utenti.size(); i++){ if(utenti.get(i).getX() &lt; radius &amp;&amp; utenti.get(i).getY() &lt; radius) { if(getDistance(utenti.get(i), io) &lt; radius) { listaTemporanea.add(utenti.get(i)); } } }`
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42496068
tagged with: android
has comment: http://stackoverflow.com/comment/42496111
has title: Selection algorithm elements within a LinkedList. Java/Android

http://stackoverflow.com/q/26917468
tagged with: java
tagged with: lwjgl
type: Question
has body: I'm using LWJGL with Slick Util in my game. But now I can't make Russian locale because slick.TrueTypeFont doesn't render Cyrillic letters (Яиssiaп Vodка, Сомяаd, Уер). Does someone know how to fix it?
has title: Non-english letters with Slick Util
tagged with: non-unicode
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27846548
score: 1

http://stackoverflow.com/a/46918655
upvote count: 7
has body: I ran into this same issue and was able to solve it by explicitly specifying the generic type-parameter to map like so: List&lt;Callable&lt;Object&gt;&gt; checks = l.stream(). &lt;Callable&lt;Object&gt;&gt;map(n -&gt; () -&gt; { System.out.println(n); return null; }). collect(Collectors.toList());
answers question: http://stackoverflow.com/q/26872827
downvote count: 0
type: Answer
score: 7

http://stackoverflow.com/q/26974998
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42526198
has body: I am very new on java/android, just worked with processing before. Therefore all those packages, sources, libs are really a problem for me. Right now I would like to load an .obj file using the min3d library. The problem is, that i want to display the .obj on the commmander 3d tablet. Therefore I downloaded an working example for the tablet with a stereoscopic 3d renderer class from this SDK no need to log in. In the package, where in my example cubes are generated, i would like to instead load the .obj. But I get an activity error. I am not sure, if the .obj is found, but i think it should, because if i only load it and do not parse it, i don't get an error. But if I start to parse: "parser.parse();" then the mess begins. The .obj is in this folders: SampleActivity > res > raw > camaro_obj. The next 3 lines aftzer the parse i already uncommented, because at first this should work. But i know already, that the appChild is not avaible. This will be the next problem. Below is the code of the package, the console and the logCat. THANK YOU VERY MUCH!!! best Markus! /* * Copyright (c) 2014. Sun Game Corp. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific * language governing permissions and limitations under the License. */ package com.sungame.sdeck.sample.render; import android.content.Context; import android.opengl.Matrix; import android.view.*; import com.sungame.sdeck.sample.R; import com.sungame.sdeck.sample.model.Scene; import com.sungame.sdeck.sample.shader.ShaderProgram; import com.sungame.sdeck.sample.shader.TextureProgram; /…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42486561
score: 0
has title: 3dmin parse is unable to start activity
tagged with: min3d
tagged with: android

eclipse-plugin
tags question: http://stackoverflow.com/q/26921915
tags question: http://stackoverflow.com/q/26889642
tags question: http://stackoverflow.com/q/26924828
tags question: http://stackoverflow.com/q/26912078
tags question: http://stackoverflow.com/q/26980073
tags question: http://stackoverflow.com/q/26906983
type: Tag
tags question: http://stackoverflow.com/q/26912996
tags question: http://stackoverflow.com/q/26960601
tags question: http://stackoverflow.com/q/26904378
tags question: http://stackoverflow.com/q/26981917
tags question: http://stackoverflow.com/q/26870542
tags question: http://stackoverflow.com/q/26991532
tags question: http://stackoverflow.com/q/26968414
tags question: http://stackoverflow.com/q/26909485
tag name: eclipse-plugin
tags question: http://stackoverflow.com/q/26922316

http://stackoverflow.com/q/26914186
type: Question
has body: I am trying to put some code before and after the main code of a method but I don't know how to it generically? public class A extends Subject { private int attribute1; private int attribute2; public A (int attribute1, int attribute2) { super(); this.attribute1 = attribute1; this.attribute2 = attribute2; } public A copy(){...} public void setAttribute1(int attribute1) { A childBefore = this.copy(); // want it to be generic this.attribute1 = attribute1; this.notify(childBefore, this); // want it to be generic } public void setAttribute2(int attribute2) { A childBefore = this.copy(); // want it to be generic this.attribute2 = attribute2; this.notify(childBefore, this); // want it to be generic } } So basically, I don't want the initialization and the notify part to be defined in each method which need to. I've found one possible solution which consists in define this in a parent class and call Child childBefore = super.before() and super.after(). But it's still repetition, does anyone knows how to make it as much generics as possible?
has comment: http://stackoverflow.com/comment/42377638
has title: How to automatically call some code before and after the main code of a method?
has comment: http://stackoverflow.com/comment/42377841
answer count: 2
has comment: http://stackoverflow.com/comment/42377680
has answer: http://stackoverflow.com/a/26914270
upvote count: 0
has comment: http://stackoverflow.com/comment/42378413
favorite count: 0
has comment: http://stackoverflow.com/comment/42377697
has comment: http://stackoverflow.com/comment/42377488
has answer: http://stackoverflow.com/a/26914370
score: -1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42377557
tagged with: java
has comment: http://stackoverflow.com/comment/42377529
downvote count: 1

http://stackoverflow.com/a/26967520
type: Answer
answers question: http://stackoverflow.com/q/26967393
has body: The problem is confined to this line: Chat chat = mgr.createChat("winnenair",listener); The name "winnenair" needs to be "winnenair@my-pc". One needs to append the domain to the username.
accepted answer of: http://stackoverflow.com/q/26967393
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42476155

http://stackoverflow.com/comment/42324783
has text: That would be wonderful news, but does a static class count as a stateless object? It seems to me it's very much the same but there really is no instanced object. That's exactly my problem because other topics are always about instantiatable classes.
comment on: http://stackoverflow.com/a/26884512
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26840588
tagged with: yodlee
has title: Yodlee IAV - How to exactly use it?
tagged with: java
has body: I have been searching for it that how to use Yodlee IAV APIs(I am using it on salesforce platform) to verify an account. I am using the same parameters that have been specified in the documentation by the Yodlee but every time it is not returning the expected result. I am calling updateItemCredentialsAndStartVerificationDataRequest and addItemCredentialsAndStartVerificationDataRequest. I am using 30 days trial account to explore Yodlee IAV APIs but not able to get how to use them. While calling updateItemCredentialsAndStartVerificationDataRequest, it throws InvalidItemException. {"errorOccurred":"true","exceptionType":"com.yodlee.core.InvalidItemException","referenceCode":"_5e6a8e2b-15c4-45d0-b523-6c64a414b274","message":"Argument value not found: 710636"} and while calling addItemCredentialsAndStartVerificationDataRequest it throws error log. I also tried TestDrive for addItemAndStartVerificationData, it worked there. But when I make this same request using code Apex-Salesforce, giving same params to the Yodlee then it throws this exception. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 415 system_error Is there anything which is different in Yodlee IAV documentation than what you exactly used in TestDrive?
type: Question
tagged with: apex
tagged with: salesforce
score: 0
has answer: http://stackoverflow.com/a/26903337
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/a/26894686
accepted answer of: http://stackoverflow.com/q/26894532
score: 2
answers question: http://stackoverflow.com/q/26894532
downvote count: 0
has body: You seem to be missing some fundamental concepts here. First: you have no "default" .print() method; that is, the base, bare-bones Java class Object has no .print() method. Second: even if it had, what do you expect it to do anyway? Where do you want it to print, what do you want it to print? The first question (where) is answered by classes dedicated to performing output duties (a PrintStream for instance), the second question (what) is answered by implementing your class' .toString(). Since you Account class is obviously not a class dedicated to output duties, you need to do two things: make your Account class override .toString(); use a dedicated output class to print it; the fastest way to do this is to use System.out, which happens to be a PrintStream, which implements a .print() method. Seeing your code it appears that you have a .printAccountDetails() method; this contradicts the Law of Demeter for starters; and note how it uses System.out. Also, the difference between .print() and .println() in a PrintStream (which System.out is) is that a newline will be appended to the output if you use the "ln version"; custom has it that for most text based output channels, this also triggers an output flush from the underlying OS libraries.
upvote count: 2
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42343117

http://stackoverflow.com/a/26956419
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26956379
has comment: http://stackoverflow.com/comment/42452202
downvote count: 0
has body: Sorting linked list is really inefficient, normally you would copy the listing list into an array, sort them and copy them back (this is what the JDK does) BTW Unless you have really sparse indecies, you are better off using an array or array list. This is not only simpler, more efficient and faster, it is also naturally sorted. An array will use a fraction of the memory and of a linked list, even if you have quite a few zero coefficients.
type: Answer
has comment: http://stackoverflow.com/comment/42452187

http://stackoverflow.com/comment/42318223
type: Comment
comment on: http://stackoverflow.com/a/26880701
score: 0
type: AnswerComment
has text: @rickyhitman10 i have edited and made the solution using for loop and array

http://stackoverflow.com/comment/42411035
type: QuestionComment
has text: Can you include the full stacktrace please?
comment on: http://stackoverflow.com/q/26932778
score: 0
type: Comment

http://stackoverflow.com/a/26888819
answers question: http://stackoverflow.com/q/26888579
type: AcceptedAnswer
downvote count: 0
has body: Have a look at css selectors. A good starting point would be Mozilla I tried this simple one one here: http://try.jsoup.org/~GT7K5vyOdnu16ShL7STeB-FdD1o Using this selector: input[type="hidden"] or input[name="csrfmiddlewaretoken"] With this information following the Jsoup api you should be able to call attr(String key) on the retrieved element.
type: Answer
accepted answer of: http://stackoverflow.com/q/26888579
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43238362

http://stackoverflow.com/q/26895274
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26896264
tagged with: eclipse
score: 0
has title: Eclipse Windows App - Getting Started
has comment: http://stackoverflow.com/comment/42344088
answer count: 1
has body: I have to questions in this post. The first one - I can't seem to figure out how build a windows GUI application in Eclipse IDE with Java. I successfully used Eclipse to make a Java Android app after downloading the Android SDK into Eclipse. I want to generate the same app, but now this time for Windows. It seems there is no GUI tool in Eclipse for Windows? Do I need to download additional add-ins for Windows GUI? I thought the GUI tool/widgets used for Android would be the same but this doesn't appear to be the case. I see references to Swing, SWT, WindowBuilder... can someone help me sort out which software needs to be loaded into Eclipse to support Windows GUI development? The 2nd question is how can I take my Java/xml Android App (developed in Eclipse) and compile that code to run on Windows? I assume I will need to create a comparable GUI in the Windows editor (see first question), and then copy the java code into it? Thanks!
type: UnansweredQuestion

http://stackoverflow.com/q/26947741
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26947933
score: 0
has body: I have an ImageView in a Pane, and the pane has been set a MouseEventHandler to do some actions. The ImageView's Image is defined in a CSS file as below: .imageView{ -fx-image: url("image/normal.png"); } .imageView:pressed{ -fx-image: url("/image/press.png"); } Under normal status, the ImageView's image is 'normal.png'. When the user presses the ImageView, its image will be changed to 'press.png'. Then, when released, its image will be changed back to 'normal.png'. However, if the user does not press on the ImageView's image exactly, even though Pane's MouseEvent is trigged, the image will not be changed. How can I do to change ImageView's image when its parent Pane is pressed. For instance, on Android, the image will be switched automatically. It is very convenient.
answer count: 1
tagged with: android
has title: JavaFX8 How to pass the "press" status to child?
has answer: http://stackoverflow.com/a/26947933
tagged with: java
tagged with: javafx
type: Question

http://stackoverflow.com/comment/88379637
type: AnswerComment
type: Comment
has text: Also the `GDK_SCALE` environment variable needs to be set to something larger than `1`.
score: 4
comment on: http://stackoverflow.com/a/49115259

http://stackoverflow.com/q/26953422
accepted answer: http://stackoverflow.com/a/26953575
type: AnsweredQuestion
tagged with: linked-list
has comment: http://stackoverflow.com/comment/42447589
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Java LinkedList removing the last node
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42447275
has answer: http://stackoverflow.com/a/26953575
favorite count: 0
possible better answer: http://stackoverflow.com/a/26953573
has body: I have a Java class which consists of a node list, WordNode, which has the attributes of the class Word and a WordNode object called next used as reference to the next node, as follows: class WordNode { Word word; WordNode next; WordNode(Word w) { word = w; next = null; } Word getWord() { return word; } } And the class Word has a String called name: class Word { String name; Word(String n) { this.name = n; } public String getName() { return name; } public void setName(String n) { name = n; } } I have a class which is a custom LinkedList to which I must add and remove words by specifying the word name. I am able to add without problems, but when I want to delete I have some issues. Below is the method to delete: boolean remove(Word w) { WordNode wm = new WordNode(w); if (list == null) return false; //can't delete on an empty list else { WordNode aux = list; while(aux != null) { if (wm.word.getName().compareTo(aux.word.getName()) == 0 ) //if the word to delete is found { if (aux.next == null) //to erase the last element { aux = null; } else { aux.word.setName(aux.next.word.getName()); //set current node's name to equal next node's WordNode temp = aux.next.next; aux.next = null; //to erase current node aux.next = temp; //re-refer } return true; } else aux = aux.next; } return false; //reachable if word is not found } } Where list is supposed to be the LinkedList that holds all the nodes. aux is an auxiliary list that will cycle through the list to avoid un-linking. So, if I choose to remove a WordNode I compare names. It is actually removing well when the node is at any place, except the last node: if (aux.next == null) //to erase the last element { aux = null; } I'm hoping to make that node null to mark a new end to the list, but it doesn't get erased. What could I change to erase the last element? Thank you for any help/suggestions in advance
has comment: http://stackoverflow.com/comment/42447155
has answer: http://stackoverflow.com/a/26953573

http://stackoverflow.com/comment/42471926
has text: OK, Thank you. What about moving the "entire" code inside the `ComponentListener`s into another methods, so I can call these methods whenever I want? and, I am using Netbeans GUI builder.
type: AnswerComment
comment on: http://stackoverflow.com/a/26967267
score: 0
type: Comment

http://stackoverflow.com/q/26965216
possible better answer: http://stackoverflow.com/a/26965653
has comment: http://stackoverflow.com/comment/42467955
accepted answer: http://stackoverflow.com/a/26965693
type: AnsweredQuestion
tagged with: jsp
favorite count: 0
type: Question
answer count: 2
has title: How to detect double click on JSP
has body: how can I make my jsp page detect a double click on the submit button. I am trying to do a simple print out message to check if a user has double clicked the submit button. something like : &lt;%***if user double clicks submit{ System.out.println("doubleClick");` }***%&gt; -Newbie trying to learn java programming.
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26965693
has answer: http://stackoverflow.com/a/26965653
upvote count: 1
has comment: http://stackoverflow.com/comment/42468017
downvote count: 1

http://stackoverflow.com/q/26946175
has comment: http://stackoverflow.com/comment/42434802
score: 1
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26946245
type: Question
upvote count: 4
answer count: 2
has body: I would like to try and loop through this following byte array: public byte[] mFFTBytes; How would I go about doing this in java with a for loop? Thanks in advance!
has title: Looping through byte array - java
has answer: http://stackoverflow.com/a/26946193
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42428594
comment on: http://stackoverflow.com/a/26942333
type: Comment
has text: @AlexLockwood The backstack is generated as new activities are started, there are 6 or 7 different types of activities, and I switch between them via intent = new Intent(context, SomeActivity.class); context.startActivity(intent);
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42236184
has text: The question is low quality and it doesn't demonstrate attempt or reasearch at this stage. Strongly recommend you edit the question to demonstrate what the attempt has been and problem you are facing, or remove question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26835108

http://stackoverflow.com/comment/42251859
type: QuestionComment
comment on: http://stackoverflow.com/q/26841523
has text: @Aman Agnihotri check this image : https://i.sstatic.net/K9HLZ.jpg
score: 0
type: Comment

http://stackoverflow.com/a/26903982
has body: javascript:resizeTo(1024,768); vbscript:resizeto(1024,768) Will work in IE7, But consider using something like javascript:moveTo(0,0);resizeTo(1024,768); because IE7 doesn't allow the window to "resize" beyond the screen borders. If you work on a 1024,768 desktop, this is what happens... Firefox: 1024x768 Window, going behind the taskbar. If you drop the moveTo part, the top left corner of the window won't change position.(You still get a 1024x768 window) IE7: As close as possible to the requested size without obscuring the taskbar or allowing any part of the window to lie beyond the screen borders. safari: As close as possible to the requested size without obscuring the taskbar or allowing any part of the window to lie beyond the screen borders, but you can ommit the moveTo part. Safari will move the top left corner of the window for you. Opera: Nothing happens. Chrome: Nothing happens. This quote is from: Tolle you can find his post here: How do you resize an IE browser window to 1024 x 768 Hopefully this is help full to you!
downvote count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42399106
has comment: http://stackoverflow.com/comment/42359620
type: Answer
answers question: http://stackoverflow.com/q/26902297

http://stackoverflow.com/a/26853124
answers question: http://stackoverflow.com/q/26846329
downvote count: 0
has comment: http://stackoverflow.com/comment/42300996
score: 5
type: AcceptedAnswer
has body: IDEA should remove any dependencies removed from the POM assuming they were initially add via the POM (and only via the POM). If you manually added a dependency, it will stick around. Here are some things you can do to resolve the issue: 1) Run a reimport from the maven tool window. Wait for it to finish (watch the progress in the status bar at the bottom right). Then immediately run it a second time. Although I normally don't like answers like this, a couple of time I have seen cases that it takes a double import in a row for IDEA to properly resolve a modified POM. 2) Go into the Project Structure dialog, and select 'Libraries' under the , "Project Settings" label on the left. (not 'Global Libraries, but just 'Libraries') Look for the unwanted dependencies. In line search should work. (Note: if the dependency does not start with "Maven:", then it was not added by maven). Select it and remove it. Once they are all gone, close out and reimport the maven project. See if they return. If so, they are getting pulled in from some where. 3) You mentioned you ran a dependency tree, so that would seem to indicate maven is not pulling in the dependency. To double check this and be absolutely sure, I recommend you use the Maven Helper plugin. Install it from the Plugin settings dialog and restart IDEA. After restarting, go to your pom file. At the bottom you will now have a 'Dependency Analyzer' tab. Select it. Then select "All Dependencies" at the top. Search for logback. If is is found, select it, and on the right you will see an inverse tree of how it is pulled in. For example, for hamcrest, I see the following, telling me junit is pulling it in.: Do this for all your pom files.
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/26846329

http://stackoverflow.com/a/68147942
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26897791
has body: You are subtracting userbet from startingSum in every iteration and checking the condition with userTotatl. You need to assign as follows: userTotal = startingSum (Before the loop); and inside the loop userTotal-= userbet;

http://stackoverflow.com/comment/42431579
has text: If your requests are on different connections check the [isolation level](http://en.wikipedia.org/wiki/Isolation_(database_systems)) you're using. Databases with isolation levels above read committed will lock on SELECT's.
comment on: http://stackoverflow.com/q/26939003
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26937810
has title: Docker port isn't accessible from host
score: 6
has comment: http://stackoverflow.com/comment/72204504
upvote count: 6
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/42538046
tagged with: java
has comment: http://stackoverflow.com/comment/42502950
has body: I have a new Spring Boot application that I just finished and am trying to deploy it to Docker. Inside the container the application works fine. It uses ports 9000 for user facing requests and 9100 for administrative tasks like health checks. When I start a docker instance and try to access port 9000 I get the following error: curl: (56) Recv failure: Connection reset by peer After a lot of experimentation (via curl), I confirmed in with several different configurations that the application functions fine inside the container, but when I try to map ports to the host it doesn't connect. I've tried starting it with the following commands. None of them allow me to access the ports from the host. docker run -P=true my-app docker run -p 9000:9000 my-app The workaround The only approach that works is using the --net host option, but this doesn't allow me to run more than one container on that host. docker run -d --net=host my-app Experiments with ports and expose I've used various versions of the Dockerfile exposing different ports such as 9000 and 9100 or just 9000. None of that helped. Here's my latest version: FROM ubuntu MAINTAINER redacted RUN apt-get update RUN apt-get install openjdk-7-jre-headless -y RUN mkdir -p /opt/app WORKDIR /opt/app ADD ./target/oauth-authentication-1.0.0.jar /opt/app/service.jar ADD config.properties /opt/app/config.properties EXPOSE 9000 ENTRYPOINT java -Dext.properties.dir=/opt/app -jar /opt/app/service.jar Hello World works To make sure I can run a Spring Boot application, I tried Simplest-Spring-Boot-MVC-HelloWorld and it worked fine. Netstat Results I've used netstat to do port scans from the host and from the container: From the host root@my-docker-host:~# nmap 172.17.0.71 -p9000-9200 Starting Nmap 6.40 ( http://nmap.org ) at 2014-11-14 19:19 UTC Nmap scan report for my-docker-host (172.17.0.71) Host is up (0.0000090s latency). Not shown: 200 closed ports PORT STATE SERVICE 9100/tcp open jetdirect MAC Address: F2:1A:ED:F4:07:7A (Unkno…
type: Question
has answer: http://stackoverflow.com/a/26941585
answer count: 2
downvote count: 0
tagged with: docker
linked to: http://stackoverflow.com/q/26543787
tagged with: linux
has answer: http://stackoverflow.com/a/31039789
tagged with: curl
favorite count: 0
has comment: http://stackoverflow.com/comment/42421327
type: UnansweredQuestion

http://stackoverflow.com/a/26898541
score: 0
has body: Lots of issues here. Try this and see if you can make it work from here. static String[] consonant = {"q","w","r","t","p","s","d","f" ,"g","h","j","k","l","z","x", "c","v","b","n","m"}; //0-19 static String[] vovel = {"a","e","y","u","i","o"};//0-5 for(int i=0;i&lt;3;) { Random generator = new Random(); int random1 = generator.nextInt(19); word = new StringBuffer(st).insert(x, consonant[random1]).toString(); x++; Random generatora = new Random(); int random2 = generatora.nextInt(5); word = new StringBuffer(st).insert(y, vovel[random2]).toString(); y++; } System.out.println(word); }
type: Answer
answers question: http://stackoverflow.com/q/26898397

http://stackoverflow.com/q/26878923
has body: I've created a java web with login information account(username, password). Now i want to connect to Database using MySQL ver5.6. I already have the database with id, userName, password. package dao; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public abstract class DBConnectionDAO { /** Connection */ protected Connection connection; /** className */ private String className = "com.mysql.jdbc.Driver"; /** stringConnection */ private String stringConnection = "jdbc:mysql://localhost/test?user=root&amp;password=abc123&amp;characterEncoding=UTF-8"; /** * @Constructor Phuong thuc khoi tao */ public DBConnectionDAO() { try { Class.forName(className); // Open connection connection = DriverManager.getConnection(stringConnection); } catch (ClassNotFoundException e) { System.err.println("Class not found! Please review your library"); } catch (SQLException e) { e.printStackTrace(); System.err.println("Loi truy van"); } } }
type: Question
score: 0
answer count: 1
tagged with: web
has title: Connect web java to database system using MySQL
has answer: http://stackoverflow.com/a/26878999
type: UnansweredQuestion
tagged with: mysql
tagged with: logging
tagged with: java
tagged with: database

http://stackoverflow.com/comment/42399798
score: 0
type: AnswerComment
type: Comment
has text: Editted, this will loop until a, then the while loop finishes and function returns a.
comment on: http://stackoverflow.com/a/26926792

http://stackoverflow.com/q/26976370
has body: I was a newbie, so sorry for my silly question. Here's the error: Test.java:19: error: variable y might not have been initialized Just wondering how I can retain the value of 'y' without changing everything else outside the conditional block. I know (but not really) why this is erroring, because 'y' isn't defined outside the else block. import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner kb = new Scanner(System.in); int x, y; System.out.print("enter value: "); x = kb.nextInt(); if (x != 5) { System.out.println("invalid value"); System.exit(0); } else { y = 10; } System.out.println("y = " + y); } }
favorite count: 0
tagged with: integer
answer count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: loops
accepted answer: http://stackoverflow.com/a/26976461
type: Question
has answer: http://stackoverflow.com/a/26976420
has answer: http://stackoverflow.com/a/26976425
tagged with: if-statement
has comment: http://stackoverflow.com/comment/42487589
has title: Initialization outside of conditionals
score: -1
has answer: http://stackoverflow.com/a/26976395
has answer: http://stackoverflow.com/a/26976461
downvote count: 1
possible better answer: http://stackoverflow.com/a/26976395

http://stackoverflow.com/comment/42460468
type: Comment
comment on: http://stackoverflow.com/a/26960550
score: 0
has text: Thanks for the continued response but my struggle is with Jackson not the object model. The same information (name and email address) shows up in different parts of the API in different formats: sometimes wrapped and sometimes not, and with different field names. Whatever I choose as my object design I will have this issue, and it's an issue which is usually tackled in Jackson with `@JsonUnwrapped` but that doesn't play nicely with custom serializers. Hence the question if there is something equivalent I can do with the custom serializer.
type: AnswerComment

hashmap
tags question: http://stackoverflow.com/q/26836168
tags question: http://stackoverflow.com/q/26952639
tags question: http://stackoverflow.com/q/26847081
tags question: http://stackoverflow.com/q/26902801
tags question: http://stackoverflow.com/q/26948661
tags question: http://stackoverflow.com/q/26971127
tags question: http://stackoverflow.com/q/26950218
tags question: http://stackoverflow.com/q/26915079
tags question: http://stackoverflow.com/q/26837586
tags question: http://stackoverflow.com/q/26980040
tags question: http://stackoverflow.com/q/26923155
tags question: http://stackoverflow.com/q/26924628
tags question: http://stackoverflow.com/q/26982488
tags question: http://stackoverflow.com/q/26928282
tags question: http://stackoverflow.com/q/26956699
type: Tag
tags question: http://stackoverflow.com/q/26877810
tags question: http://stackoverflow.com/q/26934315
tags question: http://stackoverflow.com/q/26862206
tags question: http://stackoverflow.com/q/26852412
tags question: http://stackoverflow.com/q/26881727
tags question: http://stackoverflow.com/q/26870357
tags question: http://stackoverflow.com/q/26983864
tags question: http://stackoverflow.com/q/26981916
tags question: http://stackoverflow.com/q/26959545
tags question: http://stackoverflow.com/q/26856336
tags question: http://stackoverflow.com/q/26965134
tags question: http://stackoverflow.com/q/26969688
tags question: http://stackoverflow.com/q/26882203
tags question: http://stackoverflow.com/q/26856917
tags question: http://stackoverflow.com/q/26904689
tag name: hashmap
tags question: http://stackoverflow.com/q/26883474
tags question: http://stackoverflow.com/q/26965896
tags question: http://stackoverflow.com/q/26913648
tags question: http://stackoverflow.com/q/26921133
tags question: http://stackoverflow.com/q/26903891
tags question: http://stackoverflow.com/q/26870444

http://stackoverflow.com/q/26951055
has title: Drawing using Graphics in Java
type: UnansweredQuestion
tagged with: swing
tagged with: java
has answer: http://stackoverflow.com/a/26951225
type: Question
tagged with: graphics
answer count: 1
has body: I have a Graphics question. I'm trying to draw an image in a Frame and I'm having some issue. I want to know what's the best approach to successfully do what I want to do. I will show my 3 classes. The Main class create the Menu. Once Matchmaking button is press, it create the Board object and call Main.draw to paint all it's component (only Board for now). The picture only sometime appear so it make me realise my code isn't probably setup the right way. THANKS!!! MAIN CLASS import java.awt.Graphics; public class Main { public static Board theBoard; public static void main(String[] args) { new Menu("Main Menu").setVisible(true); } public static void draw(Graphics painter) { theBoard.draw(painter); } } MENU CLASS import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class Menu extends JFrame implements ActionListener { //Jpanel JPanel pnlButton = new JPanel(); //Buttons JButton btnMatchmaking = new JButton("Matchmaking"); JButton btnExit = new JButton("Exit"); JButton btnProfile = new JButton("Profile"); JButton btnOption = new JButton("Options"); public Menu(String s) { super("Bu$ted: " + s); btnExit.addActionListener(this); btnMatchmaking.addActionListener(this); //JPanel setting pnlButton.add(btnMatchmaking); pnlButton.add(btnProfile); pnlButton.add(btnOption); pnlButton.add(btnExit); pnlButton.setVisible(true); //The winddow options super.setLocation(0,0); //A remplacer par des dimension variables super.setSize(600, 500); //A remplacer par des dimension variables super.setResizable(false); super.setVisible(true); super.add(pnlButton); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } //Handle action events. //@param evt @Override public void actionPerformed(ActionEvent evt) { if(evt.getSource() == btnMatchmaking) { super.remove(pnlButton); Main.theBoard = new Board("TestBoard"); super.add(Main.theBoard); super.setSize(Main.theBoard.boardSize); Main.draw(sup…
score: 0
has comment: http://stackoverflow.com/comment/42443311

http://stackoverflow.com/a/26962442
type: Answer
has comment: http://stackoverflow.com/comment/42463006
has body: T needs to be enclosed in quotes since it isnt used to match a date element in the DateFormat pattern DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26962431
score: 3
answers question: http://stackoverflow.com/q/26962431
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42514972
has text: Thanks Jacob.I am always here for helping you.
comment on: http://stackoverflow.com/a/26984931
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26976932
type: Answer
has body: I think it would be the best way to make a char[] from the String, reverse that char[] and convert it back to a String. Something like this should do the job: Scanner input = new Scanner(System.in); String[] my_friend_names = new String[10]; for (int i = 0; i &lt; my_friend_names.length; i++) { my_friend_names[i] = input.nextLine(); } input.close(); for(String name : my_friend_names) { System.out.println("Name: " + name); } for(int i=0; i&lt;my_friend_names.length; i++) { char[] characters=my_friend_names[i].toCharArray(); List&lt;char[]&gt; reverse=Arrays.asList(characters); Collections.reverse(reverse); my_friend_names[i]=new String(characters); } System.out.println("After Reverse order: "); for(String name : my_friend_names) { System.out.println("Name: " + name); } Let me know whether it works (or not) Happy coding :) -Charlie
score: 0
answers question: http://stackoverflow.com/q/26976698

http://stackoverflow.com/a/26988103
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26987853
downvote count: 0
answers question: http://stackoverflow.com/q/26987853
has body: The priority queue organizes the elements (if it is a min queue) so that the root is the minimum element. Note that in this example, the queue is backed by a heap data structure and the heap is stored as an array. A heap maintains the property that the root is larger than its children (left and right) and that each of its children share the same property in that each of the child nodes is larger than its children. This property of a heap is the key in answering the question you posted. https://www.cs.auckland.ac.nz/~jmor159/PLDS210/heaps.html The text above has a schematic on insertion to a heap and that would answer your question. In the example elements are inserted one after the other and they propagate upwards (called siftup in some implementations) to its place in the heap data structure and to add n elements requires nlogn complexity. I would recommend drawing the heap as a binary tree by repeatedly inserting the elements and you would also come to the same conclusion which is (c). If you are interested in experimenting with some java code, you could download two classes for an elementary implementation of a heap and play with them. They are at: http://khanna111.com/wordPressBlog/2013/06/ Note that this implementation uses the "siftDown" approach wherein it translates a given "n" element array into a heap in o (n) complexity. You could download the code and play with it and implement the "siftUp" approach on your own to garner an understanding of the heap data structure. Note the code is in Java.

http://stackoverflow.com/comment/42451797
type: QuestionComment
comment on: http://stackoverflow.com/q/26955733
has text: "/161.jpg" try this way, dont run the code but just create the jar
score: 0
type: Comment

http://stackoverflow.com/a/26881025
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26880962
has body: In java, you can't print an array (that's the output you get when you try). You must use Arrays.toString(). String[] For_split_email=email.split("[@._]"); System.out.println("splited emails----------" + Arrays.toString(For_split_email)); I'm pretty sure the code you posted isn't the code that produced that output.

http://stackoverflow.com/comment/42467043
score: 0
comment on: http://stackoverflow.com/q/26964602
type: Comment
type: QuestionComment
has text: & Is there a way I can reinstall the javadoc info?

http://stackoverflow.com/q/26897910
has comment: http://stackoverflow.com/comment/42349277
tagged with: java
has comment: http://stackoverflow.com/comment/42349233
type: Question
linked to: http://stackoverflow.com/q/17115355
has comment: http://stackoverflow.com/comment/42349218
has comment: http://stackoverflow.com/comment/42372768
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42349538
tagged with: http://stackoverflow.com/tag/xml
has body: I implement some backend and I am trying to integrate with rest server which use XML as a transport. There is Spring which automatically handle XML parsing using JAXB. But some requests and responses which come from this server have tags with equal names. For example: 2014-12-11 London Paris 1 bla-bla Java code: @XmlRootElement(name = "transaction") public class Transaction { private String date; private String stationFrom; private String stationTo; private int place; private Detail detail; public Transaction() {} @XmlElement(name = "date") public String getDate() { return date; } public void setDate(String date) { this.date = date; } @XmlElement(name = "station-from") public String getStationFrom() { return stationFrom; } public void setStationFrom(String stationFrom) { this.stationFrom = stationFrom; } @XmlElement(name = "station-to") public String getStationTo() { return stationTo; } public void setStationTo(String stationTo) { this.stationTo = stationTo; } @XmlElement(name = "place") public int getPlace() { return place; } public void setPlace(int place) { this.place = place; } @XmlRootElement(name = "detail") public static class Detail { private Transaction transaction; public Detail() {} @XmlElement(name = "transaction") public Transaction getTransaction() { return transaction; } public void setTransaction(Transaction transaction) { this.transaction = transaction; } @XmlRootElement(name = "transaction") public static class DetailTransaction { private String idSeller; private String someTag; public DetailTransaction() {} @XmlAttribute(name = "id-seller") public String getIdSeller() { return idSeller; } public void setIdSeller(String idSeller) { this.idSeller = idSeller; } @XmlAttribute(name = "some-tag") public String getSomeTag() { return someTag; } public void setSomeTag(String someTag) { this.someTag = someTag; } } } } There are two tags which have equal name - transaction. How can I handle it by JAXB? I don't have XSD schema by the way, this service doesn't…
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/42362590
has answer: http://stackoverflow.com/a/26911833
upvote count: 1
tagged with: jaxb
has title: How to parse XML where I have tags with equal names but on differrent levels?

http://stackoverflow.com/q/26855244
downvote count: 2
has answer: http://stackoverflow.com/a/26870367
tagged with: htmlcleaner
has title: Remove redundant space in HTML in JAVA
answer count: 1
has body: Need to perform some HTML cleansing. Have HTML that has lots of redundant br tags, so far tried HtmlCleaner and jTidy without any results. Example: &lt;br&gt; &lt;br&gt; &lt;br&gt; &lt;br&gt; ... What I would like is just to get a single &lt;br&gt; back Any other ways to accomplish this without manually parsing line by line?
has comment: http://stackoverflow.com/comment/42273186
tagged with: jtidy
tagged with: java
upvote count: 0
has comment: http://stackoverflow.com/comment/42299525
type: UnansweredQuestion
type: Question
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/42274007
score: -2
favorite count: 0
tagged with: parsing

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/26904668
type: Tag
tags question: http://stackoverflow.com/q/26868878
tags question: http://stackoverflow.com/q/26941622

http://stackoverflow.com/comment/42334016
type: AnswerComment
type: Comment
score: 1
has text: `in.next()` doesn't read the whole line, `in.nextLine()` does that.
comment on: http://stackoverflow.com/a/26889930

http://stackoverflow.com/a/26984292
answers question: http://stackoverflow.com/q/26984234
score: 0
type: Answer
has body: You should probably use input.next() or something. Then if(answer.equals("Y") || answer.equals("1")

http://stackoverflow.com/comment/42390799
comment on: http://stackoverflow.com/a/26921187
has text: Try running the `Update` method on its own. If it no longer throws the exception, you know the problem is that some part of your code is closing `System.in`. Then put parts of the code back in one at a time to identify which part is doing that.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26873592
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26877642
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/42305280
accepted answer: http://stackoverflow.com/a/26877642
has comment: http://stackoverflow.com/comment/42305893
tagged with: jcomponent
upvote count: 1
tagged with: swing
tagged with: jfreechart
answer count: 1
has title: Add Multiple transparent JComponents objects to just one JPanel
tagged with: java
has body: This problem is bothering me a lot. Suppose I have two different classes called DrawProfile and PlotData. These classes extend JComponent. I have also a JPanel called profile. I want to add first the DrawProfile to my profile JPanel and then I would like to add PlotData (DrawProfile and PlotData classes implement paintComponent method). DrawProfile class will draw some rectangular shapes which are filled by different colors. After that, PlotData which is just like a normal plot will sit on the top of DrawProfile(a rectangle with different colors). I want my PlotData to set its background according to DrawProfile different colorful shapes. It could be written a follows: profile.setLayout(new OverlayLayout(profile)); profile.setPreferredSize(new Dimension(400,650)); profile.add(new DrawProfile()); profile.add(new PlotData()); Note that I have used profile.setOpaque(), but it did not help me. I used AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f) for DrawProfile. It works, but the problem is that the scatter plot colors are affected by DrawProfile objects, and the colors are not sharp. You can see my efforts here. At the end I will add my main JPanel (profile) to the JFrame. EDIT: Regarding a runnable code, that would be hard. Because, the code might be intractable. To make my question clearer: In DrawProfile, I extend the class by JComponent. I also implemeted paintComponent() method, where there is a draw(Graphics g) method inside the paintComponent() in order to draw multiple rectangulars with different colors. I set AlphaComposite to 0.5f inside the paintComponent() method. In PlotData class, I used JFreechart (XYplot), and this class extends JPanel. Within this class, there is a paintComponent() method which does plotting (I don't do any strange things here). Inside paintComponent(), I don't touch AlphaComposite (In fact, it is 1.0f). By doind above way, I was able to get my job done. but as you see in the link that I provided, PlotData objects do not ha…
has comment: http://stackoverflow.com/comment/42305949

sensors
type: Tag
tags question: http://stackoverflow.com/q/26980438
tag name: sensors
tags question: http://stackoverflow.com/q/26978698

frame
tags question: http://stackoverflow.com/q/26905349
tags question: http://stackoverflow.com/q/26841648
type: Tag
tag name: frame

http://stackoverflow.com/a/26979558
score: 1
accepted answer of: http://stackoverflow.com/q/26979036
has comment: http://stackoverflow.com/comment/42494451
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42494411
answers question: http://stackoverflow.com/q/26979036
has body: For one thing, you need to specify your types when you define the fontCache Hashtable. Since you're looking up a Typeface via a String, use these types in your definition: private static Hashtable&lt;String, Typeface&gt; fontCache = new Hashtable&lt;String, Typeface&gt;(); Secondly, if R.id.commandText cannot be resolved then it is not present in your R.java resources file. Make sure you have created a view in R.layout.list_item with the android:id attribute set to "@+id/commandText". If you've already done this, perhaps you need to clean &amp; rebuild your project to force R.java to be recreated.
downvote count: 0
has comment: http://stackoverflow.com/comment/42493905
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42494125
has comment: http://stackoverflow.com/comment/42494530

android-studio
tags question: http://stackoverflow.com/q/26851086
tags question: http://stackoverflow.com/q/26962360
tags question: http://stackoverflow.com/q/26916323
tags question: http://stackoverflow.com/q/26890294
tags question: http://stackoverflow.com/q/26971909
tags question: http://stackoverflow.com/q/26842125
tags question: http://stackoverflow.com/q/26917564
tags question: http://stackoverflow.com/q/26989672
tags question: http://stackoverflow.com/q/26944156
tags question: http://stackoverflow.com/q/26963528
tags question: http://stackoverflow.com/q/26942896
type: Tag
tags question: http://stackoverflow.com/q/26928969
tags question: http://stackoverflow.com/q/26846795
tags question: http://stackoverflow.com/q/26937733
tags question: http://stackoverflow.com/q/26899472
tags question: http://stackoverflow.com/q/26888762
tag name: android-studio

http://stackoverflow.com/a/26907956
upvote count: 1
has body: It seems that you are not using any input processor. Make your class implement InputProcessor and make your touchDown method look like this. @Override touchDown(InputEvent event, float x, float y, int pointer, int button) { Vector3 input = new Vector3(x, y, 0); cam.unproject(input); if (ball.getBoundingCircle().contains(input.x, input.y)) { ballBounce(); } } ClickListener (LibGDX API)
has comment: http://stackoverflow.com/comment/42371628
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42371785
downvote count: 0
has comment: http://stackoverflow.com/comment/42373566
score: 1
accepted answer of: http://stackoverflow.com/q/26907597
answers question: http://stackoverflow.com/q/26907597
has comment: http://stackoverflow.com/comment/42387674
has comment: http://stackoverflow.com/comment/42373847
type: Answer

http://stackoverflow.com/comment/42432659
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26944681
has text: So, as this was kind of what I gave in my answer, consider accepting it :p
type: Comment

http://stackoverflow.com/q/26900116
favorite count: 0
has answer: http://stackoverflow.com/a/29981962
linked to: http://stackoverflow.com/q/17408729
tagged with: x509certificate
has answer: http://stackoverflow.com/a/34545405
linked to: http://stackoverflow.com/q/24621839
score: 2
has body: Is there any documentation from Apple that covers the format or algorithms used to generate the file returned by - [GKLocalPlayer generateIdentityVerificationSignatureWithCompletionHandler:]? I've seen a few questions on SO about the basic flow of authenticating a user, which seem to suggest the file is a .cer file (application/pkix-cert), and that it uses the DER file format, but I can't find anything official from Apple. I'm looking to verify the cert in Java, if anyone has any examples, that would be much appreciated as well.
upvote count: 2
tagged with: game-center
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 2
downvote count: 0
has title: Documentation on "public key" returned by GKLocalPlayer generateIdentityVerificationSignatureWithCompletionHandler:?

http://stackoverflow.com/comment/42330488
has text: The asker was requesting database independend code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26887207
type: AnswerComment

http://stackoverflow.com/q/26911603
tagged with: jsp
score: 4
has answer: http://stackoverflow.com/a/26911841
upvote count: 4
accepted answer: http://stackoverflow.com/a/26912351
has title: Converting Map<String, Object> to json
has answer: http://stackoverflow.com/a/26912043
has answer: http://stackoverflow.com/a/26911779
downvote count: 0
has comment: http://stackoverflow.com/comment/42373010
favorite count: 0
possible better answer: http://stackoverflow.com/a/26912043
answer count: 4
type: AnsweredQuestion
has body: I have a map called responseObj Map&lt;String, object&gt; responseObj = new HashMap&lt;String, Object&gt;(); I have added some value in the responseObj like this - responseObj.put("canApprove", true); //1 responseObj.put("approvers", userList); The userList is a list or users - List&lt;User&gt; userList = new ArrayList&lt;User&gt;(); The user Object from the User class - class User { private int userId; private int roleId; } Now I have some questions - Is it possible to convert the responseObj to a json so that "canApprove" and "approvers" become key of json (see the code snippent below) and how can I make it? { "canApprove" : true, "approver": [ { "userId": 309, "roleId": 2009 }, { "userId": 3008, "roleId": 2009 }, ] } If I convert it into a json and get the response from jsp can I able get the appropriate boolean in jsp where the "canApprove" refers an Object in the responseObj? Can I persist the "userId" and "roleId" to JSON from User Class?
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/26912351

http://stackoverflow.com/q/26859473
tagged with: itext
type: Question
has title: How to show an image with large dimensions across multiple pages in a PDF using iText5?
has body: I have a graph image with large dimensions which I need to display in a PDF file. I can't scale to fit the image as this would make text on the node illegible. How could I split the image into multiple pages while retaining its original dimensions?
accepted answer: http://stackoverflow.com/a/26861365
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26861365
tagged with: pdf-generation
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42282754
tagged with: java

http://stackoverflow.com/comment/42509665
score: 1
comment on: http://stackoverflow.com/q/26988688
has text: You don't need to escape meta-characters in word classes (between [])!
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26862813
type: AcceptedAnswer
score: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26862689
downvote count: 2
answers question: http://stackoverflow.com/q/26862689
has body: It seems to relate with security because the log said "(Access is denied)". Maybe the output jar of project B exists and there are some processes still reading from it, so that you cannot overwrite the output file. Or maven doesn't have the appropriate privilege to write the output file to the class folder.
upvote count: 4

http://stackoverflow.com/comment/42476777
has text: Are specific fields of a record, representing the vendor id, name , address , neighborhood , city, state and the distance that must be ordered from smallest to largest.
score: 0
comment on: http://stackoverflow.com/q/26969688
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26983563
accepted answer: http://stackoverflow.com/a/26983817
has comment: http://stackoverflow.com/comment/42501420
has answer: http://stackoverflow.com/a/26983715
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26983715
favorite count: 0
type: Question
tagged with: regex
has comment: http://stackoverflow.com/comment/42501401
has comment: http://stackoverflow.com/comment/42501361
has body: I'm pretty new to Java, but I am looking to create a String variable from a regex finding. But I am not too sure how. Basically I need: previous_identifer = (all the text in nextline up to the third comma); Something maybe like this? previous_identifier = line.split("^(.+?),(.+?),(.+?),"); Or: line = reader.readLine(); Pattern courseColumnPattern = Pattern.compile("^(.+?),(.+?),(.+?),"); previous_identifier = (courseColumnPattern.matcher(line).find()); But I know that won't work. What should I do differently?
has comment: http://stackoverflow.com/comment/42501453
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26983817
has answer: http://stackoverflow.com/a/26991231
answer count: 3
upvote count: 1
downvote count: 1
has title: java create variable from regex findings

http://stackoverflow.com/comment/42259389
has text: Not that im aware of, but what you could test, and im pretty sure will work, is to make sure that the dependencies which contain the duplicate class appear in the same order on the ClassPath JVM arg for your apps. I dont know how that works with ear files, but from my understanding, if your classpath's are equal (meaning the order of elements in it), you should load the same classes in the same way across different apps, and in addition, be able to control which gets used by putting it first in the list relative to its duplicate.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26848177

http://stackoverflow.com/q/26844413
has comment: http://stackoverflow.com/comment/42252078
tagged with: object
has answer: http://stackoverflow.com/a/26844545
has comment: http://stackoverflow.com/comment/42252063
has comment: http://stackoverflow.com/comment/42252012
has answer: http://stackoverflow.com/a/26844513
tagged with: java
has comment: http://stackoverflow.com/comment/42252183
type: Question
has comment: http://stackoverflow.com/comment/42252538
has title: Is Java a "completely" object-oriented language?
has answer: http://stackoverflow.com/a/26844516
has comment: http://stackoverflow.com/comment/42252996
has comment: http://stackoverflow.com/comment/42252176
downvote count: 0
has comment: http://stackoverflow.com/comment/42252219
has answer: http://stackoverflow.com/a/26844552
has comment: http://stackoverflow.com/comment/42252110
has comment: http://stackoverflow.com/comment/42254400
has comment: http://stackoverflow.com/comment/42252037
has comment: http://stackoverflow.com/comment/42252386
has comment: http://stackoverflow.com/comment/42252604
has body: Recently at a job interview I was asked "Is Java a "completely" object-oriented language?" As I was completely unable to answer that question and do not know the answer, could someone, please, help me to understand the nature of this question. As I see the question is being closed as "opinion-based" that's not an opinion I'm asking. I'm asking if I am unaware of that completely/incompletely category. Kindly tell me if that's a wrong forum to ask this.
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/42252865
score: 2
has comment: http://stackoverflow.com/comment/42254460
has comment: http://stackoverflow.com/comment/42252696
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42252267
has comment: http://stackoverflow.com/comment/42252280

http://stackoverflow.com/comment/42629198
comment on: http://stackoverflow.com/q/26923326
has text: You can proably use PrintServic.addPrintServiceAttributeListener. Not as useful as PrintJobListener but I guess solve your problem.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42398084
type: QuestionComment
comment on: http://stackoverflow.com/q/26925669
type: Comment
has text: Actuanlly I am just looking for that part of code that will return the number of papers that need moving for reaching specific paper. I want to make all other stuff on my own, arent looking for the entire program.
score: 0

http://stackoverflow.com/comment/42355661
comment on: http://stackoverflow.com/q/26901308
score: 0
type: Comment
type: QuestionComment
has text: Being explanatory is and saving time is more important than just worrying about bandwidth

http://stackoverflow.com/comment/42428441
score: 1
type: Comment
type: QuestionComment
has text: possible duplicate of [Reading and Writing to a .txt file in Java](http://stackoverflow.com/questions/15801528/reading-and-writing-to-a-txt-file-in-java)
comment on: http://stackoverflow.com/q/26942477

http://stackoverflow.com/comment/42312933
type: Comment
has text: @HyunseokSong One of the requirements was to ask the user about soda or beer only if they are 21 or over. Then show Soda if they are under 21 or asked for Soda.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26877883

http://stackoverflow.com/a/26920780
type: Answer
downvote count: 0
score: 1
has body: I've found out that removings all series of collection and then add new prepared serie with data is solution for this (bug?). Here's my new code: import java.util.Calendar; import java.util.Random; import javax.swing.JFrame; import javax.swing.SwingUtilities; import org.jfree.chart.ChartFactory; import org.jfree.chart.ChartPanel; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.PlotOrientation; import org.jfree.data.time.FixedMillisecond; import org.jfree.data.time.ohlc.OHLCSeries; import org.jfree.data.time.ohlc.OHLCSeriesCollection; public class sample1 { private static final OHLCSeriesCollection seriesCollection = new OHLCSeriesCollection(); private static final DataFeedingThread dataFeedingThread = new DataFeedingThread(); public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAll(); } }); } public static void createAll() { // window JFrame wnd = new JFrame(); wnd.setVisible(true); wnd.setSize(800, 500); wnd.setLocationRelativeTo(null); wnd.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // chart series seriesCollection.addSeries(new OHLCSeries("Test")); // chart final JFreeChart chart = ChartFactory.createCandlestickChart(null, "Time", "Price", seriesCollection, false); chart.getXYPlot().setOrientation(PlotOrientation.VERTICAL); // chart panel final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setMaximumDrawHeight(2000); chartPanel.setMaximumDrawWidth(3000); wnd.add(chartPanel); // chart data feeding thread dataFeedingThread.start(); } public static void setOHLCSeries(OHLCSeries series) { seriesCollection.removeAllSeries(); seriesCollection.addSeries(series); } private static class DataFeedingThread implements Runnable { private Thread t; @Override public void run() { // run recursively while (true) { // feed the chart with random data SampleDataFeed(); // what 1 second before next run try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }…
accepted answer of: http://stackoverflow.com/q/26895301
answers question: http://stackoverflow.com/q/26895301
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42366898
type: Comment
comment on: http://stackoverflow.com/a/26908306
score: 0
type: AnswerComment
has text: I think you misread my question... :( > _All requests are made through the HTTP communication/protocol system and are auto-managed by the client/browser_ Something need to trigger that request, and i want to know what is _that_ :)

http://stackoverflow.com/comment/42396729
type: QuestionComment
type: Comment
score: 1
has text: @JonSkeet i've updated my question i hope it is now clearer
comment on: http://stackoverflow.com/q/26924700

http://stackoverflow.com/a/26887359
score: 0
answers question: http://stackoverflow.com/q/26887184
type: Answer
has body: Pseudocode: mainJsonObject = new JsonObject(); ddaObject = new JsonObject(); mainJsonObject.add("DDA", ddaObject); ddaObject.add("CustomerId", "String content"); loginObject = new JsonObject(); ddaObject.add("Login", loginObject); loginObject.add("Password", "String content"); loginObject.add("Username", "String content"); ddaObject.add("NodeID", "String content"); finalJsonString = mainJsonObject.toJsonString();

http://stackoverflow.com/comment/42373443
comment on: http://stackoverflow.com/q/26911867
score: 0
type: Comment
type: QuestionComment
has text: I do not get this completely: Do you want to "lazy" start? That means you want to start connecting when the Instance of the singleton is requested? If so: do you want the requester to block while waiting for the connection?

http://stackoverflow.com/q/26956699
answer count: 1
accepted answer: http://stackoverflow.com/a/26956721
has comment: http://stackoverflow.com/comment/42453047
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/16152596
tagged with: java
has title: Why do null keys in the hashmap always go to the first bucket?
has comment: http://stackoverflow.com/comment/42452842
type: Question
has answer: http://stackoverflow.com/a/26956721
tagged with: hashmap
has body: What is the benefit? And why do we need particular methods for nulls like putForNullKey(V value), getForNullKey() and similar? What is the benefit?
score: 0
has comment: http://stackoverflow.com/comment/42452673

http://stackoverflow.com/comment/42467903
score: 0
comment on: http://stackoverflow.com/q/26964681
has text: i will add that as an answer in case it helps others. please accept it to show it helped you :)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26834907
has answer: http://stackoverflow.com/a/26835289
accepted answer: http://stackoverflow.com/a/26835077
score: 0
tagged with: while-loop
linked to: http://stackoverflow.com/q/513832
answer count: 3
possible better answer: http://stackoverflow.com/a/26835041
has title: Infinite loop when prompting for user input?
has answer: http://stackoverflow.com/a/26835077
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26835041
tagged with: java
tagged with: loops
type: Question
has body: I am in an intro to java class and have we have to create a Mine Sweeper game. I have the game complete for the most part. But I have having 1 issue where my program goes into a crazy infinite loop. When the user Guesses wrong and hits a "bomb", the game correctly ends. But when they guess correctly and do not hit a bomb, the program enters a infinite loop for some reason and I have to terminate it. I use 2 2dArrays, one that displays to the player as all '?', and the other that has actual bombs placed on it, that I compare guesses to and update the player board. I feel like the problem is in my GetGuess method. Not sure why this infinite loop only happens the the user makes a correct guess. The first guess prompt works fine, and if it hits a bomb, the game ends. If the guess is good, the program should ask for another guess, but instead The infinte loop prints: Enter row number: null over and over again until I terminate. Can anyone help me figure out where this is coming from? Here is my main and Game class. public class MineSweeper { public static void main(String[] args) { Game test = new Game(); test.loadBombs(test.bombBoard); test.loadArray(test.board); test.loadNumber(test.bombBoard); test.displayBoard(test.board); test.displayBoard(test.bombBoard); while(test.gameOver==false)//Continue to get user guess until win or lose { test.getGuess(test.board, test.bombBoard); test.displayBoard(test.board); } } public class Game { int arrayDimension = 9; char[][] board = new char[arrayDimension][arrayDimension]; char[][] bombBoard = new char[arrayDimension][arrayDimension]; static boolean gameOver; public static void getGuess(char[][] boardArray,char[][]bombBoard) { int rowGuess = 0, colGuess=0; Scanner reader = new Scanner(System.in); //Prompt user guess boolean valid = false;//Check if guess is valid while(valid == false) { try{ System.out.println("Enter row number: "); rowGuess= reader.nextInt(); System.out.println("Enter column number: "); colGuess = reader.nextInt(…

http://stackoverflow.com/comment/43918889
has text: The patch-level of java 6 likely will not affect this, it is more likely caused by an outdated third party library, probably xml-apis or xerces
type: Comment
comment on: http://stackoverflow.com/a/26866777
score: 0
type: AnswerComment

http://stackoverflow.com/a/26847533
type: Answer
score: 3
upvote count: 3
downvote count: 0
has body: Yes. Finally blocks are meant to be a container for code that fire no matter what. JUnit, or this example, is no different.
answers question: http://stackoverflow.com/q/26847237

http://stackoverflow.com/comment/45214156
comment on: http://stackoverflow.com/a/26947482
has text: Because I need the elements conform to the width of the window, for example....http://stackoverflow.com/questions/28420202/resizable-page-fxml
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42298705
has text: See the answer of user1879313.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26869772
type: AnswerComment

http://stackoverflow.com/comment/42376356
has text: but I can share some more, though i'm pretty sure, that my error is in the posted section.
score: 0
comment on: http://stackoverflow.com/q/26913315
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26935648
tagged with: ipv4
has title: JavaMail fails from IPv6 only host to dual stack environment
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: socketexception
tagged with: dns
score: 2
has comment: http://stackoverflow.com/comment/42416584
has body: I've written a small test program to try to send a mail message using JavaMail. I'm running into odd behavior in Java and I'm not sure how to fix it. The basic setup is that my test program is running from an IPv6 only linux box but it is trying to send to an IPv4 &amp; IPv6 SMTP server in a dual-stack environment. What I mean by dual stack environment is that the DNS server has an A and a AAAA record with the same hostname for the smtp server, as far as I know this should be legal. When I run my program with both A and AAAA records I get the following exception: javax.mail.MessagingException: Could not connect to SMTP host: &lt;MY Fully qualified domain name&gt;, port: 25; nested exception is: java.net.SocketException: Network is unreachable at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1282) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:370) at javax.mail.Service.connect(Service.java:275) at javax.mail.Service.connect(Service.java:156) at javax.mail.Service.connect(Service.java:105) at javax.mail.Transport.send0(Transport.java:168) at javax.mail.Transport.send(Transport.java:98) Caused by: java.net.SocketException: Network is unreachable at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:232) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:189) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1250) ... 8 more However, If I remove the A record then I am able to reach the SMTP server without a problem. No matter what values I give the java properties 'java.net.preferIPv6Addresses' 'java.net.preferI…
tagged with: java
type: Question
tagged with: ipv6
downvote count: 0
has comment: http://stackoverflow.com/comment/137299156
favorite count: 0

http://stackoverflow.com/comment/42303789
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26871840
has text: I disagree about learning "some basics in GUI"; that might be useful enough, but if you're just learning the language, then I think this exercise can help you do that, and be useful even if you don't use anything else from it again. Unfortunately, I am having trouble reading the code because the names are not in English, so it is difficult for me to tell what's what.

http://stackoverflow.com/q/26991573
has body: Hi I'm trying to find a way to create birt reports with datasets based on a hibernate data source. However, I downloaded eclipse report designer and related plugins, but can't seem to find an option for hibernate data source. Was this functionality taken out? I have gone through a couple of links and either they are old libraries or the integration is done via seam. The only reasonable examples i found are using Scripted data source to access hibernate POJOs. But nothing on how to access hibernate entities directly from the report at least in the latest versions of birt. Or is there something that I'm missing?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27648706
type: AnsweredQuestion
tagged with: report
score: 1
tagged with: birt
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27648706
has comment: http://stackoverflow.com/comment/42520141
has comment: http://stackoverflow.com/comment/42517174
has title: Birt report with hibernate
answer count: 1
downvote count: 0
tagged with: jboss7.x
has comment: http://stackoverflow.com/comment/42521556

http://stackoverflow.com/comment/42541334
has text: I call it when I stop and cleanup the game.
comment on: http://stackoverflow.com/q/26952828
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42488411
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26920068
has text: Show me the full DN from your LDAP browser. Add it by editing your original post.
score: 0

http://stackoverflow.com/q/26981227
tagged with: maven
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26981849
accepted answer: http://stackoverflow.com/a/26981849
type: AnsweredQuestion
tagged with: java
has title: Where is the url mapping defined for rest api created with spring mvc
type: Question
has comment: http://stackoverflow.com/comment/42496568
has body: I followed the tutorial here https://spring.io/guides/gs/rest-service/ which first had me set up my pom file (i am using maven) and then had me set up the object and the "Create a resource controller" so i did and have package hello; import java.util.concurrent.atomic.AtomicLong; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController public class GreetingController { private static final String template = "Hello, %s!"; private final AtomicLong counter = new AtomicLong(); @RequestMapping("/greeting") public Greeting greeting(@RequestParam(value="name", defaultValue="World") String name) { return new Greeting(counter.incrementAndGet(), String.format(template, name)); } } The tutorials says Although it is possible to package this service as a traditional WAR file for deployment to an external application server, the simpler approach demonstrated below creates a standalone application. but I am using WARs I use them instead of application so I did not create that. However it never explains how to map "/greeting" When I launch my WAR it works but going to /greeting results in a 404 error. Which doesn't surprise me since it was never mapped anywhere. Am I supposed to map it to web.xml somehow?
has comment: http://stackoverflow.com/comment/42496609
score: 0
answer count: 1
tagged with: rest

http://stackoverflow.com/a/26930185
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26930127
has body: There is a more elegant solution, don't write a file, just write directly to the output stream contained in the instance of Response.
upvote count: 11
has comment: http://stackoverflow.com/comment/66318339
downvote count: 2
score: 9
has comment: http://stackoverflow.com/comment/116794928
answers question: http://stackoverflow.com/q/26930127

http://stackoverflow.com/q/26980182
tagged with: junit
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26997015
has comment: http://stackoverflow.com/comment/42510319
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26997015
has body: In Mockito if you want a void method to do nothing you can do this: doNothing().when(_mockedClass).voidMethod(); Is there a way to do this with JMockit? I can't seem to find anything about it. I've been trying to switch to JMockit but am having trouble finding documentation for some of the things we do with Mockito. I suspect they are all there in one form or another, just having trouble finding them, so figured I'd start asking one question at a time here and hope there are easy answers! Thanks!
has comment: http://stackoverflow.com/comment/42561661
type: Question
tagged with: mockito
has title: JMockit equivelant to Mockito doNothing()
tagged with: jmockit
upvote count: 1
has comment: http://stackoverflow.com/comment/42566668

mysql
tags question: http://stackoverflow.com/q/26965184
tags question: http://stackoverflow.com/q/26858270
tags question: http://stackoverflow.com/q/26954067
tags question: http://stackoverflow.com/q/26836648
tags question: http://stackoverflow.com/q/26937242
tags question: http://stackoverflow.com/q/26945944
tags question: http://stackoverflow.com/q/26865092
tags question: http://stackoverflow.com/q/26929802
tags question: http://stackoverflow.com/q/26886692
tags question: http://stackoverflow.com/q/26933954
tags question: http://stackoverflow.com/q/26862778
tag name: mysql
tags question: http://stackoverflow.com/q/26954506
tags question: http://stackoverflow.com/q/26941040
tags question: http://stackoverflow.com/q/26935903
tags question: http://stackoverflow.com/q/26864383
tags question: http://stackoverflow.com/q/26991541
tags question: http://stackoverflow.com/q/26836560
tags question: http://stackoverflow.com/q/26851944
tags question: http://stackoverflow.com/q/26855015
tags question: http://stackoverflow.com/q/26860144
tags question: http://stackoverflow.com/q/26960795
tags question: http://stackoverflow.com/q/26900029
tags question: http://stackoverflow.com/q/26961410
tags question: http://stackoverflow.com/q/26921370
tags question: http://stackoverflow.com/q/26929673
tags question: http://stackoverflow.com/q/26865767
tags question: http://stackoverflow.com/q/26866069
tags question: http://stackoverflow.com/q/26885510
tags question: http://stackoverflow.com/q/26853617
tags question: http://stackoverflow.com/q/26901706
tags question: http://stackoverflow.com/q/26924523
tags question: http://stackoverflow.com/q/26854213
tags question: http://stackoverflow.com/q/26905967
tags question: http://stackoverflow.com/q/26983509
tags question: http://stackoverflow.com/q/26840112
tags question: http://stackoverflow.com/q/26891728
tags question: http://stackoverflow.com/q/26887200
tags question: http://stackoverflow.com/q/26907410
tags question: http://stackoverflow.com/q/26880655
tags question: http://stackoverflow.com/q/26883877
tags question: http://stackoverflow.com/q/26879070
tags question: http://stackoverflow.com/q/26892076
tags question: http://stackoverflow.com/q/26987676
tags question: http://stackoverflow.com/q/26892873
tags question: http://stackoverflow.com/q/26867282
tags question: http://stackoverflow.com/q/26954994
type: Tag
tags question: http://stackoverflow.com/q/26835156
tags question: http://stackoverflow.com/q/26840090
tags question: http://stackoverflow.com/q/26923782
tags question: http://stackoverflow.com/q/26931787
tags question: http://stackoverflow.com/q/26943571
tags question: http://stackoverflow.com/q/26990090
tags question: http://stackoverflow.com/q/26878923
tags question: http://stackoverflow.com/q/26920158
tags question: http://stackoverflow.com/q/26977766
tags question: http://stackoverflow.com/q/26842959
tags question: http://stackoverflow.com/q/26882717
tags question: http://stackoverflow.com/q/26932408
tags question: http://stackoverflow.com/q/26926644
tags question: http://stackoverflow.com/q/26991057
tags question: http://stackoverflow.com/q/26878737
tags question: http://stackoverflow.com/q/26881739
tags question: http://stackoverflow.com/q/26937487
tags question: http://stackoverflow.com/q/26987487
tags question: http://stackoverflow.com/q/26934220
tags question: http://stackoverflow.com/q/26894863
tags question: http://stackoverflow.com/q/26971483
tags question: http://stackoverflow.com/q/26912276
tags question: http://stackoverflow.com/q/26949271
tags question: http://stackoverflow.com/q/26929148
tags question: http://stackoverflow.com/q/26979774
tags question: http://stackoverflow.com/q/26938671
tags question: http://stackoverflow.com/q/26848742
tags question: http://stackoverflow.com/q/26952528
tags question: http://stackoverflow.com/q/26927473
tags question: http://stackoverflow.com/q/26851649
tags question: http://stackoverflow.com/q/26951345
tags question: http://stackoverflow.com/q/26855003

http://stackoverflow.com/a/28495317
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26928957
type: Answer
upvote count: 1
score: 1
has body: I haven't used Spring Security but one option could be AttributeRepository in order to get attributes directly from cas instead of retrieving from your application. You can add an attributeRepository to your deployerContext (bean authenticationManager, property credentialsToPrincipalResolvers: And the following beans: authId Formatted Name AFAIK, bear in mind that SAML must be used instead of CAS Protocol. More info at https://wiki.jasig.org/display/CASUM/Attributes Hope this helps
accepted answer of: http://stackoverflow.com/q/26928957

http://stackoverflow.com/comment/42411493
score: 0
type: Comment
has text: I guess I meant buffering writting/reading instead then, I've solved it, and now its working properly.
type: QuestionComment
comment on: http://stackoverflow.com/q/26932596

http://stackoverflow.com/a/26980100
score: 2
has comment: http://stackoverflow.com/comment/42509093
upvote count: 2
has body: There appears to be some kind of fairness/barging going on using intrinsic locking - probably due to some optimization. I am guessing, that the native code checks to see if the current thread has notified the monitor it is about to wait on and allows it to win. Replace the synchronized with ReentrantLock and it should work as you expect it. The different here is how the ReentrantLock handles waiters of a lock it has notified on. Update: Interesting find here. What you are seeing is a race between the main thread entering synchronized (ctr) { System.out.println(i + ":0 entered synchronized block"); ctr.addWhenHasSpace("hello"); ctr.addWhenHasSpace("world"); } while the other two thread enter their respective synchronized regions. If the main thread does not get into its sync region before at least one of the two, you will experience this live-lock output you are describing. What appears to be happening is that if both the two consumer threads hit the sync block first they will ping-pong with each other for notify and wait. It may be the case the JVM gives threads that are waiting priority to the monitor while threads are blocked.
has comment: http://stackoverflow.com/comment/42526088
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26977011

http://stackoverflow.com/comment/42347591
has text: You can't, you have to figure out some other way. Check [class fields](https://docs.oracle.com/javase/tutorial/java/javaOO/index.html).
type: Comment
comment on: http://stackoverflow.com/q/26897211
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42399601
comment on: http://stackoverflow.com/a/26926569
type: AnswerComment
has text: hey Florian. i made the change and its working fine now. You brought an end to my 2 week long struggle. thanks so much
score: 0
type: Comment

http://stackoverflow.com/a/26974353
accepted answer of: http://stackoverflow.com/q/26973577
upvote count: 3
answers question: http://stackoverflow.com/q/26973577
score: 3
has comment: http://stackoverflow.com/comment/42485422
has comment: http://stackoverflow.com/comment/42486576
type: AcceptedAnswer
downvote count: 0
has body: Nope since , JTable has no reserved argument for ArrayList, but a trick will solve it ! you know that the arguments for JTable is also (Object[][], object[]) Object[] tempTitel = titel.toArray(); // return Object[] String[][] tempTable = new String[table.size()][]; int i = 0; for (List&lt;String&gt; next : table) { tempTable[i++] = next.toArray(new String[next.size()]); // return Object[][] } JTable EndTable = new JTable(tempTable,tempTitel); Note that I change ArrayList&lt;String&gt; table= new ArrayList() to ArrayList&lt;ArrayList&lt;String&gt;&gt; table = new ArrayList(); so when combine it : import java.util.ArrayList; import java.util.Arrays; import java.util.List; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public class Statistic { private static ArrayList&lt;String&gt; rowA = new ArrayList(); private static ArrayList&lt;String&gt; rowB = new ArrayList(); private static ArrayList&lt;String&gt; rowC = new ArrayList(); private static ArrayList&lt;String&gt; titel = new ArrayList(); private static ArrayList&lt;ArrayList&lt;String&gt;&gt; table = new ArrayList(); public static void main(String[] args) { titel.add("Name"); titel.add("Art der Bearbeitung"); titel.add("Datum"); addRows("buchung", "Created", "10.10.10"); addRows("buchung", "Created", "10.10.10"); addRows("buchung", "Created", "10.10.10"); addRows("buchung", "Created", "10.10.10"); addRows("buchung", "Created", "10.10.10"); table.add(rowA); table.add(rowB); table.add(rowC); Object[] tempTitel = titel.toArray(); String[][] tempTable = new String[table.size()][]; int i = 0; for (List&lt;String&gt; next : table) { tempTable[i++] = next.toArray(new String[next.size()]); } JTable EndTable = new JTable(tempTable,tempTitel); JFrame frame = new JFrame("Demo"); frame.getContentPane().add(new JScrollPane(EndTable)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } public static void addRows(String rowa, String rowb, String row…
has comment: http://stackoverflow.com/comment/42484636
has comment: http://stackoverflow.com/comment/42484201
type: Answer
has comment: http://stackoverflow.com/comment/42484544

syntax
tags question: http://stackoverflow.com/q/26888458
type: Tag
tags question: http://stackoverflow.com/q/26836734
tags question: http://stackoverflow.com/q/26847607
tag name: syntax
tags question: http://stackoverflow.com/q/26908168

http://stackoverflow.com/q/26907820
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
answer count: 1
has title: RWT TableViewer doesn't refresh cell colors sometimes
tagged with: tableviewer
accepted answer: http://stackoverflow.com/a/26910956
favorite count: 0
tagged with: eclipse-rap
upvote count: 2
has body: I have a TableViewer component in my RWT 2.2.0 application which represents a matrix of values over time (columns) and products (rows). The tableviewer is in virtual/lazy mode and the items are just in an ArrayList set via setInput and setItemCount. Some cells need to be colored in case the value they contain is negative. The user has additional control to change the starting date of the view. In this case, I repopulate the table with the new data, I call refresh() and in the CellLabelProvider.update() method populates the values and if necessary, sets the color of the cell ViewerCell.setForeground(color) or ViewerCell.setForeground(null) to for the default. Sometimes, especially under IE 9, when the above time-paging happens, cell text updates but cell color remains the same until the user scrolls away (probably far enough so the lazy loading clears it internal row cache). If I forcibly setItemCount(0) before setItemCount(actual) instead of refresh, the effect goes away, but so does the scroll position and selection which makes the table jump back and forth. Is this an RWT bug, do I forget to call something or I misunderstand how ViewerCell.setForeground(null) works?
has answer: http://stackoverflow.com/a/26910956
score: 2

http://stackoverflow.com/a/26922345
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42392424
has comment: http://stackoverflow.com/comment/42419423
score: 2
upvote count: 2
has body: Yes, in assembly language, loops are implemented with condition statement and a goto statement: L1: if ( &lt;cond&gt; ) { &lt;loop-body&gt; goto L1 ; } You can use this approach in C, but not in Java because goto is not permitted. When program gets to L1, it checks the condition. If the condition is met, program will proceed with loop-body, after that it will jump (goto) to L1 which labels a line number in your program. There, a loop. It will break if the condition is not met and program will continue at next line after curly brace { .
has comment: http://stackoverflow.com/comment/42392471
answers question: http://stackoverflow.com/q/26922275

hashcode
tags question: http://stackoverflow.com/q/26959545
tag name: hashcode
tags question: http://stackoverflow.com/q/26986587
tags question: http://stackoverflow.com/q/26850095
tags question: http://stackoverflow.com/q/26943983
tags question: http://stackoverflow.com/q/26915037
tags question: http://stackoverflow.com/q/26971127
tags question: http://stackoverflow.com/q/26910225
tags question: http://stackoverflow.com/q/26969236
type: Tag
tags question: http://stackoverflow.com/q/26987481
tags question: http://stackoverflow.com/q/26888335
tags question: http://stackoverflow.com/q/26915318

http://stackoverflow.com/comment/42428229
type: Comment
has text: It may help you: http://stackoverflow.com/questions/8879714/how-to-get-numeric-position-of-alphabets-in-java . If I understood, you may use numbers to respresent letters, it would make easier to deal with sums.
type: QuestionComment
comment on: http://stackoverflow.com/q/26942065
score: 0

http://stackoverflow.com/comment/42454904
comment on: http://stackoverflow.com/q/26957647
score: 0
has text: I wonder how you run your tests? How are your application contexts managed?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42486737
has text: each time when i see `while(true)` i have goose bumps
comment on: http://stackoverflow.com/q/26975977
score: 4
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26864808
tagged with: java
has body: I've read that GlassFish provides custom events for Java Flight Recorder (JFR) / Java Mission Control (JMC). I tried viewing in JMC 5.4 a JFR 5.3 recording obtained from GlassFish 4.1 running in Java 7u67. The recording was setup from the command line using jcmd. I did not use JMX or MBeans. I saw the standard JFR events, but no custom events for GlassFish. Are there actually custom JFR events for GlassFish? If so, what are they, how do I record them, and how do I view them? Thanks. Here's an article that mentions GlassFish JFR events: http://www.infoq.com/news/2013/10/misson-control-flight-recorder
accepted answer: http://stackoverflow.com/a/26905552
tagged with: glassfish
tagged with: glassfish-4.1
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26905552
has title: Custom events for GlassFish in Java Flight Recorder / Java Mission Control
tagged with: java-mission-control
type: AnsweredQuestion
tagged with: glassfish-4
type: Question

http://stackoverflow.com/comment/42399110
score: 0
has text: Just tired it but doesn't work.
comment on: http://stackoverflow.com/q/26926193
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26842282
has answer: http://stackoverflow.com/a/26844394
accepted answer: http://stackoverflow.com/a/26844394
answer count: 1
tagged with: macos
has title: Intellij on Mac OSX not showing the javadoc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
favorite count: 0
type: Question
has body: I am using the latest version of Intellij Idea v14 on Mac OSX Yosemite. The IDE is not showing the javadoc for the core Java classes when I use the Quick Documentation option(^J): I'm getting a blank popup box. Here is how it appears: I'm guessing the sources are not attached. Intellij is using the JDK6 provided by Apple as it is the recommended version on Mac. How do I fix this? Where can I download the sources for JDK6 by Apple or is there a better solution for this problem?
tagged with: intellij-idea
upvote count: 1

http://stackoverflow.com/comment/42369036
has text: I'm sorry, but I don't understand the question. For `new GregorianCalendar(1900, Calendar.JANUARY, 1)` I get Monday `Mon, 1 Jan 1900` not Tuesday. Furthermore, `calendar.get(Calendar.DAY_OF_WEEK))` depends on the date. It's not the same for all weeks. I don't get it. Can you elaborate a little more?
comment on: http://stackoverflow.com/q/26906297
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26947313
answers question: http://stackoverflow.com/q/26947287
has body: Try to create the file yourself. Most new windows os prevent writing to root c without elevated permissions. If you cant create it manually without special permissions same goes to your code.
has comment: http://stackoverflow.com/comment/42436616
score: 0
type: Answer

http://stackoverflow.com/q/26884307
has comment: http://stackoverflow.com/comment/42340950
has comment: http://stackoverflow.com/comment/42370697
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42324077
tagged with: factory
has answer: http://stackoverflow.com/a/26892868
has comment: http://stackoverflow.com/comment/42330130
has body: (This question was closed on code review so I think I should ask here) Let's say I have a factory like this (it's from an interview): public class ControllersFactoryImpl implements ControllersFactory { private final SessionKeeper sessionKeeper; private final ScoreKeeper scoreKeeper; public ControllersFactoryImpl(final SessionKeeper sessionKeeper, final ScoreKeeper scoreKeeper) { this.sessionKeeper = sessionKeeper; this.scoreKeeper = scoreKeeper; } @Override public Controller makeLoginController(final int userId) { return new LoginController(userId, sessionKeeper); } @Override public Controller makePostUserScoreController(final int levelId, final String session, final int score) { return new AddScoreController(levelId, session, score, sessionKeeper, scoreKeeper); } @Override public Controller makeHighScoreController(final int levelId) { return new HighScoreController(levelId, scoreKeeper); } } since one of the requirements was to handle several call at the time (like millions) they told me that this solution could be improved because in this way we had a huge spawning of new objects (since I'm always calling new) that are doing a single stateless operation and the garbage collector could run into problems trying to clean them. Controller is an interface that has a single method execute(). Avoiding the usage of constructor is something that is puzzling me because the only way I can think of it, is to give to the execute method a var-args argument and I don't really like that solution because the code is not really readable in that way. Do you have any alternatives? This is the code for the controller: public interface Controller { String execute(); } And this is where the controller is used: Controller controller = null; try { if (exchange.isGet()) { final Matcher mLogin = loginPattern.matcher(path); if (mLogin.matches()) { controller = factory.makeLoginController(Integer.parseInt(mLogin.group(1))); contentType = TEXT_PLAIN; } Matcher mHighScore = highScorePattern.mat…
tagged with: performance
downvote count: 0
has comment: http://stackoverflow.com/comment/42369847
score: 1
tagged with: java
type: Question
has title: Avoid construction of new objects if the class can operate stateless
answer count: 1
upvote count: 1

http://stackoverflow.com/comment/42361774
type: QuestionComment
has text: @FabienThouraud I think you have 'hit the nail on the head' with the suggestion of `GridBagLayout`. +1
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26905027

http://stackoverflow.com/comment/42499859
score: 0
type: QuestionComment
type: Comment
has text: Your question is not clear: the commandButton labelled `update` doesn't have any action attached. What are your expectations?
comment on: http://stackoverflow.com/q/26966886

http://stackoverflow.com/comment/42515422
score: 0
type: Comment
has text: It isn't the same, but that does look very interesting I might give that a try one day
type: AnswerComment
comment on: http://stackoverflow.com/a/26992127

http://stackoverflow.com/q/26932576
tagged with: java
tagged with: datasource
type: Question
upvote count: 2
tagged with: hikaricp
answer count: 2
tagged with: c3p0
favorite count: 0
has body: I need to switch the database when a connection is checked-in and checked-out from pool. For instance, session X needs to receive a connection to database A and session Y needs to receive connection to database B. I amd able to do it with C3P0 using a connection customizer. It calls the methods onCheckIn and onCheckOut of AbstractConnectionCustomizer, so I can do something like: public class MyConnectionCustomizer extends AbstractConnectionCustomizer { @Override public void onCheckOut(Connection c, String parentDataSourceIdentityToken) throws Exception { if (something) { c.setCatalog("some database name"); } } @Override public void onCheckIn(Connection c, String parentDataSourceIdentityToken) throws Exception { c.setCatalog("some other database name"); } } I am trying to switch to HikariCP but it calls the customize method of the IConnectionCustomizer only once, when the connection gets created. So, how can I manage to implement such functionality?
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/26942346
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27314553
has title: HikariCP - Setting connected database dynamically on connection check-in and check-out from connection pool
has answer: http://stackoverflow.com/a/26942346
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27314553

http://stackoverflow.com/a/26908499
type: Answer
has body: In your code for String declaration you have used semi colon (;) instead of coma (,) for separation of variable declaration. Change as below line. And also please change variable names. String 1to10 = "", 11to20 = "", 21to30= "", 31to40 = "", 41to50 = "", 51to50 = "", 61to70 = "", 71to80 = "",81to90 = "", 91to100 = "", results = "";
accepted answer of: http://stackoverflow.com/q/26908311
answers question: http://stackoverflow.com/q/26908311
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42265767
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26851414
type: Comment
has text: If I create a new base activity and have main activity and my other activity extend from it, how do I make sure I'm passing in the right context to the base activity?

http://stackoverflow.com/comment/42296946
comment on: http://stackoverflow.com/q/26868926
type: Comment
score: 2
has text: Methods... More methods... heh
type: QuestionComment

http://stackoverflow.com/q/26934116
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42413568
has comment: http://stackoverflow.com/comment/42413375
has comment: http://stackoverflow.com/comment/42413248
has comment: http://stackoverflow.com/comment/42413627
tagged with: java
tagged with: intersection
has title: Intersection of two sets of strings
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42453997
has comment: http://stackoverflow.com/comment/42413308
tagged with: hashset
has comment: http://stackoverflow.com/comment/42413408
has comment: http://stackoverflow.com/comment/42416560
has comment: http://stackoverflow.com/comment/42413493
has body: My question is very simple, I know but Don't know why I got this problem. I jsut want to get the intersection of two sets of strings. Here is my code for that: public int estimatorSuccess(Set&lt;String&gt; set1, Set&lt;String&gt; set2) { Set&lt;String&gt; intersection = new HashSet&lt;String&gt;(set1); intersection.retainAll(set2); } But the intersection is empty !!! Could somebody please tell me what's wrong with that?
has comment: http://stackoverflow.com/comment/42413294
answer count: 0

http://stackoverflow.com/q/26957953
linked to: http://stackoverflow.com/q/334102
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26958098
type: UnansweredQuestion
downvote count: 2
has title: Memory overflow Java
has comment: http://stackoverflow.com/comment/42454872
has answer: http://stackoverflow.com/a/26957980
tagged with: java
tagged with: eclipse
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26958013
has body: I think that my Java Program exceeded the usage of memory allowed... this is the error that shows up in Eclipse: Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at Main.main(Main.java:228) before than trying an implementation with better memory handling, is there any way basically to augment the memory to allocate for the program ? I would like to see the program terminating and showing the result at least.
has answer: http://stackoverflow.com/a/26957974
linked to: http://stackoverflow.com/q/1565388
score: 0

http://stackoverflow.com/comment/42706001
has text: Hi You have n=mentioned JDK 1.6, but as far as I know websockt is supported from JDK 1.7 +.
score: 0
comment on: http://stackoverflow.com/q/26846546
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26870250
favorite count: 0
possible better answer: http://stackoverflow.com/a/26870628
tagged with: sockets
has answer: http://stackoverflow.com/a/26870923
accepted answer: http://stackoverflow.com/a/26870923
downvote count: 0
score: 1
type: Question
type: AnsweredQuestion
has title: Server not receiving in socket communication
tagged with: java
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/26870628
has body: I'm trying to make a Java program in which the server generates a random number and, after establishing a connection with a client, lets it guess the number. However, they both don't seem able to receive each others' messages. Server side: package numberguessserv; import java.net.*; import java.io.*; import java.util.Random; import java.util.Scanner; public class NumberGuessServ { public static void main(String[] args) { Scanner inpkb = new Scanner(System.in); Random randomGenerator = new Random(); int randomNum = randomGenerator.nextInt(10); String number = Integer.toString(randomNum); int port; boolean isGuessed = false; String msgReceived; Socket connect = new Socket(); System.out.print("port: "); port = inpkb.nextInt(); try { ServerSocket clSock = new ServerSocket(port); System.out.println("Waiting..."); connect = clSock.accept(); System.out.println("Connection established with"+connect.getInetAddress()); InputStreamReader isr = new InputStreamReader(connect.getInputStream()); BufferedReader isrBuff = new BufferedReader(isr); OutputStreamWriter osw = new OutputStreamWriter(connect.getOutputStream()); BufferedWriter oswBuff = new BufferedWriter(osw); while (!isGuessed) { msgReceived = isrBuff.readLine(); System.out.println("Number received: "+msgReceived); if (msgReceived.equals(number)) { isGuessed = true; oswBuff.write("Right!"); oswBuff.flush(); } else { oswBuff.write("Wrong!"); oswBuff.flush(); } if (isGuessed) System.out.println("Number was guessed right."); else System.out.println("Number was guessed wrong."); } } catch (Exception ex) { System.out.println("An exception has occurred: "+ex); } finally { try { connect.close(); } catch (Exception ex) { System.out.println("An exception has occurred: "+ex); } } } } Client side: package numberguessclient; import java.io.*; import java.util.Scanner; import java.net.*; public class NumberGuessClient { public static void main(String[] args) { Scanner inpkb = new Scanner(System.in); int port; String IP; boolean isGues…

http://stackoverflow.com/q/26840181
has title: ZK iterate through list of lists
type: UnansweredQuestion
tagged with: zk
has body: I'm totally new to the ZK framework and I'm not sure if the information I've provided would be enough or not. I'm aware that, if there is a fixed number of categories, then in the .zul file - for each Groupbox, a Listbox can be displayed. Currently, I have a list of users being displayed categorically i.e there is a dynamic number categories and each category has dynamic number of users. This is being implemented and displayed using Vlayout. There is a requirement where if there are more than 10 users in each category, then we should display 10 users and then provide a button (or something similar) to display more users in the same category. My questions are- Is it possible to achieve this requirement using Vlayout? If not, can we iterate through a list of Groupboxs to display Listbox (list of users) for each Groupbox (category) in the .zul file? Or is there a simpler / more efficient way of achieving this requirement? Any suggestions will be much appreciated.
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: zul
tagged with: listbox
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/29271064
tagged with: groupbox
favorite count: 0

http://stackoverflow.com/a/26956131
score: 0
type: Answer
has body: Spring Tool Suite (STS) uses the pivotal tc server will automatically deploy resources without redeploying the application. Download it and give it a go, STS is just eclipse anyway with different branding. Maybe you can just download it, copy the pivotal server folder to your eclipse folder and add it to your servers view in your eclipse version. One thing I have noticed is that the application must be running under a context for this to work, deploying to root does not automatically deploy resources for some reason (at least this was the case when I was using the previous vfabric server about a year ago).
answers question: http://stackoverflow.com/q/26945246

http://stackoverflow.com/comment/42278853
type: Comment
comment on: http://stackoverflow.com/a/26858629
has text: Be warned that this starts to become horribly inefficient when percentOfChar is high, because you start getting more attempts to place in cells that already contain 'A's... One way I have got around this in the past in my code is to create a list of all possible cell positions, shuffle that list, then place an object into the first `n` cell positions from the shuffled list... this solution becomes O(N) after the initial list creation and shuffle which is ideal.
score: 1
type: AnswerComment

http://stackoverflow.com/a/26942082
has comment: http://stackoverflow.com/comment/42427947
has comment: http://stackoverflow.com/comment/42427820
has comment: http://stackoverflow.com/comment/42427922
type: Answer
has comment: http://stackoverflow.com/comment/42428055
score: 2
has comment: http://stackoverflow.com/comment/42427950
downvote count: 0
has comment: http://stackoverflow.com/comment/42427878
has comment: http://stackoverflow.com/comment/42428018
has comment: http://stackoverflow.com/comment/42427869
has comment: http://stackoverflow.com/comment/42427993
answers question: http://stackoverflow.com/q/26942045
has comment: http://stackoverflow.com/comment/42427905
has comment: http://stackoverflow.com/comment/42427850
upvote count: 2
has body: Hints: 1) What is going on here? while (heights[i]&gt;average) Think about it! 2) How many headers does a table need? How many times is your code printing the table header? Why?

http://stackoverflow.com/comment/42511135
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26867401
has text: Niharika, I was using Testng 6.1.1 and now updated it to 6.8.8 and now tests are running as expected. Thank you so much!!! :)

http://stackoverflow.com/comment/42370903
type: AnswerComment
comment on: http://stackoverflow.com/a/26910494
type: Comment
has text: I don't think if you can manage this with this stirng. Maybe you should try parse those values few steps before this point?
score: 0

http://stackoverflow.com/a/26901340
has comment: http://stackoverflow.com/comment/42355739
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26901308
has comment: http://stackoverflow.com/comment/42355011
has body: It prints .eq. for a double equal sign. At the point of that if statement, you are inside of a case of having already read another = just in front. while((c=p.read()) != -1) // read one character { switch(c) // see what it is { case '=': // that was a "=" if((c = p.read()) == '=') // read ANOTHER character Note that in the else part, you have to push back that second character, because it has not actually been processed yet (you just confirmed that it was not a second =). p.unread(c);
downvote count: 0
has comment: http://stackoverflow.com/comment/42354953
score: 1

http://stackoverflow.com/comment/42451753
score: 0
type: Comment
type: QuestionComment
has text: I have done the above way it is working for me in NetBeans :)
comment on: http://stackoverflow.com/q/26955733

http://stackoverflow.com/a/26935647
has comment: http://stackoverflow.com/comment/42519783
has comment: http://stackoverflow.com/comment/42520545
has comment: http://stackoverflow.com/comment/42518829
has comment: http://stackoverflow.com/comment/42520737
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42520772
has body: Probably, the switching to child window didn't happen properly. Hence, 'driver.close()' is closing the parent window, instead of child window. Also, since the parent window has been closed, it implies the session has been lost which gives the error 'SessionNotFoundException'. This link will help you out in properly switching between windows On another note, just an advice. Rather than passing "driver" as a parameter, why don't you make it a static variable. It will be easily accessible to all the methods inside the class and it's subclasses too, and you don't have to bother about passing it each time to a method.. :) Below is the code that you've requested in your comment (Unrelated to the question above) public class Testing_anew { public static WebDriver driver; public static void main(String args[]) throws InterruptedException{ driver = new FirefoxDriver(); driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); } public static void testmethod(){ driver.findElement(By.xpath("//some xpath")).click(); } Updated Code 19/11/14 public static void daysInStockSelectContract(InternetExplorerDriver driver) { //get the parent handle before clicking on the link String winHandleBefore = driver.getWindowHandle(); System.out.println("Current handle is: "+winHandleBefore); driver.findElement(By.xpath(".//*[@id='page-content']/table/tbody/tr[1]/td[1]/a")).click(); // Iterating through the set of window handles till the child window's handle, that is infact // not equal to the current window handle, is found for(String winHandle : driver.getWindowHandles()) { if(!winHandle.equals(winHandleBefore)){ System.out.println("Child handle is: "+ winHandle); //Sleeping for 4 seconds for detecting Child window try{ Thread.sleep(4000); }catch(InterruptedException e){ System.out.println("Caught exception related to sleep:"+e.getMessage()); } driver.switchTo().window(winHandle); break; } } System.out.println("AFTER SWITCHING, Handle is: "+driver.g…
type: Answer
has comment: http://stackoverflow.com/comment/42519758
accepted answer of: http://stackoverflow.com/q/26935456
has comment: http://stackoverflow.com/comment/42519764
score: 1
has comment: http://stackoverflow.com/comment/42520597
answers question: http://stackoverflow.com/q/26935456
has comment: http://stackoverflow.com/comment/42518502
upvote count: 1
has comment: http://stackoverflow.com/comment/42520374
has comment: http://stackoverflow.com/comment/42519600

http://stackoverflow.com/comment/42352372
has text: http://stackoverflow.com/questions/3481828/how-to-split-a-string-in-java/3481842#3481842
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26898657

http://stackoverflow.com/a/26866090
has comment: http://stackoverflow.com/comment/42295443
answers question: http://stackoverflow.com/q/26865935
type: Answer
has comment: http://stackoverflow.com/comment/42295326
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26865935
has body: Set gridwidth = 3 for JLabel's and 1 for JTextField's like next : public Calculator() { super("Calculator"); setSize(500, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel = new JPanel(); GridBagLayout bag = new GridBagLayout(); getContentPane().add(panel); panel.setLayout(bag); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(5, 5, 5, 5); c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; c.weightx = 0.0; c.weighty = 0.5; c.gridwidth = 3; panel.add(label1, c); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.weightx = 0.5; c.weighty = 0.5; panel.add(value1, c); c.gridx = 1; c.gridy = 1; panel.add(value2, c); c.gridx = 2; c.gridy = 1; panel.add(value3, c); c.gridwidth = 3; c.weightx = 0.0; c.weighty = 0.5; c.gridx = 0; c.gridy = 3; panel.add(label2, c); c.gridwidth = 1; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 0; c.gridy = 4; c.insets = new Insets(5, 5, 5, 5); panel.add(value4, c); c.gridx = 1; c.gridy = 4; panel.add(value5, c); c.gridx = 2; c.gridy = 4; panel.add(value6, c); c.gridwidth = 3; c.weightx = 0.0; c.weighty = 0.5; c.gridx = 0; c.gridy = 5; panel.add(label3, c); c.gridwidth = 1; c.weightx = 0.5; c.weighty = 0.5; c.gridx = 0; c.gridy = 6; panel.add(value7, c); setVisible(true); } Also read tutorial for GridBagLayout
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26980261
answers question: http://stackoverflow.com/q/26979913
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You can try to use spring-boot-maven-plugin instead of doing maven-assembly-plugin and maven-dependency-plugin by yourself: org.springframework.boot spring-boot-maven-plugin 1.1.8.RELEASE repackage After you can build the jar like this: $ mvn package $ ls target/*.jar
accepted answer of: http://stackoverflow.com/q/26979913
score: 2

http://stackoverflow.com/comment/42403617
type: Comment
type: QuestionComment
has text: there is a good explanation here [link](http://stackoverflow.com/questions/16601299/how-to-create-a-library-project-in-android-studio-and-an-application-project-tha)
comment on: http://stackoverflow.com/q/26928969
score: 0

http://stackoverflow.com/a/26892450
has body: The solution was to remove the usage of the java plugin and add the configuration for compile: configurations { compile } then set up the classpath like this: classpath = configurations.compile Setting up sourceCompatibility, targetCompatibility and dependencyCacheDir for the compileIt taks, it works as expected. EDIT ------------------------- As discussed with @Peter Niederwieser, better is to customize the java plugin: change configuration for the default build: sourceSets { main { java { srcDirs = ['abc'] } } ... } additionally you can change build directory: compileJava { destinationDir = file(project.get("build.binaries.dir")) } add a new task for the second build sourceSets { ... compileTwo { java { srcDirs = ['abc2'] } } } ... task compileTwo(type: JavaCompile) { source = sourceSets.compileTwo.allSource.srcDirs destinationDir = file('classes') classpath = configurations.compile }
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26889162
upvote count: 3
answers question: http://stackoverflow.com/q/26889162
type: Answer
score: 3
downvote count: 0

http://stackoverflow.com/a/71195043
answers question: http://stackoverflow.com/q/26902801
has body: You can use the Java Comparable interface for this, make your class implement this interface and then implement its compareTo() method based on comparing the names. public class Emp implements Comparable<Emp>{ int id; String name; Emp(int id, String name){ this.id = id; this.name = name; } @Override public int compareTo(Emp o) { return this.name.compareTo(o.name); } } I would recommend instead of using a HashMap use a TreeMap(or, convert it into TreeMap) which will insert the records based on the natural order of key, in this case, based on the comparison done. Map<Emp, EmpData> map = new TreeMap<>(); map.put(e1,data1); map.put(e2,data2); map.put(e3,data3); map.put(e4,data4); map.forEach((Emp, Empdata) -> System.out.println("Key : "+Emp.toString()+", Value: "+Empdata.toString()));
score: 0
type: Answer

http://stackoverflow.com/q/26945143
type: Question
has answer: http://stackoverflow.com/a/49492012
tagged with: algorithm
answer count: 3
has body: i am studying Codility chapter 2 : Counting elements. I tried to make the exercise, and i think I have a good solution O(n). is It a valid solution ? Is it a better solution that the BEST solution proposed in te lesson ? Problem: You are given an integer m (1 m 1 000 000) and two non-empty, zero-indexed arrays A and B of n integers, a0,a1,...,an−1 and b0,b1,...,bn−1 respectively (0 ai,bi m). The goal is to check whether there is a swap operation which can be performed on these arrays in such a way that the sum of elements in array A equals the sum of elements in array B after the swap. By swap operation we mean picking one element from array A and one element from array B and exchanging them. I tested my solution with these values : int a[] = {2, 7, 12, 16}; int b[] = {4, 8, 9}; m = 16; note: I commented the return to see the swapped values. public int resultat(int[] A, int B[], int max) { int sumA = Arrays.stream(A).sum(); int sumB = Arrays.stream(B).sum(); int[] countA = count(A, max); int[] countB = count(B, max); int diff = sumA - sumB; int diffMin = 0; if (diff % 2 != 0) { return -1; } diffMin = diff / 2; if (sumA &gt; sumB) { if (diff &lt; countA.length &amp;&amp; diffMin &lt; countB.length &amp;&amp; countA[diff] != 0 &amp;&amp; countB[diffMin] != 0) { System.out.println("A:" + diff + "- B:" + diffMin); //return 1; } } else { if (diffMin &lt; countA.length &amp;&amp; diff &lt; countB.length &amp;&amp; countB[diff] != 0 &amp;&amp; countA[diffMin] != 0) { System.out.println("A:" + diffMin + "- B:" + diff); //return 1; } } return -1; } public int[] count(int[] X, int max) { int[] p = new int[max + 1]; Arrays.fill(p, 0); for (int i = 0; i &lt; X.length; i++) { p[X[i]] += 1; } return p; }
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26945437
favorite count: 0
has comment: http://stackoverflow.com/comment/42438484
has comment: http://stackoverflow.com/comment/42432944
upvote count: 1
possible better answer: http://stackoverflow.com/a/31905737
has answer: http://stackoverflow.com/a/31905737
type: AnsweredQuestion
has title: Codility - Counting Elements Lessons : fastest algorithm swap
tagged with: java
accepted answer: http://stackoverflow.com/a/26945437

http://stackoverflow.com/comment/42439242
has text: Same way as you do with `AnchorPane`. Just create the `BorderPane`, drop some node into one of it's regions, then with that node selected you will see all the available constraints under "Layout" in the right pane.
type: AnswerComment
score: 1
comment on: http://stackoverflow.com/a/26947482
type: Comment

http://stackoverflow.com/q/26949973
has comment: http://stackoverflow.com/comment/42441613
tagged with: vbo
has comment: http://stackoverflow.com/comment/42441530
has body: I am attempting to draw multiple vbos in lwjgl, they render correctly but when I move the camera behind one vbo, I can still see the other in front of the object, even though it is deeper in the screen. Here is a screenshot of the problem. Note that this is from the back of the objects, from the front of the object in the distance, there is no problem. Also the small bulge in the corner of the farther object is to identify each one. This code draws each vbo GL20.glUseProgram(ss.pId); GL13.glActiveTexture(GL13.GL_TEXTURE0); GL11.glBindTexture(GL11.GL_TEXTURE_2D, t.id); GL30.glBindVertexArray(g.vaoId); GL20.glEnableVertexAttribArray(0); GL20.glEnableVertexAttribArray(1); GL20.glEnableVertexAttribArray(2); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, g.vboiId); GL11.glDrawElements(GL11.GL_TRIANGLES, g.indices, GL11.GL_UNSIGNED_BYTE, 0); GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0); GL20.glDisableVertexAttribArray(0); GL20.glDisableVertexAttribArray(1); GL20.glDisableVertexAttribArray(2); GL20.glUseProgram(0); Variables included are: g - geometry, vertices, indices, st coords, ids, (P.S: g.vboiId is the indices id and g.indices is the indices array.) t - texture, texture id, ss - shader set (vertex/fragment), shader ids Please leave a comment if you need any more of my code, and thanks for your help.
type: UnansweredQuestion
answer count: 0
tagged with: opengl
tagged with: glsl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/42441305
type: Question
has title: LWJGL VBO depth overlapping
score: 0

http://stackoverflow.com/comment/42306581
has text: In an improper publication scenario, not only could the value be *seen* prior to completion of the constructor, it could also be *modified* via its mutator prior to completion of the constructor. And that mutation could, in principle, be seen too. And then be overwritten by the initializer.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26874205
score: 1

http://stackoverflow.com/comment/42245390
score: 0
comment on: http://stackoverflow.com/q/26840399
has text: There is at least a `@EnableWebMvc` annotation missing, next your `getHibernateProperties` method isn't used so the properties are ignored. Another tip instead of specifying all the `name` attributes just rename your methods, those will be used as bean names/ids.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42423822
comment on: http://stackoverflow.com/q/26939771
type: QuestionComment
has text: public class Quiz { private int count; private String name; private int[] scores; public Quiz (int count, String name2) { count = 0; name = name2; }
score: 0
type: Comment

http://stackoverflow.com/comment/42296388
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26868604
score: 0
has text: You might want to do a simple web search for 'Android rest client` and will find a nice [spring tutorial](http://spring.io/guides/gs/consuming-rest-android/) and at least one [good answer](http://stackoverflow.com/a/8697827/510711)

http://stackoverflow.com/q/26849775
has comment: http://stackoverflow.com/comment/42262391
has body: I spent quite some time solving this but I cannot figure it out. I have the following Java method signature: public static &lt;T&gt; boolean isSameCollectionSets( Collection&lt;? extends Collection&lt;T&gt;&gt; set1, Collection&lt;? extends Collection&lt;T&gt;&gt; set2) This method takes two collections of collections of type T. And it works in Java. Also, the compiler is able to get the type T himself when passing correct arguments. Now I want to port this exact same method to C#. So far, I have this: public static bool IsSameCollectionSets&lt;T&gt;(ICollection&lt;T&gt; set1, ICollection&lt;T&gt; set2) where T : ICollection&lt;T&gt; However, this fails when I try to do the following in C#: ICollection&lt;List&lt;int&gt;&gt; collection1 = new List&lt;List&lt;int&gt;&gt;(); ICollection&lt;HashSet&lt;int&gt;&gt; collection2 = new HashSet&lt;HashSet&lt;int&gt;&gt;(); var result = IsSameCollectionSets(collection1, collection2); The IsSameCollectionSets method is curly underlined and the compiler says: "The type arguments for method 'bool IsSameCollectionSets(ICollection, ICollection)' cannot be inferred from the usage. Try specifying the type arguments explicitly." Now, I tried to give the type arguments explicitly, but nothing has worked so far. Where is my error? Many thanks in advance!
type: Question
tagged with: bounded-wildcard
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42262571
has title: C# generic wildcards
favorite count: 0
has comment: http://stackoverflow.com/comment/42262380
has comment: http://stackoverflow.com/comment/42263190
tagged with: generics
has comment: http://stackoverflow.com/comment/42262468
downvote count: 0
has answer: http://stackoverflow.com/a/26852567
accepted answer: http://stackoverflow.com/a/26852567
score: 1
tagged with: collections
tagged with: c#
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42262600

http://stackoverflow.com/comment/42506145
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26980142
has text: Thanks for the prompt reply. I think it will not work if consumer is HDFS2, in that case what do you suggest?
type: Comment

http://stackoverflow.com/q/26840105
has title: Getting signed short values when I wanted to write out unsigned short values
type: Question
tagged with: unsigned
tagged with: short
tagged with: java
linked to: http://stackoverflow.com/q/26098541
has body: Using the solution provided here -Java input and output binary file byte size are not matching after transformation I wrote out a 2-dimensional array to disk that consists of unsigned shorts. When I checked the values of this file by reading them in I still see signed values i.e. negative values. What is the error in the code ? fos = new FileOutputStream(destFile); short[][] data = getData(); //defined in another class if (ByteOrder.nativeOrder().equals(ByteOrder.BIG_ENDIAN) { for (int i = 0;i&lt;1200;i++) { for (int j = 0; j &lt;1200;j++) { fos.write((data[i][j] &gt;&gt; 8) &amp; 0xFF); fos.write(data[i][j] &amp; 0xFF); } } } else { for (int i = 0;i&lt;1200;i++) { for (int j = 0; j &lt;1200;j++) { fos.write(data[i][j] &amp; 0xFF); fos.write((data[i][j] &gt;&gt; 8) &amp; 0xFF); } } }
has answer: http://stackoverflow.com/a/26840215
accepted answer: http://stackoverflow.com/a/26840215
answer count: 1
downvote count: 0
favorite count: 0
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/42297341
has text: 1. Yes, flushing is a concept specific to buffered output. See also [Flushable](https://docs.oracle.com/javase/7/docs/api/java/io/Flushable.html) 2. There are quite a few streams in `java.io`. I'd have to go through all of them to verify, and I just don't see the point in doing so. On the other hand, I added one more reason to flush, see my updated answer.
type: AnswerComment
score: 1
type: Comment
comment on: http://stackoverflow.com/a/26867464

http://stackoverflow.com/comment/42334447
comment on: http://stackoverflow.com/a/26885763
has text: OK, now i understand. Your problem is a system envoirment settings with java, you can't reach a bin of jdk. Follow the procedure in a link that a post 4 comment up and you solve it! Let me now!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42405135
score: 1
has text: answer at [How to send HTML email](http://stackoverflow.com/questions/2007540/how-to-send-html-email) is not the correct answer for this question.
comment on: http://stackoverflow.com/q/26927275
type: QuestionComment
type: Comment

http://stackoverflow.com/a/43275183
downvote count: 0
answers question: http://stackoverflow.com/q/26977523
has comment: http://stackoverflow.com/comment/96278780
score: 4
type: Answer
upvote count: 4
has body: public class NumberToWord { private static final String[] specialNames = { "", " thousand", " million", " billion", " trillion", " quadrillion", " quintillion" }; private static final String[] tensNames = { "", " ten", " twenty", " thirty", " forty", " fifty", " sixty", " seventy", " eighty", " ninety" }; private static final String[] numNames = { "", " one", " two", " three", " four", " five", " six", " seven", " eight", " nine", " ten", " eleven", " twelve", " thirteen", " fourteen", " fifteen", " sixteen", " seventeen", " eighteen", " nineteen" }; private String convertLessThanOneThousand(int number) { String current; if (number % 100 &lt; 20){ current = numNames[number % 100]; number /= 100; } else { current = numNames[number % 10]; number /= 10; current = tensNames[number % 10] + current; number /= 10; } if (number == 0) return current; return numNames[number] + " hundred" + current; } public String convert(int number) { if (number == 0) { return "zero"; } String prefix = ""; if (number &lt; 0) { number = -number; prefix = "negative"; } String current = ""; int place = 0; do { int n = number % 1000; if (n != 0){ String s = convertLessThanOneThousand(n); current = s + specialNames[place] + current; } place++; number /= 1000; } while (number &gt; 0); return (prefix + current).trim(); } public static void main(String[] args) { NumberToWord obj = new NumberToWord(); System.out.println("*** " + obj.convert(123456789)); System.out.println("*** " + obj.convert(-55)); } } Source:http://javahungry.blogspot.com/2014/05/convert-math-number-to-equivalent-readable-word-in-java-code-with-example.html

deserialization
type: Tag
tags question: http://stackoverflow.com/q/26970584
tag name: deserialization
tags question: http://stackoverflow.com/q/26959906
tags question: http://stackoverflow.com/q/26914209
tags question: http://stackoverflow.com/q/26971127
tags question: http://stackoverflow.com/q/26897047

inheritance
tags question: http://stackoverflow.com/q/26945580
tags question: http://stackoverflow.com/q/26979293
tags question: http://stackoverflow.com/q/26899785
tags question: http://stackoverflow.com/q/26903661
tags question: http://stackoverflow.com/q/26975669
tags question: http://stackoverflow.com/q/26900655
tags question: http://stackoverflow.com/q/26875951
tags question: http://stackoverflow.com/q/26926142
tags question: http://stackoverflow.com/q/26960320
tags question: http://stackoverflow.com/q/26910620
tags question: http://stackoverflow.com/q/26839352
tag name: inheritance
tags question: http://stackoverflow.com/q/26976929
tags question: http://stackoverflow.com/q/26958499
tags question: http://stackoverflow.com/q/26846354
tags question: http://stackoverflow.com/q/26880021
tags question: http://stackoverflow.com/q/26886477
tags question: http://stackoverflow.com/q/26954843
type: Tag
tags question: http://stackoverflow.com/q/26915318
tags question: http://stackoverflow.com/q/26846192
tags question: http://stackoverflow.com/q/26863973
tags question: http://stackoverflow.com/q/26963828
tags question: http://stackoverflow.com/q/26846137
tags question: http://stackoverflow.com/q/26936567
tags question: http://stackoverflow.com/q/26879050
tags question: http://stackoverflow.com/q/26880450
tags question: http://stackoverflow.com/q/26867742
tags question: http://stackoverflow.com/q/26972363
tags question: http://stackoverflow.com/q/26878117
tags question: http://stackoverflow.com/q/26947720
tags question: http://stackoverflow.com/q/26928541
tags question: http://stackoverflow.com/q/26945597
tags question: http://stackoverflow.com/q/26888666
tags question: http://stackoverflow.com/q/26869873

http://stackoverflow.com/q/26847607
has title: Java variables 'm' and 'p' prefixes
answer count: 4
has comment: http://stackoverflow.com/comment/42258101
type: AnsweredQuestion
downvote count: 0
tagged with: syntax
tagged with: java
has body: What are the purposes and meanings of this syntax? I'm seeing lines like private Object mSelectedOperationRow; and mMessageService = pMessageService;. More complete code below. public class SearchResponseBean extends BaseBean implements Serializable, SearchResponse { @Autowired private SearchLifecycleService mSearchLifecycleService; @Autowired private ConfigurationServiceImpl mConfig; @Value("#{sessionBean}") private Session session; @Value("#{searchRequestBean}") private SearchRequest searchRequest; @Value("#{searchResponseFilterByBean}") private SearchResponseFilterBy searchResponseFilterBy; @Value("#{searchHistoryBean}") private HistoryBean&lt;SearchHistoryItem&gt; historyBean; @Autowired private SearchResponseDataModelFactory mSearchResponseDataModelFactory; private int mCount; private DataModel mDataModel; private SearchPerspective mSearchPerspective; private Operation mSelectedOperation; private Object mSelectedOperationRow; private List mSelectedList; private List&lt;String&gt; mAvailableOperations; private List mFilteredList; private boolean mRelatedDocSearch; private transient MessageService mMessageService; public SearchResponseBean() { mMessageService = new MessageServiceImpl(); } public SearchResponseBean(MessageService pMessageService) { mMessageService = pMessageService; } protected void init() { String THIS_METHOD_NAME = "init"; mFilteredList = null; mSelectedList = null; mSelectedOperationRow = null; mSelectedOperation = null; mCount = -1; mDataModel = null; mSearchPerspective = null; mAvailableOperations = null; mRelatedDocSearch = false; logger.debug(getClass(), THIS_METHOD_NAME, "Initialized with null/defaults. "); }
has answer: http://stackoverflow.com/a/26847671
type: Question
has comment: http://stackoverflow.com/comment/42258057
score: 5
possible better answer: http://stackoverflow.com/a/26847676
has answer: http://stackoverflow.com/a/26847734
tagged with: variables
tagged with: prefix
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/26847676
has comment: http://stackoverflow.com/comment/42258018
has answer: http://stackoverflow.com/a/26847660
accepted answer: http://stackoverflow.com/a/26847671

http://stackoverflow.com/comment/42448340
comment on: http://stackoverflow.com/q/26954066
has text: I did try. It just kept on giving me compiler errors!
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42401097
has text: You shouldn't us a the SEDA endpoint together with a thread pool. But using one or the other is ok.
type: QuestionComment
comment on: http://stackoverflow.com/q/26926805
score: 0
type: Comment

http://stackoverflow.com/comment/42299845
comment on: http://stackoverflow.com/q/26870577
score: 1
has text: You shouldn't be copying an instance over that doesn't exactly match the type you want. `A<?>` seems wrong in preference to `A<E>`.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42405441
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26929673
has text: Post your Logcat here.

http://stackoverflow.com/comment/42478661
has text: http://stackoverflow.com/questions/12621804/saving-state-of-the-checkbox-in-a-custom-list-view-with-checkboxes see this
type: QuestionComment
comment on: http://stackoverflow.com/q/26971380
type: Comment
score: 1

http://stackoverflow.com/a/28370936
type: Answer
has comment: http://stackoverflow.com/comment/45149235
score: 1
answers question: http://stackoverflow.com/q/26949249
downvote count: 0
has comment: http://stackoverflow.com/comment/45133965
upvote count: 1
has body: LingPipe is a free(as well as paid) tool available for Sentiment Analysis. http://alias-i.com/lingpipe/index.html Main features include: Sentiment Analysis Named Entity Recognition Clustering Topic Classification Language Identification etc

http://stackoverflow.com/comment/42420736
has text: It would be easier to visualize if you posted the code snippets in question, including the layout xml for MainActivity.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26938125

http://stackoverflow.com/comment/42268635
comment on: http://stackoverflow.com/a/26852908
score: 3
type: Comment
has text: IMHO, I would just go with adding the C:\Program Files (x86)\Java\jre1.8.0_25\bin directory to your path instead of shortcuts. That should work since java.exe is in that directory. I'd try these changes, exit the command prompt and then try again.
type: AnswerComment

http://stackoverflow.com/comment/42343951
has text: Thanks for the answer, but I was asking for a way that didn't require me to change something for every computer. While this is helpful and interesting, it's not what I was looking for. I'm going to clarify that in the question.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26895103

http://stackoverflow.com/q/26889057
accepted answer: http://stackoverflow.com/a/26909502
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42333432
downvote count: 0
has comment: http://stackoverflow.com/comment/42333224
possible better answer: http://stackoverflow.com/a/26889838
type: Question
has title: Hibernate and Spring DataSourceTransactionManager
tagged with: java
tagged with: hibernate
tagged with: spring-transactions
answer count: 3
score: 5
has answer: http://stackoverflow.com/a/26889838
has answer: http://stackoverflow.com/a/51278063
favorite count: 0
has body: I'm trying to work with Hibernate and Spring DataSourceTransactionManager to handle commit and rollback functions, but probably I dind't get something. Before using Spring DataSourceTransactionManager, this was one of my DAO class package com.springgestioneerrori.DAO; public class UtenteDAO extends DAOBase{ public void salvaUtente(Utente utenteIn) throws DAOException{ Session session = getHibernateSession(); //from this method I get Hibernate SessionFactory try{ session.beginTransaction(); session.saveOrUpdate(Object); session.getTransaction().commit(); } catch(Exception e){ session.getTransaction().rollback() } } } This is the class that give me the sessionFactory private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new AnnotationConfiguration().configure().buildSessionFactory(); } catch (Throwable ex) { System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { getSessionFactory().close(); } public Session getHibernateSession (){ Session session = HibernateUtil.getSessionFactory().openSession(); return session; } Now i'm trying to use DataSourceTransactionManager in a declarative way. Following some examples on the internet I wrote this: &lt;tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" /&gt; &lt;tx:advice id="txAdvice" transaction-manager="transactionManager"&gt; &lt;tx:attributes&gt; &lt;tx:method name="salvaUtente"/&gt; &lt;/tx:attributes&gt; &lt;/tx:advice&gt; &lt;aop:config&gt; &lt;aop:pointcut id="userDaoTxPointcut" expression="execution(* com.springgestioneerrori.DAO.UtenteDAO.salvaUtente(..))" /&gt; &lt;aop:advisor advice-ref="txAdvice" pointcut-ref="userDaoTxPointcut" /&gt; &lt;/aop:config&gt; Now, what should I w…
upvote count: 5
has answer: http://stackoverflow.com/a/26909502

http://stackoverflow.com/q/26932054
score: 0
has answer: http://stackoverflow.com/a/27012848
has title: R 3.0.1, JVM does not find Object
has body: When I run Rterm.exe, I get a problem with Java. I just launch Rterm.exe and try to retrieve the Java version by using system("java - version") but it doesn't even work R version 3.0.1 (2013-05-16) -- "Good Sport" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. &gt; system("java -version") Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object &gt; Sys.getenv("JAVA") [1] "H:\\R\\jre-7u10-windows-x64\\jre1.7.0_10\\bin\\"
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42521513
linked to: http://stackoverflow.com/q/11808829
tagged with: java
has answer: http://stackoverflow.com/a/26976992
type: Question
answer count: 2
tagged with: http://stackoverflow.com/tag/r

http://stackoverflow.com/q/26957743
has answer: http://stackoverflow.com/a/26957958
downvote count: 2
has body: Suppose one has a java project which consists of several packages, subpackages etc, all existing in a folder "source". Is there a direct way to copy the structure of the folders in "source" to a "classes" folder and then recursively compile all the .java files, placing the .class files in the correct locations in "classes"?
has title: How to recursively compile a collection of packages in Java
type: Question
score: -2
tagged with: java
tagged with: compilation
linked to: http://stackoverflow.com/q/3512603
accepted answer: http://stackoverflow.com/a/26957958
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/26957914
linked to: http://stackoverflow.com/q/6623161
has comment: http://stackoverflow.com/comment/42454848
favorite count: 0
linked to: http://stackoverflow.com/q/7218506
possible better answer: http://stackoverflow.com/a/26957914
tagged with: package
type: AnsweredQuestion

http://stackoverflow.com/comment/44320785
comment on: http://stackoverflow.com/a/26970354
score: 0
type: AnswerComment
has text: @Flow I managed to get it working on my Android devices. The builder takes a long time (~3 seconds ) but its fast after that.
type: Comment

http://stackoverflow.com/comment/42468688
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26965631
type: AnswerComment
has text: @Makoto I assume he's prompting for input again when it doesn't match. But clearly `(!(choice.equalsIgnoreCase("draw") && !(choice.equalsIgnoreCase("discard"))))` applies the negation to the negation of discard equality. And OP said it *works* for "draw".

http://stackoverflow.com/comment/42295063
score: 0
type: Comment
type: QuestionComment
has text: AFAIK Ruby doesn't have abstract classes. Check here about how to simulate abstract classes in ruby: [How to implement an abstract class in ruby?](http://stackoverflow.com/q/512466/1065197)
comment on: http://stackoverflow.com/q/26867742

http://stackoverflow.com/q/26946826
score: 0
answer count: 2
has body: I am trying to use JLayer to play an mp3. The file is in my jar, but I can't figure out how to make it play. How would I give my app the path of the mp3 file in the same package as my classes? Here is my code: File file = new File("audio.mp3"); System.out.println("located media at "+file.getAbsolutePath()); AdvancedPlayer player = null; try { player = new AdvancedPlayer(new FileInputStream(file), FactoryRegistry.systemRegistry().createAudioDevice()); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JavaLayerException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Starting the music... "); try { player.play(); } catch (JavaLayerException e) { // TODO Auto-generated catch block e.printStackTrace(); }
has answer: http://stackoverflow.com/a/50382580
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26959851
tagged with: java
tagged with: http://stackoverflow.com/tag/mp3
tagged with: jlayer
type: Question
has title: Use JLayer to play mp3 resource

http://stackoverflow.com/a/26987693
answers question: http://stackoverflow.com/q/26987583
type: Answer
has body: Assuming your main problem is how to persist the background image setting and share it across different activities then Shared Preferences may be the best solution. Essentially, it allows you to save simple key value pairs (perhaps the name of the image file in your case?) which is shared across activities and persisted across instances of your application.
score: 0
has comment: http://stackoverflow.com/comment/42545804

http://stackoverflow.com/a/26988580
score: 2
has comment: http://stackoverflow.com/comment/42509606
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26986908
type: Answer
answers question: http://stackoverflow.com/q/26986908
has body: Item 9. Looks like you have no shader program bound. You're creating a context using the Core Profile: ContextAttribs contextAtrributes = new ContextAttribs(3, 2) .withForwardCompatible(true) .withProfileCore(true); With the Core Profile, it's required that you provide a shader program. You will typically write at least a vertex and a fragment shader in GLSL, and then use calls like the following to build and bind a shader program: glCreateShader glShaderSource glCompileShader glCreateProgram glAttachShader glLinkProgram glUseProgram
downvote count: 0

http://stackoverflow.com/q/26937733
linked to: http://stackoverflow.com/q/93591
tagged with: android-studio
has body: I´m just moving from Eclipse to Android Studio and I noticed a small difference. In Eclipse when I use code completion for example like this Eclipse would complete the code like this and allow me just use tab to jump to next parameter. Log.d(tag, msg) But Android Studio does this: Log.d() So is there any setting that would achieve the same result in Android Studio or is this available only in Eclipse
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26937934
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42421119
upvote count: 6
has comment: http://stackoverflow.com/comment/44238349
has title: How to get Eclipse style code completion in Android Studio
has comment: http://stackoverflow.com/comment/44252648
answer count: 1
has comment: http://stackoverflow.com/comment/42422793
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 6

http://stackoverflow.com/comment/42238448
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26836270
has text: @Christopher if you want to store the random then you need to be a bit clever. Check my answer.
score: 0

http://stackoverflow.com/a/26852593
downvote count: 1
answers question: http://stackoverflow.com/q/26852525
has body: You just have to make your last print like this: System.out.println("Average\t " + ((20 + 25 + 18) /3) + "\t " + ((175.5 + 190.5 + 165) /3)); or even better use your variables: System.out.println("Average\t " + ((JasperAge + PaulaAge + NicoleAge) /3) + "\t " + ((JasperHeigth + PaulaHeigth + NicoleHeigth) /3));
type: Answer
has comment: http://stackoverflow.com/comment/42267723
has comment: http://stackoverflow.com/comment/42267700
has comment: http://stackoverflow.com/comment/42267703
has comment: http://stackoverflow.com/comment/42267836
upvote count: 2
score: 1

http://stackoverflow.com/q/26947720
type: Question
has answer: http://stackoverflow.com/a/26947970
answer count: 2
tagged with: android
has title: The type new View.OnClickListener must implement the inherited abstract method
has comment: http://stackoverflow.com/comment/42437440
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/26947943
has answer: http://stackoverflow.com/a/26947943
has comment: http://stackoverflow.com/comment/42437504
accepted answer: http://stackoverflow.com/a/26947970
tagged with: inheritance
tagged with: eclipse
has body: So I just started programming, but I dont really get the method OnClickListener. I already google the error I have: "The type new View.OnClickListener(){} must implement the inherited abstract method View.OnClickListener.OnClick(View)" and I tried to change some things in my code, but it still doens't work. Can anyone tell me exactly what I need to change in my code? Thanks in advance. MainMenuScreen.java: package com.wouter.testjk; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; public class MainMenuScreen extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.main_menu); //error on the line below ((Button) findViewById(R.id.one_player)).setOnClickListener(new OnClickListener() { //the error is here public void onClick(View V) { Log.d("DEBUG", "One Player Button Pressed!"); Intent intent = new Intent(MainMenuScreen.this, TicTacToeGame.class); intent.putExtra("gameType", true); startActivityForResult(intent, 0); } }); ((Button) findViewById(R.id.two_player)).setOnClickListener(new OnClickListener() { public void onClick(View V) { Log.d("DEBUG", "Two Player Button Pressed!"); Intent intent = new Intent(MainMenuScreen.this, TicTacToeGame.class); intent.putExtra("gameType", false); startActivityForResult(intent, 0); } }); ((Button) findViewById(R.id.exit_game)).setOnClickListener(new OnClickListener() { public void onClick(View V) { Log.d("DEBUG", "Exit Game Button Pressed!"); MainMenuScreen.this.finish(); } }); } } MainActivity.java: package com.wouter.testjk; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.…
type: AnsweredQuestion

http://stackoverflow.com/comment/42297501
type: Comment
has text: You need to break out of the while loop. As has been mentioned, the for loop is useless.
comment on: http://stackoverflow.com/a/26869144
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42277086
has text: Is it guarenteed that the arrays contain the same number of elements or is sorted?
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26857587

http://stackoverflow.com/comment/42479613
type: Comment
has text: @MissD I think `Document` is an interface. As far as I know, constructor definitions are not allowed in Java interfaces. Please refer to this link: [Java API for Document](https://docs.oracle.com/javase/7/docs/api/javax/swing/text/Document.html)
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26971621

http://stackoverflow.com/a/26946230
has comment: http://stackoverflow.com/comment/42434821
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42435035
has body: No, it still causes problems, even if you don't perform any calculations. The problem is that the value you store might not be exactly representable as a double, so even if you just store it and read it back, you might not get back what you stored. If you store 0.1 in a double, for instance, you'll find it's not actually 0.1 stored at all, because you can't represent 0.1 exactly in binary.
type: Answer
has comment: http://stackoverflow.com/comment/42434793
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26946205
answers question: http://stackoverflow.com/q/26946205
score: 2
has comment: http://stackoverflow.com/comment/42434827

http://stackoverflow.com/a/26888756
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42350896
has body: you need to call flush as the save is being buffered. This works: public void save() { try { if (!file.exists()) { try { file.createNewFile(); pwriter.print(area.getText()); System.out.println(area.getText()); System.out.println("Saved complete"); } catch (Exception ef) { ef.printStackTrace(); System.err.print("Cannot Create"); } } else if (file.exists()) { pwriter.print(area.getText()); System.out.println(area.getText()); System.out.println("Overwrite complete"); } } catch (Exception exp) { exp.printStackTrace(); System.err.println("Cannot Save"); } finally { pwriter.flush(); } }
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26888655
has comment: http://stackoverflow.com/comment/42358879
answers question: http://stackoverflow.com/q/26888655

http://stackoverflow.com/comment/42343117
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26894686
type: AnswerComment
has text: Ah I see what you mean, I am learning Java you see and this is an example of arrays and passing data between objects (being able to add accounts to accountlist for example). I assume because it does not follow the Law of Demeter that in future classes they will give us an alternative solution like you have mentioned with .tostring and dedicated output class. They like to start us off on the basic / incorrect way to do it first. Thanks for the help guys, I believe all that is needed is the account.printAccountDetails();

http://stackoverflow.com/comment/42294572
comment on: http://stackoverflow.com/a/26867464
score: 0
type: AnswerComment
has text: Two more things to be clear.1.Only buffrered stream needs flush() before close() 2.Every stream in java.io will not have any side effect if I close() without flush(). Is it right?
type: Comment

http://stackoverflow.com/comment/42573307
type: AnswerComment
has text: Looks okay to me. I would try putting a breakpoint in the draw method and stepping through it. Just to make sure the isOn boolean is what you expect it to be. If the isOn seems to be working, make sure the 'on' texture isn't somehow the same as the 'up' texture (I've done that before). My guess is your isOn boolean is always set to true somehow. But again, I can only guess - if you use the debugger you'll find out what the problem is very quickly. It's not hard - if you're using eclipse just double click to the left of the line to make a breakpoint then use the debug button to run you game.
type: Comment
comment on: http://stackoverflow.com/a/26982657
score: 0

http://stackoverflow.com/comment/42236614
comment on: http://stackoverflow.com/a/26835216
type: AnswerComment
has text: Where ever you like, position is irrelevant...convention normally has it at the top of the file..
score: 0
type: Comment

http://stackoverflow.com/comment/42451329
type: QuestionComment
has text: @TavianBarnes they are in a particular package. I don't mind assuming there's no two impls for the same `T` for now, so there won't be two `IAction<String>`
score: 0
comment on: http://stackoverflow.com/q/26936204
type: Comment

http://stackoverflow.com/a/26961016
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26960941
has body: I don't think you want your main() method to be throwing an exception. Typically, this is the kind of thing that you'd put in try and catch blocks. Honestly though, for this sort of thing an if/else would work better. (Unless you're just doing this as a toy example, to learn exceptions.) Make another method called getNumber() that throws the IllegalArgumentException, that returns an int. Then put it inside the try/catch in the main().
downvote count: 0

http://stackoverflow.com/comment/42378684
has text: What do you mean, `containsKey` isn't thread safe?
type: QuestionComment
comment on: http://stackoverflow.com/q/26914888
type: Comment
score: 1

http://stackoverflow.com/q/26862778
has title: MySQL Statement in java with the where clause referring to column using table name
has comment: http://stackoverflow.com/comment/42285464
has answer: http://stackoverflow.com/a/26863064
accepted answer: http://stackoverflow.com/a/26862967
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26862827
tagged with: java
has answer: http://stackoverflow.com/a/26862827
tagged with: mysql
has answer: http://stackoverflow.com/a/26862967
type: Question
has body: I have a table in mysql which has a column called CREATE which I need to access from Java like this: Select GRPLABEL,APPID,TOOLTIP from myTable where GRPID='"+mapGroupId+"' AND myTable.CREATE='X'; I get an error when trying to call this method from java using the mysql driver but not from the mysql workbench What is the correct way of making a request in this case?
has comment: http://stackoverflow.com/comment/42285681
score: 0
answer count: 3
tagged with: sql

http://stackoverflow.com/comment/42370908
comment on: http://stackoverflow.com/a/26910457
has text: Yes you are right, eclipse uses ant, though I am not sure if the ide is configurable to do this pre-processing step. To be honest I was using `vim` at the time
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26903688
answer count: 2
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42358845
has body: My Java program has a class with two methods which will be called by threads. How can I start two threads, one calling one method and the second thread calling the other method? Should I use two inner classes, each implementing the Runnable interface or something else? public class Example { public void read(String key) { /* some code */ } public void write(String key, InputStream inputStream) { /* some code */} }
favorite count: 0
has comment: http://stackoverflow.com/comment/42358933
has comment: http://stackoverflow.com/comment/42358875
has answer: http://stackoverflow.com/a/26903816
has comment: http://stackoverflow.com/comment/42358861
has title: Calling multithreaded methods in one class
type: AnsweredQuestion
tagged with: inner-classes
tagged with: multithreading
has answer: http://stackoverflow.com/a/26903968
accepted answer: http://stackoverflow.com/a/26903968
type: Question
tagged with: java
possible better answer: http://stackoverflow.com/a/26903816
score: 0

http://stackoverflow.com/comment/42498189
type: QuestionComment
comment on: http://stackoverflow.com/q/26975613
type: Comment
has text: To answer your question, from experience it is not possible to mix approaches to creating you actor. Either all dependencies need to be injected via Spring, or none at all and simply use constructor injection in the standard Akka way using Props. Taking your example above, if Account and Order and spring beans then you can inject them in the same way as you have for the ObjectMapper. Alternatively add the ObjectMapper to your constructor arguments and inject it that way without using Spring when creating a new instance of this actor.
score: 0

http://stackoverflow.com/a/26945477
has comment: http://stackoverflow.com/comment/42441934
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42443631
has comment: http://stackoverflow.com/comment/42581690
answers question: http://stackoverflow.com/q/26942269
has comment: http://stackoverflow.com/comment/42581009
has body: My gut tells me you should be using a ListView. This will cater well to generating Views on the fly for varying data types. Also, if you have a rather large list of results that can't fit onto the screen, The ListView will auto handle scrolling and will only maintain in memory the data that displays to the screen. On the other hand you'll need to wrap the TableLayout with a ScrollView and it will maintain all Views generated in memory...whether or not they are shown on the screen. You'll also need to setup a lot of boiler plate code just to get Views generated and attached to the main XML. In short, TableLayout would be great for static data. Going with the ListView approach, it sounds like you should be using a SimpleAdapter. Not to terribly common as they are only useful for certain situations. Honestly the name should be ListMapAdapter as that's how it stores and expects data to be passed to it...via a List of Maps and it can be more difficult to use then an ArrayAdapter because it has one of the most confusing constructors ever. Basically the SimpleAdapter is great for rendering table like layouts, where you have columns of data. Here's a basic example to give you an idea of how to use. This works for displaying Strings of data directly to a TextView. //Columns is used to assign a column to a TextView. So columns[1] will place all data //found in column 1 into to[1]...which is the TextView R.id.txt1. Columns is also used //to map which data item belongs to a particular column String[] columns = {"row_header", "column_name1", "column_name2", "column_name3"} int[] to = { R.id.row_header, R.id.txt1 ,R.id.txt2, R.id.txt3}; //This is where you will assemble the test data. Probably the most difficult part //as you must convert your test results into a List of Maps. Each index in the //List represents a row of data. The Map represents all the columns of data for //that row. List&lt;HashMap&lt;String, String&gt;&gt; data = new ArrayList&lt;HashMap&lt;String, String&gt;&…

http://stackoverflow.com/comment/42465399
type: AnswerComment
type: Comment
has text: Can you please add the info, that the same applies to the `while ( y > 0 && y < 9)` loop due to the missing braces? I don't like to write another answer because of this :).
score: 1
comment on: http://stackoverflow.com/a/26963777

http://stackoverflow.com/a/26968099
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26967924
has body: Whenever you are dealing with system io you need to ensure that you can handle all valid byte input values. However, you then need a mechanism to indicate that the stream has been exhausted. The javadoc for InputStream.read() (System.in is a global InputStream) says (emphasis added), Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. If you were to cast -1 to char you would get 65535 because char is unsigned. With byte, it's even worse in that -1 is a valid value. Regardless, you aren't reading char values; you are reading byte(s) encoded as int in the range 0-255 plus -1 to indicate end of stream. If you want char(s) I suggest you look at an InputStreamReader which is described in the javadoc as An InputStreamReader is a bridge from byte streams to character streams

http://stackoverflow.com/q/26901079
tagged with: if-statement
has answer: http://stackoverflow.com/a/26901104
answer count: 3
has body: How can I simplify this? The variable fuel is a boolean from a parent class named Vehicle. The useTax() method is an abstract method from the same Vehicle class. When I go about running checkstyle, it comes up with the string "Expression can be simplified." and highlights if (fuel == true). public double useTax() { double tax; if (fuel == true) { // &lt;-- why? tax = value * ALTERNATIVE_FUEL_TAX_RATE; } else { tax = value * TAX_RATE; } if (value &gt; LUXURY_THRESHOLD) { tax += value * LUXURY_TAX_RATE; } return tax; }
has title: Expression can be simplified. Checkstyle
favorite count: 0
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26901123
tagged with: checkstyle
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42354449
has answer: http://stackoverflow.com/a/26901102
type: Question
score: 5

http://stackoverflow.com/a/26855263
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: Your code says your Belt extends Observable. The rest comes form the javadoc: /** Adds an observer to the set of observers for this object, provided that it is not the same as some observer already in the set. */ public void addObserver(Observer o) So you need to add them to a set. Why? So you can tell them when something comes on the belt. How? Look at its javadoc: /** This method is called whenever the observed object is changed. An application calls an Observable object's notifyObservers method to have all the object's observers notified of the change. */ void update(Observable o, Object arg) So you need to call update when something changes. What? Read the question: send it an event telling it what happened? How? The core java API doesn't know what your problem is it nets you send an Object type which is your event which is something you created in your app to represent the event being passed to signal the change.
answers question: http://stackoverflow.com/q/26855133

http://stackoverflow.com/comment/42362030
type: Comment
comment on: http://stackoverflow.com/q/26904611
type: QuestionComment
has text: error java.lang.Exception: com.si.ecm.core.exception.WorkflowEngineException: WorkflowStepHandlerManager::OperationTypeHandler : org.hibernate.hql.ast.HqlToken cannot be cast to org.hibernate.hql.ast.HqlToken atcom.si.ecm.app.workflow.diagram.bo.Diagram.doProcess(Diagram.java:47) om.si.ecm.app.workflow.diagram.servlet.WorkflowDiagramHandlerServlet.doView(WorkflowDiagramHandlerServlet.java:38) at com.si.ecm.core.servlet.CoreServlet.doPost(CoreServlet.java:110) at javax.servlet.http.HttpServlet.service(HttpServlet.java:751) at javax.servlet.http.HttpServlet.service(HttpServlet.java:844)
score: 0

http://stackoverflow.com/a/26954468
has body: It seems that a required jar file is missing from your WEB-INF/lib folder that contains the class "com.microsoft.sqlserver.jdbc.SQLServerDriver". Please place the jar in the said folder and try again.
answers question: http://stackoverflow.com/q/26950197
score: 0
type: Answer

http://stackoverflow.com/a/26989069
type: Answer
has comment: http://stackoverflow.com/comment/42531599
has comment: http://stackoverflow.com/comment/42549182
answers question: http://stackoverflow.com/q/26983546
has body: You could do it with a separate class (can be nested to directly access the necessary GUI elements, if you only have to do your edits with informations from one class) which extends AbstractUndoableEdit. You can save the exact old state that you want to load after one undo operation and the exact new state which you want to reload after a redo operation. You can then set the correct values in the redo and undo methods directly by overriding them in the State class. This could look like this: public final class UndoManagerTestForJEditorPane { private final JEditorPane editor = new JEditorPane(); private final UndoManager undoManager = new UndoManager(); public JComponent makeUI() { editor.setContentType("text/html"); HTMLDocument document = (HTMLDocument) editor.getDocument(); //document.addUndoableEditListener(undoManager); -&gt; Not used anymore editor.setText("Hello"); JPanel p = new JPanel(); p.add(new JButton(new AbstractAction("undo") { @Override public void actionPerformed(ActionEvent e) { if (undoManager.canUndo()) { undoManager.undo(); } } })); // New class to hold the state and load the correct string class State extends AbstractUndoableEdit { String oldText; String newText; State(String oldText, String newText) { this.oldText = oldText; this.newText = newText; } @Override public void undo() throws CannotUndoException { editor.setText(oldText); } @Override public boolean canUndo() { return true; } @Override public void redo() throws CannotRedoException { editor.setText(newText); } @Override public boolean canRedo() { return true; } } p.add(new JButton(new AbstractAction("redo") { @Override public void actionPerformed(ActionEvent e) { if (undoManager.canRedo()) { undoManager.redo(); } } })); p.add(new JButton(new AbstractAction("setText(new Date())") { @Override public void actionPerformed(ActionEvent e) { String str = new Date().toString(); // Add a new edit by saving the old string (by calling getText) and the new string 'str' undoManager.addEdit(new State…
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42870543
has comment: http://stackoverflow.com/comment/42565009
has comment: http://stackoverflow.com/comment/42854792
has comment: http://stackoverflow.com/comment/42849422
downvote count: 0
has comment: http://stackoverflow.com/comment/42763631
has comment: http://stackoverflow.com/comment/42757538
has comment: http://stackoverflow.com/comment/42867038
has comment: http://stackoverflow.com/comment/42565549
has comment: http://stackoverflow.com/comment/42601807

http://stackoverflow.com/comment/42473175
has text: Can you outline what the class design would look like?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26968273

http://stackoverflow.com/a/26906387
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: You will have to remove the durable subscription manually and WLS will not remove to automatically https://docs.oracle.com/cd/E17904_01/web.1111/e15493/dist_topics.htm#WLMDB10013 Setting Automatic Deletion of Durable Subscriptions :- You can configure an MDB to automatically delete a durable topic subscription when the MDB is undeployed or deleted from a server. To configure an MDB to automatically delete durable topic subscriptions, set durable-subscription-deletion to True. By default, durable-subscription-deletion is set to False By default it is false and thus it will not clear the durable subscriber automatically.
answers question: http://stackoverflow.com/q/26887584

http://stackoverflow.com/comment/42248389
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26841806
has text: I see it is a servelet so you are in a webaplication using openJPA as ORM. Also it says that your ORM is loading one2one and one2many relations eager. This means the list (if it is one2many) should already be loaded. The problem now can only exist in the list implementation of openJPA.
type: Comment

http://stackoverflow.com/a/26870305
has body: Yes, or at least, nearly: use java.nio.file.WatchService for this. FileSystem filesystem = FileSystems.getDefault(); WatchService watcher = filesystem.newWatchService(); After this, you can register watch events using this watcher. Path dir = fileSystem.getPath("/tmp/file"); dir.register(watcher, StandardWatchEventKind.ENTRY_MODIFY); This won't tell you whether that specific area of the file changed, but it will notify you when there is some kind of change. This is the best you'll get, I think. If this isn't good enough, you could split the file into two pieces: a header (which you watch) and a body (which you don't).
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26870159
has comment: http://stackoverflow.com/comment/42300208

http://stackoverflow.com/a/79293336
has body: It can also be done through SceneBuilder 22.0.0 by adding a Style "-fx-show-delay" to the tooltip node and setting it to say "100ms". This works for me.
answers question: http://stackoverflow.com/q/26854301
score: 0
type: Answer

http://stackoverflow.com/comment/42283761
has text: @HareshChhelana ...How can I use date objects directly for my use case, are there any existing Stackoverflow answers for this kind of scenario ?
comment on: http://stackoverflow.com/q/26861706
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26919145
has title: Paint JLabel above another JLabel without JLayeredPane
type: Question
has body: Here's my application structure : one JFrame ---> which contain one Board1 (Board1 extends JPanel) ---> which contains some "Zone" (Zone extends JLabel with FlowLayout manager) ----> which contain some "Personnage" (extends JLabel) First I create all my JLabels in the JPanel's class: public class Board1 extends JPanel implements Board { private List&lt;Zone&gt; zones = new ArrayList&lt;Zone&gt;(); private List&lt;Personnage&gt; personnages = new ArrayList&lt;Personnage&gt;(); public Board1() { this.setLayout(null); zones.add(new Zone(1, false, true, null, "/zone1D1C.jpg", this)); zones.add(new Zone(2, false, false, null, "/zone2D1C.jpg", this)); zones.add(new Zone(3, false, false, null, "/zone3D1C.jpg", this)); zones.add(new Zone(4, true, false, null, "/zone4D1C.jpg", this)); zones.add(new Zone(5, false, false, null, "/zone5D1C.jpg", this)); zones.add(new Zone(6, true, false, null, "/zone6D1C.jpg", this)); zones.add(new Zone(7, true, false, null, "/zone7D1C.jpg", this)); zones.add(new Zone(8, false, false, null, "/zone8D1C.jpg", this)); personnages.add(new Survivant("Phil", zones.get(0), 3, "/phil.jpg")); for (Zone zone : zones) { this.add(zone); for (Personnage personnage : zone.getPersonnages()) { zone.add(personnage); } } } public void move_personnage(Zone zone) { running_personnage.moveZone(zone); zone.add(running_personnage); this.repaint(); } public void try_add_personnage() { Personnage douglas = new Survivant("Douglas", zones.get(3), 3, "/douglas.jpg"); zones.get(3).add(douglas); this.repaint(); } } The constructor is working good, I see my "personnage" above the "zone". move_personnage method is working too !!! It remove automatically the personnage from the previous zone. The problem is when I'm running try_add_personnage method, there is no JLabel above the zone. However I checked that the method is called etc... Whatever I do after the Board1 constructor, I can't add any kind of new visible Personnage above Zone. I guess it's with paintComponent method o…
score: 0
answer count: 1
tagged with: jlabel
tagged with: swing
type: AnsweredQuestion
tagged with: paint
has comment: http://stackoverflow.com/comment/42401310
tagged with: java
has answer: http://stackoverflow.com/a/26928908
accepted answer: http://stackoverflow.com/a/26928908

http://stackoverflow.com/a/26931958
has body: It is clearly given in the stack trace. The meta-data tag in your app's AndroidManifest.xml does not have the right value. Expected 6111000 but found 0. You must have the following declaration within the element: &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; You might have imported google play services as a library, but not added this line to the manifest.
answers question: http://stackoverflow.com/q/26931796
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42409363
type: Answer
has comment: http://stackoverflow.com/comment/42411062
upvote count: 1
has comment: http://stackoverflow.com/comment/42410349
has comment: http://stackoverflow.com/comment/42412354

http://stackoverflow.com/comment/42254488
score: 0
type: Comment
type: QuestionComment
has text: It was working fine on my side tho
comment on: http://stackoverflow.com/q/26845344

http://stackoverflow.com/comment/42426790
comment on: http://stackoverflow.com/a/26882212
score: 0
type: AnswerComment
has text: I corrected the typo "r" before running my program otherwise it wouldn't have compiled.Secondly now that its running,i have more than one row in my table and already had an idea about these two ResultSet next() functions.So i corrected all these but it still didn't run. I think the best thing is not to pass ResultSet as an attribute because it cannot be serialized or closed at that time.So it causes a lot of memory leak.So the best idea is to either use odt or use JSTL tags.
type: Comment

http://stackoverflow.com/a/26980037
downvote count: 0
has comment: http://stackoverflow.com/comment/42494376
answers question: http://stackoverflow.com/q/26979939
has comment: http://stackoverflow.com/comment/42494358
has comment: http://stackoverflow.com/comment/42494729
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42494391
has body: Try this: Iterator&lt;Character&gt; iter = u.iterator(); while (iter.hasNext()) { Character currentChar = iter.next(); if(k==1){ //base case if(isAnswer(s+u.get(0))) System.out.println(s+u.get(0)+" is the correct sequence."+ '\n'); return; } else{ iter.remove(); puzzleSolve(k-1, s+currentChar , u); u.add(currentChar); removeLastChar(s); } }

http://stackoverflow.com/comment/42312394
comment on: http://stackoverflow.com/q/26877611
type: Comment
type: QuestionComment
has text: what does the hand list look like before it enters the for loop?
score: 0

http://stackoverflow.com/q/26929199
tagged with: sql
answer count: 1
has answer: http://stackoverflow.com/a/26930072
type: UnansweredQuestion
has body: Given the simplified model: public class Access { private Set&lt;Tag&gt; tags; } public class Item { private Set&lt;Tag&gt; tags; } An access grant the access on every items that fully contains his tags, no problem if the item has more tags or not. But I have no idea how to create an hibernate criteria query for this. Could you help me?
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/17385579
type: Question
has title: Hibernate criteria list must contains another list
score: 0

http://stackoverflow.com/q/26916750
tagged with: truststore
has title: Extending expiration date of trustedCertEntry within a keystore
upvote count: 7
downvote count: 1
has answer: http://stackoverflow.com/a/26917416
accepted answer: http://stackoverflow.com/a/26917416
favorite count: 0
tagged with: keystore
score: 6
has body: Using keytool, I am trying to extend the expiration date of a trustedCertEntry within a keystore that I have. The keystore has the contents below $ keytool -list -keystore certs/authTruststore.jks Enter keystore password: Keystore type: JKS Keystore provider: SUN Your keystore contains 3 entries sts, Nov 11, 2013, trustedCertEntry, Certificate fingerprint (SHA1): 8D:33:B7:69:DE:75:8F:22:E2:95:2C:EB:93:65:41:31:42:A6:E3:A7 __ localhost, Nov 11, 2013, PrivateKeyEntry, Certificate fingerprint (SHA1): F4:A9:84:1E:7F:BF:5D:71:58:74:E4:C6:00:49:37:49:38:3E:31:BE __ security_localhost, Nov 11, 2013, trustedCertEntry, Certificate fingerprint (SHA1): 6B:F8:E1:36:EB:36:D4:A5:6E:A0:5C:7A:E4:B9:A4:5B:63:BF:97:5D I can successfully modify the expiration date of the second entry, localhost of type PrivateKeyEntry but when attempting to modify the expirations of the other two with the same command I get the following error: $ keytool -selfcert -v -alias security_localhost -validity 3650 -keystore certs/authTruststore.jks -storepass **** keytool error: java.lang.Exception: Alias &lt;localhost&gt; has no key java.lang.Exception: Alias &lt;localhost&gt; has no key at sun.security.tools.KeyTool.recoverKey(KeyTool.java:3095) at sun.security.tools.KeyTool.doSelfCert(KeyTool.java:2442) at sun.security.tools.KeyTool.doCommands(KeyTool.java:1071) at sun.security.tools.KeyTool.run(KeyTool.java:340) at sun.security.tools.KeyTool.main(KeyTool.java:333) How can I go about extending these expiration dates?
type: AnsweredQuestion
tagged with: java
tagged with: certificate
type: Question
tagged with: private-key
answer count: 1

http://stackoverflow.com/q/26960473
has answer: http://stackoverflow.com/a/26960567
tagged with: unit-testing
type: Question
tagged with: lines-of-code
tagged with: java
score: 0
tagged with: instrumentation
answer count: 1
has comment: http://stackoverflow.com/comment/42459508
has title: Count number of times LOC has executed in **PROD** - for java app
has body: I am working on a distributed application with 50 different modules. These have very less test coverage. Clearly,I need to prioritize which modules/classes needs testing. Is there a way to understand how many times a given line of code has been executed in prod (and, which class is used at what frequency by real time production usage pattern) for say a week ? I mention prod as this instrumentation should not affect the already running code due to obvious sensitive reasons. We use maven for deployment. I heard, corbetura can come in handy for this use case-but,could not find how from their documentation. Any one did a similar thing before ? Note that assumption is there are no unit test cases in the already running code at production.
type: UnansweredQuestion
tagged with: maven

http://stackoverflow.com/comment/42501497
score: 0
comment on: http://stackoverflow.com/q/26983718
type: Comment
type: QuestionComment
has text: Please clarify which bits in your diagram are the 'first' bits. Tell us the base-10 value of 'current value'.

http://stackoverflow.com/comment/42429602
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26943195
has text: Can you add the exact error message and stacktrace to your question?

http://stackoverflow.com/comment/42351676
score: 0
type: Comment
has text: @simbo1905 export from Eclipse.
type: QuestionComment
comment on: http://stackoverflow.com/q/26883090

http://stackoverflow.com/comment/42348235
type: Comment
type: QuestionComment
has text: @Chris , I edited 'Class' to 'class', just fyi
comment on: http://stackoverflow.com/q/26897198
score: 0

http://stackoverflow.com/comment/42276466
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26856624
has text: No. Your instance variables are realPart and imaginaryPart

http://stackoverflow.com/a/26874366
has body: You're probably running on Java 1.8u11 or 1.7u65. Try updating to JDK 1.8u25 or 1.7u72. In 1.8u11 verifier rules were changed and it affected quite a few tools and libraries that excel in bytecode manipulation. Here's the issue description.
score: 2
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/42314256
answers question: http://stackoverflow.com/q/26873284

http://stackoverflow.com/a/26923834
downvote count: 0
has body: Try below code: if(array.get(i).contain("Me")){ String value = array.get(i).split(":")[0]; String value1 = array.get(i).split(":")[1]; String main_value = "&lt;b&gt;"+value +":&lt;/b&gt; "+ value1; txt.setText( Html.fromHtml(main_value)); }
type: Answer
has comment: http://stackoverflow.com/comment/42394743
answers question: http://stackoverflow.com/q/26923782
has comment: http://stackoverflow.com/comment/42394804
upvote count: 4
score: 4
accepted answer of: http://stackoverflow.com/q/26923782
type: AcceptedAnswer

http://stackoverflow.com/comment/42293099
score: 0
type: Comment
type: QuestionComment
has text: For Oracle Java...take a look here:http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html
comment on: http://stackoverflow.com/q/26866770

http://stackoverflow.com/a/26952684
downvote count: 0
has body: It's safe if list has been checked for null. For example, int len = (list != null) ? list.length : 0; for (int j = 0; j &lt; len; j++) Then len will be 0 if list is null. In your posted version, when list = null; you could get a NullPointerException.
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26952569
answers question: http://stackoverflow.com/q/26952569

http://stackoverflow.com/a/26972854
has comment: http://stackoverflow.com/comment/42481494
has comment: http://stackoverflow.com/comment/42481540
has body: Simply no. JavaScript/Jquery is restricted to perform such operations due to security reasons. The best way to achieve this, would be, to send a request to the server that would write the new file on the server. Then from javascript perform a POST request to the server page passing the data you want to write to the new file.
score: 0
answers question: http://stackoverflow.com/q/26972773
type: Answer

http://stackoverflow.com/comment/42430909
comment on: http://stackoverflow.com/a/26943913
type: AnswerComment
type: Comment
has text: @Gpar Please don't ask new questions in comments - you should ask a separate question for that.
score: 3

http://stackoverflow.com/q/26932414
has body: Would someone be able to give an example on using Platform.runLater and SwingUtilities.invokeLater with javaFX. I have attempted to use both and I am receiving the message : Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: Error: class Window$2 is not a subclass of javafx.application.Application at javafx.application.Application.launch(Unknown Source) at Window$2.run(Window.java:50) at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$47/389777815.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source) at com.sun.javafx.application.PlatformImpl$$Lambda$46/1775282465.run(Unknown Source) at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source) at com.sun.glass.ui.win.WinApplication$$Lambda$37/1109371569.run(Unknown Source) at java.lang.Thread.run(Unknown Source) The Class file is called Window and I not sure why it is saying Window$2, I would assume the $2 is some garbage from the memory printing out on the error. The code I am using is below. arguments is a static String[] since args is a not static. Also, when I use launch(Window.class, arguments); it throws the error then disappears quick but when I don't include Window.class it does not work at all. Shouldn't it assume it is calling the launch method from the same class? Also, launch(args) works fine outside the methods. public static void main (String[] args) { arguments = new String[args.length]; System.arraycopy(args, 0, arguments, 0, args.length); Platform.runLater(new Runnable() { @Override public void run() { launch(arguments); } }); /* SwingUtilities.invokeLater(new Runnable() { public void run() { launch(Window.class, arguments); } }); */ //launch(args); }
has comment: http://stackoverflow.com/comment/42412457
has answer: http://stackoverflow.com/a/26934047
has comment: http://stackoverflow.com/comment/42409972
has title: JavaFX using Platform.runLater and SwingUtilities.involkeLater
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42410699
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26934047
type: Question
has comment: http://stackoverflow.com/comment/42409871
answer count: 1

http://stackoverflow.com/a/26878180
score: 2
answers question: http://stackoverflow.com/q/26878111
has body: Look at Apache Commons CLI, it would almost certainly be better than trying to "convert" (kludge) a program that is currently using Scanner. You can just insert newlines in the command line arguments if you really need to. public static void main( String[] args ) { StringBuilder cla = new StringBuilder(); for( String command : args ) { cla.append( command ); cla.append( '\n' ); // newline } String finalCommand = cla.toString(); }
upvote count: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26878111
has comment: http://stackoverflow.com/comment/42313449

http://stackoverflow.com/comment/42252865
has text: @MarkoTopolnik Hmm, what about the `Class` object which the static method operates on? The scope of static methods would still depend on the classloader the class is associated with, wouldn't it?
type: QuestionComment
comment on: http://stackoverflow.com/q/26844413
score: 0
type: Comment

http://stackoverflow.com/comment/42368285
has text: your added log says inflate exception, so check out XML which is inflated in LockPatternActivity (if you have there custom Views from lib you must use full packacke, e.g. <com.lib.views.LockView .../>, it's common problem for users to use LockView). probably you've properly imported lib and problem isn't on this side
comment on: http://stackoverflow.com/a/26909158
score: 0
type: AnswerComment
type: Comment

nested-if
tags question: http://stackoverflow.com/q/26854930
tag name: nested-if
type: Tag

http://stackoverflow.com/q/26939366
tagged with: java
has title: Custom painted JButton shows artifacts on hover
tagged with: custom-painting
type: Question
has comment: http://stackoverflow.com/comment/42423795
has comment: http://stackoverflow.com/comment/42422992
score: 0
has comment: http://stackoverflow.com/comment/42423690
has comment: http://stackoverflow.com/comment/42424354
has comment: http://stackoverflow.com/comment/42425850
has body: I'm writing little game that requires small buttons over custom painted JPanel. My solution is quite simple, but it has some issues. class TargetButton extends JButton { private Point point; public TargetButton(Point point) { this.point = point; } public Point getPoint() { return point; } @Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; g2.setPaint(Color.RED.darker()); g2.draw(new Ellipse2D.Double(0, 0, getWidth()-1, getHeight()-1)); } } They are created like this: public void setTargets(List&lt;Point&gt; pts) { for (Point point : pts) { TargetButton target = new TargetButton(point); targets.add(target); // list of target buttons target.setBounds((int)__(point.getX()), (int)__(point.getY()), (int)(track.getWidth()*scale/resolution), (int)(track.getWidth()*scale/resolution)); target.addActionListener(this); add(target); } invalidate(); repaint(); } Buttons are displayed correctly as circles, but when I hover them, they are painted over black or white background, which looks quite ugly. I'm not calling super.paintComponent(g) because I don't want default look to be painted. I also tried to extend AbstractButton, but it doesn't respond to clicks.
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton
answer count: 0

http://stackoverflow.com/comment/42369550
comment on: http://stackoverflow.com/q/26909968
has text: So your problem is displaying the content of the array?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26941101
answers question: http://stackoverflow.com/q/26938198
has body: I am not sure if I got your question. If you are looking for a way to select all diagonal cells when a queen is places then it is known that those cells would occur in |i-j| (i.e. the absolute value). Here is a code where whenever Squares[indx1,indx2] is pressed, will do something with the diagonal cells... Does that make sense? public static void pressed(int indx1,int indx2){ // Squares[indx1][indx2] is pressed // Assign 1 to diagonal cells for(int i=0;i&lt;Squares.length;i++) for(int j=0;j&lt;Squares.length;j++) if(Math.abs(indx1-i)==Math.abs(indx2-j)) Squares[i][j]=1; }
score: 0
type: Answer

http://stackoverflow.com/comment/42490096
has text: @tokola add a comment: `// NullPointerException occurs here:`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26977548

http://stackoverflow.com/q/26943492
has comment: http://stackoverflow.com/comment/42430093
tagged with: synchronization
has body: I am using a method similar to following to synchronize access to a map. public class Foo { private Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;(); public void add(String key, String value) { synchronized (map) { map.put(key, value); } } public String get(String key) { synchronized (map) { return map.get(key); } } } Does this block a thread which is calling Foo.get() from accessing map when another thread is executing map.put() in Foo.add()? I'm fairly new to Java and searched for a reference to what synchronized(object) {} does but couldn't find a proper reference. Can somebody point me to a reference which specifies the functionality?
accepted answer: http://stackoverflow.com/a/26943641
tagged with: multithreading
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42430274
type: Question
has title: Synchronize access to map in Java
type: AnsweredQuestion
tagged with: java
tagged with: thread-safety
answer count: 1
has answer: http://stackoverflow.com/a/26943641
favorite count: 0
score: 0

http://stackoverflow.com/a/26960269
has comment: http://stackoverflow.com/comment/42458993
has comment: http://stackoverflow.com/comment/42459163
upvote count: 1
has body: For a 10 number Non Repeating Array of numbers 1-100, I would use Random.nextInt(int) and a LinkedHashSet (because it preserves insertion order and prevents duplicates) and something like, int[] arr = new int[10]; Random rand = new Random(); Set&lt;Integer&gt; set = new LinkedHashSet&lt;&gt;(); while (set.size() &lt; arr.length) { set.add(rand.nextInt(100) + 1); } // Copy the Set to the array. int pos = 0; for (Integer v : set) { arr[pos++] = v; } System.out.println(Arrays.toString(arr)); Edit Based on your comments, start by writing a contains method to loop through the array from the left to a given index on the right looking for a value like private static boolean contains(int[] arr, int v, int pos) { for (int i = 0; i &lt; pos; i++) { if (arr[i] == v) { return true; } } return false; } Then use that to make sure you don't enter the same value more then once in the array call contains like int[] arr = new int[10]; Random rand = new Random(); int pos = 0; while (pos &lt; arr.length) { int val = rand.nextInt(100) + 1; if (!contains(arr, val, pos)) { arr[pos++] = val; } }
has comment: http://stackoverflow.com/comment/42458912
has comment: http://stackoverflow.com/comment/42458942
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42459078
type: Answer
answers question: http://stackoverflow.com/q/26960158

http://stackoverflow.com/comment/42400617
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26927225
has text: Astha, visit this link it may helpful to you : http://stackoverflow.com/questions/6368704/java-lang-noclassdeffounderror-javax-activation-datahandler-in-android

http://stackoverflow.com/comment/43017106
has text: Just for information: This question is answered (in my opinion, i'm the questioner)), see this answer and the comments at my questions.
comment on: http://stackoverflow.com/a/26929451
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42339208
type: Comment
comment on: http://stackoverflow.com/a/26892601
has text: Syntax error on token "final", float expected when I put it in class and out of method
type: AnswerComment
score: 0

http://stackoverflow.com/a/26858282
score: 2
downvote count: 0
has body: You may use Apache's CollectionUtils for this purpose if you want an abstraction from the implementation logic.E.g: public static void main(String[] args) { List&lt;Integer&gt; list1=Arrays.asList(1,2,4,6,7); List&lt;Integer&gt; list2=Arrays.asList(2,3,4,6,7); System.out.println(CollectionUtils.disjunction(list1,list2)); }
upvote count: 2
answers question: http://stackoverflow.com/q/26857587
type: Answer

http://stackoverflow.com/a/26871941
accepted answer of: http://stackoverflow.com/q/26871483
has comment: http://stackoverflow.com/comment/42310838
answers question: http://stackoverflow.com/q/26871483
has comment: http://stackoverflow.com/comment/42302693
score: 1
has comment: http://stackoverflow.com/comment/42340112
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42303442
type: Answer
has body: With an XmlAdapter on a Map (to convert the Map to a domain object with a List of Register objects) you are going to be able to produce/consume XML that looks like the following (Note the addition of the registers element): <field description = "blabla" type = "blabla"> <field description = "blabla" type = "blabla"> If you use EclipseLink MOXy as your JAXB provider, then you can use our @XmlPath extension to get rid of that extra element. @XmlJavaTypeAdapter(MapAdapter.class) // Standard JAXB annotation @XmlPath(".") // MOXy extension private Map<String, Register> registers; UPDATE Unfortunatelly I can't use MOXy in this project and I can't change the xml. Is there any way of parsing it without the registers tag? This isn't the prettiest solution, but you could do the following (note: with this solution it is not safe to marshal the same instance of Root concurrently): import java.util.*; import javax.xml.bind.annotation.*; @XmlRootElement public class Root { private Map<String, Register> registers = new HashMap<String, Register>(); @XmlElement(name="register") private Collection registerCollection; @XmlTransient public Map<String, Register> getRegisters() { return registers; } public void setRegisters(Map<String, Register> registers) { this.registers = registers; } private void afterUnmarshal(Unmarshaller unmarshaller, Object parent) { for (Register register : registerCollection) { regusters.put(register.getType()); } } private void beforeMarshal(Marshaller marshaller) { if(null != registers) { registerCollection = registers.values(); } } }
downvote count: 0

http://stackoverflow.com/a/26925381
answers question: http://stackoverflow.com/q/26925275
downvote count: 0
has body: You just create an empty file in your FileSave. You have to return selected file name from the method and use the returned filename in the call FileOutputStream fileOut = new FileOutputStream(filename) BWT java code convention supposes to have method names don't start from capital letter
type: Answer
has comment: http://stackoverflow.com/comment/42398396
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/42400576
has comment: http://stackoverflow.com/comment/42397474

http://stackoverflow.com/q/26908311
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26908499
possible better answer: http://stackoverflow.com/a/26908391
has title: Having issues with generating 1 to 300 numbers between 1 to 100 and placing each number in a String
answer count: 3
tagged with: loops
tagged with: output
upvote count: 1
has answer: http://stackoverflow.com/a/26908391
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/26909283
has answer: http://stackoverflow.com/a/26908499
tagged with: random
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42368507
downvote count: 0
score: 1
has body: I'm trying to accept a number in the range 1 to 300 from the user, then generate the amount of random numbers that was inputted. Then if the numbers generated are in the range 1 to 10, I add an asterisk to a String, then I do the same for 11 to 20 etc. all the way up to 100. Although I keep getting errors saying "; expected" in the results portion of my code. The output I'm trying to achieve is: 1 to 10 **************** 11 to 20 ****** 21 to 30 *************** 31 to 40 ******************** 41 to 50 51 to 60 *********** 61 to 70 **************** 71 to 80 **** 81 to 90 ******* 91 to 100 ** The asterisks above may not add up to 100, but I'm trying to get 100 asterisks displayed in the output, each one representing a random generated number in the range __ to __. The code I have is below. import java.util.*; public class histogramAsterisks { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Please enter a number between the range 1 to 300: "); int input = Integer.parseInt(in.nextLine()); int aNumber; String 1to10 = "", 11to20 = "", 21to30= "", 31to40 = "", 41to50 = ""; 51to50 = ""; 61to70 = ""; 71to80 = ""; 81to90 = ""; 91to100 = "", results = ""; if(input &lt; 1 || input &gt; 300 || input == null) results = "Please enter a valid input in the range 1 to 300."; else { for(int i = 0; i &lt; input; i++) { aNumber = (int) (Math.random() * 100 + 1); if(aNumber &lt;= 10) 1to10 += "*"; else if(aNumber &lt;= 20) 11to20 += "*"; else if(aNumber &lt;= 30) 21to30 += "*"; else if(aNumber &lt;= 40) 31to40 += "*"; else if(aNumber &lt;= 50) 41to50 += "*"; else if(aNumber &lt;= 60) 51to60 += "*"; else if(aNumber &lt;= 70) 61to70 += "*"; else if(aNumber &lt;= 80) 71to80 += "*"; else if(aNumber &lt;= 90) 81to90 += "*"; else 91to100 += "*"; } } results = "1 to 10\t\t\t" + 1to10; results += "\n11 to 20\t\t\t" + 11to20; results += "\n21 to 30\t\t\t" + 21to30; results += "\n31 to 40\t\t\t" + 31to40; results += "\n41 to 50\t\t\t" + 41to50; results …

http://stackoverflow.com/a/27023774
type: Answer
answers question: http://stackoverflow.com/q/26940693
has body: I forgot to close this. Anyways, the answer lies on the GSON jar file not existing in the Wowza lib directory ([wowza-install-dir]/lib). Thanks to jabal.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26940693

http://stackoverflow.com/comment/42501344
type: Comment
has text: I think the problem is with your test class...
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26983579

http://stackoverflow.com/a/26848836
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26848759
has comment: http://stackoverflow.com/comment/42260582
type: Answer
has body: You should do: sdfDate.format(data); This is the correct way to use your dateformatter to format a given date. Ex. System.out.println("Date: " + sdfDate.format(data));
has comment: http://stackoverflow.com/comment/42260600
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26848759
score: 1
has comment: http://stackoverflow.com/comment/42260542
has comment: http://stackoverflow.com/comment/42260789

http://stackoverflow.com/comment/86599059
has text: can u please join this group https://chat.stackoverflow.com/rooms/168806/aws-dynamodb?
score: 0
comment on: http://stackoverflow.com/a/38281210
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42298535
type: Comment
has text: **what is ordinary variables?** did you mean Class Variables ?
comment on: http://stackoverflow.com/a/26869772
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42436521
comment on: http://stackoverflow.com/a/26945404
score: 0
type: AnswerComment
has text: There is one problem why does it returns null to myFragment... I checked in docs, it said getFragmentById returns fragment or null, why it is not able to find the content_frame fragment.
type: Comment

http://stackoverflow.com/a/26953293
type: Answer
has comment: http://stackoverflow.com/comment/42502446
has comment: http://stackoverflow.com/comment/42501211
answers question: http://stackoverflow.com/q/26953250
has comment: http://stackoverflow.com/comment/42502384
score: 0
has body: Change your for loop to for (int i=0; i&lt;pX.size()-1; i++) { iteration should be px.size() - 1 so your pX.get(i+1) would not cause IndexOutOfBoundsException exception.

http://stackoverflow.com/comment/42426312
has text: Use some kind of call back to the entity manager...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26919763

http://stackoverflow.com/q/26961387
type: Question
accepted answer: http://stackoverflow.com/a/26961478
tagged with: algorithm
has comment: http://stackoverflow.com/comment/42461089
has answer: http://stackoverflow.com/a/26961478
has title: Traversing a tree, but each node visited should visit every node underneath
upvote count: 1
answer count: 1
has body: I am traversing a tree, which is easy and I know how to do this. However, I want to visit each node beneath the current node each iteration. I'm not sure I'm being clear so I will try to illustrate this: A / \ B C / \ / \ D E F G 1st iteration: Node is A: visits B, C, D, E, F, G 2nd iteration: Node is B: visits D, E 2nd iteration: Node is D: visits F, G I tried writing this as a normal traversal as so: public static void addCodes(Message root) { if (root.getLeftChild() != null){ root.getLeftChild().setCode(root.getLeftChild().getCode() + "0"); addCodes(root.getLeftChild()); } if (root.getRightChild() != null) { root.getRightChild().setCode(root.getRightChild().getCode() + "1"); addCodes(root.getRightChild()); } } but this obviously does not work. Each node is visited one time. I understand why, I just don't know how to fix it. If this were iterative, it would be nested loops. What's the recursive equivalent of this?
favorite count: 0
has comment: http://stackoverflow.com/comment/42461076
tagged with: recursion
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java

wildfly
tags question: http://stackoverflow.com/q/26978659
tags question: http://stackoverflow.com/q/26882254
tags question: http://stackoverflow.com/q/26842375
type: Tag
tags question: http://stackoverflow.com/q/26832663
tags question: http://stackoverflow.com/q/26927157
tags question: http://stackoverflow.com/q/26906852
tag name: wildfly
tags question: http://stackoverflow.com/q/26941725

http://stackoverflow.com/q/26918374
has answer: http://stackoverflow.com/a/26935858
type: Question
tagged with: java
tagged with: websphere-7
tagged with: websphere
has title: WebSphere error 404 SRVE0295E
accepted answer: http://stackoverflow.com/a/26935858
answer count: 1
has comment: http://stackoverflow.com/comment/42414713
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/42386877
has body: I've got a strange problem where an application I'm deploying to WebSphere can't seem to access its resources. I can access the main page just fine, but when index.jsp tries to reference the Javascript file it relies on, it gets a 404. Specifically, "Error 404: SRVE0295E: Error reported: 404". The Javascript is referenced as &lt;script type="text/javascript" src="/contextRoot/someDir/scripts/myJavascript.js"&gt;&lt;/script&gt; The main entry page for the site is located at http://localhost:9080/contextRoot/index.jsp and it loads fine. If I try to navigate my browser to http://localhost:9080/contextRoot/someDir/scripts/myJavascript.js I get Error 404: SRVE0295E, even though the path to the file in my WebSphere installed application $myCell/myApp.ear/myWARModule.war/index.jsp and $myCell/myApp.ear/myWARModule.war/someDir/scripts/myJavascript.js are both valid, the only resource I can access from a browser is index.jsp. Does anyone know what could cause this error? (Running on WebSphere 7.0.0.29)

http://stackoverflow.com/q/26867840
answer count: 1
has body: As a part of project implementation,I have done: 1. Generete DSA keys 2. Encrypt the private key using AES 3. Save into the file 4. Open the file and read the encrypted private key 5. I tried to convert the read value into primary key format import java.security.spec.EncodedKeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.Security; import java.io.File; import java.security.KeyFactory; import java.security.PrivateKey; import java.security.Signature; import java.security.spec.PKCS8EncodedKeySpec; import java.io.*; import java.security.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.SecretKeySpec; public class Pgm { public static void main(String[] args) { try { KeyPairGenerator dsa = KeyPairGenerator.getInstance("DSA"); SecureRandom random = new SecureRandom(); dsa.initialize(1024, random); KeyPair keypair = dsa.generateKeyPair(); PrivateKey privateKey = (PrivateKey) keypair.getPrivate(); byte[] key = "�u���1Ù�iw&amp;a".getBytes(); Key aesKey = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES"); String currentDir = System.getProperty("user.dir"); // encrypt the text cipher.init(Cipher.ENCRYPT_MODE, aesKey); byte[] abc = privateKey.getEncoded(); byte[] encrypted = cipher.doFinal(abc); // System.out.println("len="+encrypted.length()); File dir = new File(currentDir); File private_file = new File(dir, "privatekey.txt"); if (!private_file.exists()) { private_file.createNewFile(); } FileOutputStream fileos = new FileOutputStream(private_file); ObjectOutputStream objectos = new ObjectOutputStream(fileos); objectos.writeObject(encrypted); objectos.close(); fileos.close(); File file_private = new File(dir, "privatekey.txt"); FileInputStream fileo = new FileInputStream(file_private); ObjectInputStream objos = new ObjectInputSt…
favorite count: 0
has comment: http://stackoverflow.com/comment/42295207
tagged with: encryption
tagged with: dsa
tagged with: cryptography
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26874410
tagged with: java
has title: java.security.spec.InvalidKeySpecException and Inappropriate key specification error in java program
type: Question
has comment: http://stackoverflow.com/comment/42297724
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42296963
upvote count: 4
has answer: http://stackoverflow.com/a/26874410

http://stackoverflow.com/q/26860762
possible better answer: http://stackoverflow.com/a/31876777
downvote count: 0
has answer: http://stackoverflow.com/a/31876777
has body: Herewith I added my source code of web.xml <?xml version="1.0" encoding="UTF-8"?> ussd init /init.jsp 1 javax.ws.rs.core.Application com.dialog.mife.ussd.api.USSDApplication resteasy.providers com.dialog.mife.ussd.exception.NotFoundException resteasy.servlet.mapping.prefix / org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap Resteasy org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher ServletAdaptor com.sun.jersey.spi.container.servlet.ServletContainer 1 Resteasy /* ServletAdaptor /webresources/* Hibernate.cfg.xml. My Web service project goes with Jersey+Hibernate.. <hibernate-configuration> false com.mysql.jdbc.Driver xxx jdbc:mysql://localhost:3306/USSD root org.hibernate.dialect.MySQLDialect true update org.hibernate.transaction.JDBCTransactionFactory 1 true <mapping class="com.xxx.xxx.xxx.xxx.Application" /> </hibernate-configuration> Here is HibernateUtil Class public class HibernateUtil { private static final SessionFactory sessionFactory; static { try { sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Exception ex) { ex.printStackTrace(); throw new ExceptionInInitializerError(ex); } } Here is my error I added Hibernate latest jar files. [hibernate-core-4.3.7.Final.jar] SEVERE: StandardWrapper.Throwable java.lang.NoClassDefFoundError: Could not initialize class com.dialog.mife.ussd.util.HibernateUtil at org.apache.jsp.init_jsp.jspInit(init_jsp.java:23) at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:48) at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:180) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) at org.apache.jasper.servlet.JspServlet.init(JspServlet.java:138) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193) at org.apache.catalina…
has answer: http://stackoverflow.com/a/26861044
has comment: http://stackoverflow.com/comment/42282819
has answer: http://stackoverflow.com/a/26861199
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26860940
has answer: http://stackoverflow.com/a/43117783
type: AnsweredQuestion
has title: java.lang.NoClassDefFoundError: Could not initialize class xxx.xxx.xxx.HibernateUtil
upvote count: 5
accepted answer: http://stackoverflow.com/a/26861199
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/42282636
score: 5
tagged with: jersey

command
tags question: http://stackoverflow.com/q/26880403
tag name: command
tags question: http://stackoverflow.com/q/26921011
tags question: http://stackoverflow.com/q/26909996
type: Tag

http://stackoverflow.com/comment/42468730
type: Comment
type: QuestionComment
has text: The error is like, multiple lines on logcat. Is there a way to copy it all?
score: 0
comment on: http://stackoverflow.com/q/26965287

http://stackoverflow.com/a/26959399
has body: You can marshal it to a StringWriter and grab its string. from toString().
score: 6
answers question: http://stackoverflow.com/q/26959343
upvote count: 9
downvote count: 3
has comment: http://stackoverflow.com/comment/42457389
has comment: http://stackoverflow.com/comment/42457327
has comment: http://stackoverflow.com/comment/42457492
has comment: http://stackoverflow.com/comment/42457626
has comment: http://stackoverflow.com/comment/42457460
type: Answer

http://stackoverflow.com/q/26855846
downvote count: 1
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
has title: java input must take from customer and it must be in sequential way
has body: Write a java program to ask the user for his/her name, age, and salary (double). Follow the input/output format. Following conversation should be displayed as output on screen, where you will enter the values of name,age and salary. Suppose your inputs are: John 22 500 Expected Output: Hello. What is your name? Hi John! How old are you? So you're 22 eh? That's not old at all! How much do you make John? 500.0! I hope that's per hour and not per year! LOL! i try to solve like this import java.util.Scanner; class Enquiry { public static void main(String args[]) { Scanner scanner=new Scanner(System.in); do{ System.out.println("Hello. What is your name?"); string name1 = scanner.nextString(); } while(name1 != null) { System.out.println("Hi" +name1 "! How old are you?"); int age = scanner.nextInt(); } while(age != null) { System.out.println("So you're" +age "eh? That's not old at all!"); System.out.println("How much do you make John?"); double salary = scanner.nextDouble(); } while(salary != null) { System.out.println(+salary"! I hope that's per hour and not per year! LOL!"); } } } can any one help me how to solve this and what are mistakes done by me thanks and really appreciate your help
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26855970

http://stackoverflow.com/comment/42375443
type: QuestionComment
comment on: http://stackoverflow.com/q/26911812
score: 0
has text: Please edit this question, if you have something new to say. Don't post the answer unless it is the answer.
type: Comment

http://stackoverflow.com/comment/42316638
comment on: http://stackoverflow.com/a/26878590
has text: Ok I'm getting a new error now I just posted in my OC. I'm trying to direct the codebase to -Djava.rmi.server.codebase=file:/C:/Users/Admin/Desktop/Codebase.jar
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42442606
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26950589
has text: Here's a an example of the problem. If your create a panel and add a mixture of components and JScrollPanes (with, let's says JTextComponents), the inner scroll panes will consume mouse events that normally would go to the outer scrollpane. You could attach an AWTEventListener via the Toolkit and monitor for things like mouse moved, but you'd need to determine if the source is a child of your JScrollPane...

typeconverter
type: Tag
tags question: http://stackoverflow.com/q/26968737
tag name: typeconverter

http://stackoverflow.com/q/26915707
has title: Hadoop MapReduce does not process/ output is wrong?
score: 0
has body: I'm stuck with Hadoop giving me weird output or not processing the MapReduce at all. Even if it succeeded the output is wrong, and to me it seems like the code is right. What I am trying to do is parse and count the length of a string which I would like to parse every 4 ";" symbols as the data is joined together (like customerID;date;jobdescription;associations etc etc just one big string). That's my code: Mapper: import java.io.IOException; import java.util.StringTokenizer; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class TwitterMapper extends Mapper&lt;Object, Text, IntWritable, IntWritable&gt; { //private final IntWritable one = new IntWritable(1); // private Text = new Text(); private final IntWritable one = new IntWritable(1); private final IntWritable length = new IntWritable(); public void map(Object key, Text value, Context context) throws IOException, InterruptedException { // Format per tweet is id;date;hashtags;tweet; String dump = value.toString(); int startIndex = 1; if(StringUtils.ordinalIndexOf(dump, ";", 4) &gt; -1){ startIndex = StringUtils.ordinalIndexOf(dump,";",3) + 1; String tweet = dump.substring(startIndex,dump.lastIndexOf(';')); //data.set(tweet.length()); one.set(tweet.length()); context.write(one,length); //context.write(dump,length); //length.set(); } } } Reducer: import java.io.IOException; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; public class TwitterReducer extends Reducer&lt;IntWritable, IntWritable, IntWritable, IntWritable&gt; { private IntWritable result = new IntWritable(); public void reduce(IntWritable key, Iterable&lt;IntWritable&gt; values, Context context) throws IOException, InterruptedException { int sum = 0; for (IntWritable value : values) { sum = sum + value.get(); } result.set(sum); context.write(key, result); } } Output …
answer count: 1
tagged with: hdfs
tagged with: string
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42475350
has comment: http://stackoverflow.com/comment/42433062
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/26926720
has comment: http://stackoverflow.com/comment/42393953

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/26872087
tag name: google-oauth
tags question: http://stackoverflow.com/q/26940531

http://stackoverflow.com/q/26970670
has body: I'm using github's square OKHTTP client library for my java application as follows : import java.io.IOException; import java.net.InetSocketAddress; import java.net.Proxy; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import com.squareup.okhttp.Authenticator; import com.squareup.okhttp.Credentials; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; import com.squareup.okhttp.Response; public class TestOkHttp { static public void main(String argcp[]){ try { OkHttpClient okHttpClient = new OkHttpClient(); TrustManager[] trustAllCerts = new TrustManager[] { new X509TrustManager() { @Override public X509Certificate[] getAcceptedIssuers() { // TODO Auto-generated method stub return null; } @Override public void checkServerTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // TODO Auto-generated method stub } @Override public void checkClientTrusted(X509Certificate[] arg0, String arg1) throws CertificateException { // TODO Auto-generated method stub } }}; SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, trustAllCerts, new java.security.SecureRandom()); okHttpClient.setSslSocketFactory(sc.getSocketFactory()); Proxy p=new Proxy(Proxy.Type.HTTP,new InetSocketAddress("10.1.1.0", 8080)); okHttpClient.setProxy(p); HostnameVerifier hostNameVerifier = new HostnameVerifier() { @Override public boolean verify(String sourceHost, SSLSession arg1) { // TODO Auto-generated method stub return sourceHost.equals("serverwithtls.com"); } }; okHttpClient.setHostnameVerifier(hostNameVerifier); okHttpClient.setAuthenticator(new Authenticator() { @Override public Request authenticateProxy(Proxy proxy, Response response) throws IOException { String credential = Credentials.basic("username","password"); return respon…
has comment: http://stackoverflow.com/comment/60910446
type: UnansweredQuestion
tagged with: proxy
tagged with: okhttp
has comment: http://stackoverflow.com/comment/60853980
type: Question
answer count: 1
has title: okhttp client throwing exception under TMG proxy server
score: 0
tagged with: java
tagged with: https
has answer: http://stackoverflow.com/a/26972468

http://stackoverflow.com/q/26971380
has body: Seems like I'm doing something wrong since whenever I open the fragment, all the checkboxes are checked. But when I click on one of them for unchecking, I again call the savePreference method, where checkBox.isChecked is false. But inside the method, the value is set to true. Therefore I assume that's why everytime I run the app, the checkboxes are always checked. EDIT: isChecked will always return me true, even when I uncheck Here's my code: public class FilterAdapter extends BaseAdapter { private Context mContext; private ArrayList&lt;String&gt; mFilters; private ArrayList&lt;Integer&gt; mPictures; private Typeface Bebas, DroidSans; private CheckBox checkBox; public FilterAdapter(Context context, ArrayList&lt;String&gt; filters, ArrayList&lt;Integer&gt; pictures) { this.mContext = context; this.mFilters = filters; this.mPictures = pictures; } @Override public int getCount() { return mFilters.size(); } @Override public Object getItem(int position) { return mFilters.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.category_filter_item, null); } checkBox = (CheckBox) convertView.findViewById(R.id.check_box); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) savePreferences("CheckBox_Value", checkBox.isChecked()); else { savePreferences("CheckBox_Value", checkBox.isChecked()); } } }); loadSavedPreferences(); DroidSans = Typeface.createFromAsset(mContext.getAssets(), "fonts/DroidSans.ttf"); ImageView filter_img = (ImageView) convertView.findViewById(R.id.category_picture); TextView filter_category = (TextView) convertView.findViewById(R.id.filter_categ…
has title: Saving checkbox state in SharedPreferences
has comment: http://stackoverflow.com/comment/42479021
score: 0
tagged with: java
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/42478788
linked to: http://stackoverflow.com/q/12621804
type: Question
has comment: http://stackoverflow.com/comment/42479730
has comment: http://stackoverflow.com/comment/42480192
has comment: http://stackoverflow.com/comment/42479101
has comment: http://stackoverflow.com/comment/42478723
has comment: http://stackoverflow.com/comment/42478759
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26972479
tagged with: android
has comment: http://stackoverflow.com/comment/42478661

http://stackoverflow.com/q/26968697
has answer: http://stackoverflow.com/a/26968789
score: 0
has title: How to configure application context in Spring?
has comment: http://stackoverflow.com/comment/42474353
has comment: http://stackoverflow.com/comment/42473822
has comment: http://stackoverflow.com/comment/42479426
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42474117
has comment: http://stackoverflow.com/comment/42475882
has comment: http://stackoverflow.com/comment/42474430
tagged with: spring
type: Question
linked to: http://stackoverflow.com/q/15880081
tagged with: java
has comment: http://stackoverflow.com/comment/42473982
has body: I have application context file, which has such strings: main.properties Here main.properties is file with dynamic properties. I want change their periodically and so I need store these properties on file system, out of the jar. How can I configure several paths in application context? Or there is a different way to resolve my issue? Thanks.
answer count: 1
has comment: http://stackoverflow.com/comment/42480717

http://stackoverflow.com/comment/67156850
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27003641
has text: So you are saying that there is no way to "recover" after @MultipartConfig max size is hit? The client will always hit a browser's "The connection was reset" error page?
score: 0

http://stackoverflow.com/a/26983854
type: Answer
has body: You logic is around backwards. You are only ever adding a single JLabel to your container... add(new Entity()); You actually Entity class has no means to put anything onto the screen other than a single representation of itself...which is typically the last thing it created within it's for loop... Instead of trying to create multiple entities within your Entity class (I know, you're only setting the properties, but the intention is the same), move the creation process out to the the MainPanel and physically create a new Entity on each loop Now, having said that, screwing with components in this manner is probably not the best solution. You should consider using a custom painting approach, you will find it easier to manage all the entities and will probably also consume less overhead... Consider having a look at Painting in AWT and Swing Performing Custom Painting for more details
has comment: http://stackoverflow.com/comment/42501836
has comment: http://stackoverflow.com/comment/42501702
score: 0
answers question: http://stackoverflow.com/q/26983695

http://stackoverflow.com/a/26880082
answers question: http://stackoverflow.com/q/26879384
downvote count: 0
score: 3
has body: Multithreading should be used whenever your program can be broken down into multiple parallel executable tasks which are independent of each other. for example, int main() { for (i=0;i&lt;5;i++) fprintf("this is for task1") // consider this function is writing data to file for task1 for (i=0;i&lt;5;i++) fprintf("this is for task2") // consider this function is writing data to file for task2 return 0; } Here we can see that writing to a file1 and file2 can be done in parallel as they are completely independent of each other. Thus multithreading can be used here to run both tasks simultaneously. But before multithreading you should consider some things, Do you really need it? Will that hamper your application logic? can you improve it without multithreading? In above code we can do some improvement without using multithreading, int main() { for (i=0;i&lt;5;i++) { fprintf("this is for task1") fprintf("this is for task2") } return 0; } here we can avoid second loop which is not required. here we cant avoid serial file writing but we got some improvement than previous (Do not think more about it, this is just an example :) ) Multithreading will only help if you have multiple cores on your CPU else though you use multithreading, results will be similar to serial code execution. Hope you are clear now :)
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26879384
type: Answer

http://stackoverflow.com/q/26860567
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: Getting Request timed out in command prompt for ping smtp.gmail.com and for java program while sending email
has comment: http://stackoverflow.com/comment/42281826
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: Need to send mail through java program, Once i ran my program successfully in another machine, program is correct as far as i know, but this time it is showing time out connection, when i checked in my command prompt, also it is showing request timed out for command prompt: C:>ping smtp.gmail.com Pinging gmail-smtp-msa.l.google.com [74.125.69.108] with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 74.125.69.109: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss) for java program : java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
has answer: http://stackoverflow.com/a/26861566
has comment: http://stackoverflow.com/comment/42281674
score: 0
tagged with: email

http://stackoverflow.com/comment/42490852
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26914471
has text: That means you have already added that module as a dependency, try "Reimport All Maven projects" (the blue circle arrows) and see if you can navigate in the source. If it doesn't work try starting from clean project (without any changes in Module settings).
type: AnswerComment

http://stackoverflow.com/comment/42365275
type: AnswerComment
has text: i understand how that works. just my issue is that I have a results.jsp file where all the users answers are shown. Currently with this method it prints the results on the next page (the wrong page). i need to do the out.println on the results.jsp but if i do that then the jsp does not recognize the variable. do you see the issue?
comment on: http://stackoverflow.com/a/26907068
score: 0
type: Comment

http://stackoverflow.com/comment/42313123
comment on: http://stackoverflow.com/q/26877328
score: 0
type: Comment
type: QuestionComment
has text: You must either place the file on the (shared) external storage, make an internal storage file readable by other apps, or use a content provider. Even if you make a normally private internal storage file world readable, email clients may *assume* they can't read it without actually trying, so that approach is not encouraged.

http://stackoverflow.com/comment/42480172
type: Comment
has text: Also I get a warning message "Failed to load the sqljdbc_auth.dll"
comment on: http://stackoverflow.com/a/26972106
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42291834
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26866260
has text: What exactly are you asking for? Do you want to find the sum of a subset of a 1D matrix?

http://stackoverflow.com/a/32723975
answers question: http://stackoverflow.com/q/26934799
type: Answer
has body: I found a simple workaround: org.springframework spring-context-support ${spring.version javax.cache cache-api 1.0.0 For more info read this JCache dependency in spring-aspects
score: 0

http://stackoverflow.com/comment/42485938
comment on: http://stackoverflow.com/a/26940999
has text: I GOT IT WORKING! :D...The initial coding you suggested to me was 100% correct, the reason why I kept getting the error was because the file itself was corrupted when I converted it. You see it was originally a .mp3 and when I converted it to a .wav I did so in the file properties cause it to become corrupt. I downloaded the file again and used FormatFactory to convert it to a .wav and it works. Thanx for your help, much appreciated :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42301711
comment on: http://stackoverflow.com/q/26851469
score: 0
type: Comment
type: QuestionComment
has text: Try with leading /. I guess `META_INF` is just a typo.

odoo
tags question: http://stackoverflow.com/q/26924402
type: Tag
tag name: odoo

http://stackoverflow.com/comment/42479434
type: QuestionComment
type: Comment
has text: I already know these topics, that's not the point of my question. I know how to pass objects between activities, but I don't know if they will be persistent in the destination activity
comment on: http://stackoverflow.com/q/26971751
score: 0

http://stackoverflow.com/q/26906677
has comment: http://stackoverflow.com/comment/49078364
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
has title: -Djavax.net.debug=ssl windows no output
tagged with: windows
downvote count: 0
score: 1
tagged with: java
tagged with: rcp
has answer: http://stackoverflow.com/a/30501366
has body: i'm trying to debug an ssl issue with a java app on a windows client. Adding -Djavax.net.debug=ssl to the applications ini-file does not produce any output. Running that config on a linux machine (ubuntu) i get the debug log i want to, but starting the app from the windows commandline does not produce anything. seems like i'm doing something wrong here or the app is not able to write to standard out on windows (7/64) or writes somewhere else i do not know of. Any help appreciated.
type: Question
tagged with: debugging
tagged with: ssl

http://stackoverflow.com/comment/42432540
type: QuestionComment
has text: Android.jar exists in multiple pieces on my phone. That jar is only in one piece on the computer.
comment on: http://stackoverflow.com/q/26944851
score: 0
type: Comment

http://stackoverflow.com/comment/42481998
has text: override hashCode & equal method in your class that will help you for comparing java object.
score: 0
comment on: http://stackoverflow.com/q/26973218
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42424479
score: 0
comment on: http://stackoverflow.com/q/26939755
has text: openfiles command looks promising, I'll keep this as a last resort. I want to avoid disconnecting if possible, since it's a system process and I'm not sure what the effect will be
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42317515
score: 0
type: AnswerComment
type: Comment
has text: I just realized that the issue is likely no longer on the server side, but on the client after your suggestion (thanks for the link to the InputStreamResource discussion, by the way). I take it, then, that the client needs to do something with `RestAdapter.Builder.setConverter`, is that correct?
comment on: http://stackoverflow.com/a/26875436

http://stackoverflow.com/a/26976977
score: 3
answers question: http://stackoverflow.com/q/26976698
has body: Seems you create a string array, but than proceed to try reverse the input. If you want to use collections you may do something like this: List&lt;String&gt; list = Arrays.asList(my_friend_names); Collections.reverse(list); System.out.println("After Reverse order: " + list);
downvote count: 0
type: Answer
upvote count: 3

relative-path
type: Tag
tags question: http://stackoverflow.com/q/26880304
tags question: http://stackoverflow.com/q/26862513
tag name: relative-path
tags question: http://stackoverflow.com/q/26905690

http://stackoverflow.com/q/26991541
has comment: http://stackoverflow.com/comment/42514514
score: 0
tagged with: android
tagged with: sqlite
type: UnansweredQuestion
has title: Storing data from SQLite to MySQL Server
has comment: http://stackoverflow.com/comment/42514494
answer count: 0
has body: I am writing code to send data from SQLite database to MYSQL server database, and whenever i do tap on sync data button, getting toast "DB Sync completed" as given in my program, but not getting data on server... i am using this link MainActivity.java:- public void syncSQLiteMySQLDB(){ //Create AsycHttpClient object AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); ArrayList&lt;HashMap&lt;String, String&gt;&gt; userList = controller.getAllUsers(); if(userList.size()!=0){ if(controller.dbSyncCount() != 0){ prgDialog.show(); params.put("usersJSON", controller.composeJSONfromSQLite()); client.post("http://10.0.2.2/sqlitemysqlsync/insertuser.php",params ,new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { System.out.println(response); prgDialog.hide(); try { JSONArray arr = new JSONArray(response); System.out.println(arr.length()); for(int i=0; i&lt;arr.length();i++){ JSONObject obj = (JSONObject)arr.get(i); System.out.println(obj.get("id")); System.out.println(obj.get("status")); controller.updateSyncStatus(obj.get("id").toString(),obj.get("status").toString()); } Toast.makeText(getApplicationContext(), "DB Sync completed!", Toast.LENGTH_LONG).show(); } catch (JSONException e) { // TODO Auto-generated catch block Toast.makeText(getApplicationContext(), "Error Occured [Server's JSON response might be invalid]!", Toast.LENGTH_LONG).show(); e.printStackTrace(); } } @Override public void onFailure(int statusCode, Throwable error, String content) { // TODO Auto-generated method stub prgDialog.hide(); if(statusCode == 404){ Toast.makeText(getApplicationContext(), "Requested resource not found", Toast.LENGTH_LONG).show(); }else if(statusCode == 500){ Toast.makeText(getApplicationContext(), "Something went wrong at server end", Toast.LENGTH_LONG).show(); }else{ Toast.makeText(getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet]", Toast.LENGTH…
tagged with: java
tagged with: mysql
type: Question

http://stackoverflow.com/comment/42495052
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26980389
score: 0
has text: @njzk2 Can you please explain it a bit more.

http://stackoverflow.com/q/26873120
upvote count: 1
tagged with: spring
answer count: 1
has body: I am running my test case and I am getting the following exception: java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109) at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75) at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240) at org.apache.camel.test.junit4.CamelSpringJUnit4ClassRunner.runChild(CamelSpringJUnit4ClassRunner.java:37) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.springframework.test.context.junit4.SpringJUnit4Clas…
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42304970
has comment: http://stackoverflow.com/comment/42408947
has comment: http://stackoverflow.com/comment/42305199
tagged with: junit
downvote count: 0
has comment: http://stackoverflow.com/comment/42304776
score: 1
favorite count: 0
has title: Getting a null pointer exception while running junit
type: Question
has comment: http://stackoverflow.com/comment/42305288
has comment: http://stackoverflow.com/comment/42304514
has comment: http://stackoverflow.com/comment/42304714
has answer: http://stackoverflow.com/a/26931924
tagged with: maven

http://stackoverflow.com/q/26966410
accepted answer: http://stackoverflow.com/a/26967070
type: Question
has title: Printing a java list
tagged with: printing
has body: So i have a little problem here, im trying to print a list from right to left and from left to right, this code works fine printing from right to left but from left to right no, any help please? My code: package listas; import java.util.Scanner; class nodo { int info; nodo ligader; nodo ligaizq; } class Listas { static nodo F = null; static nodo Q = null; static nodo P = null; static nodo x = null; static nodo T = null; public static void main(String args[]) { Scanner y = new Scanner(System.in); int m = 0; do { try { System.out.println("Menu"); System.out.println("1. Crea Inicio"); System.out.println("2. Insertar antes de referencia "); System.out.println("3. Mostrar"); System.out.println("4. Salir"); System.out.println("Opcion:"); m = Integer.valueOf(y.next()); } catch (NumberFormatException e) { System.out.print(""); } try { switch (m) { case 1: creaininodo(); System.out.println("Termina Programa que Crea Inicio de Lista"); break; case 2: InsertarAntes(); break; case 3: Mostrar(); break; case 4: System.exit(0); break; default: System.out.println("La opcion que escogio no se encuentra,favor de escoger otra."); break; } } catch (NumberFormatException e) { System.out.println("Datos introducidos erroneos."); } } while (m != 4); } public static void creaininodo() { Scanner y = new Scanner(System.in); int opc = 1; int dato; if (P == null) { P = new nodo(); System.out.println("Dame Dato: "); dato = Integer.valueOf(y.next()); P.info = dato; P.ligaizq = null; P.ligader = null; F = P; } do { Q = new nodo(); System.out.println("Dame Dato: "); dato = Integer.valueOf(y.next()); Q.info = dato; Q.ligader = P; Q.ligaizq = null; P = Q; System.out.println("Otro nodo 1(SI) 2 (NO)"); opc = Integer.valueOf(y.next()); } while (opc != 2); } public static void InsertarAntes() { Scanner sc = new Scanner(System.in); int ref; int dato; System.out.println("Inserte un valor de referencia: "); ref = Integer.valueOf(sc.next()); Q = P; boolean band = false; while ((Q.info != ref) &amp;&amp; (ban…
answer count: 1
has answer: http://stackoverflow.com/a/26967070
type: AnsweredQuestion
tagged with: list
score: 0
tagged with: java

http://stackoverflow.com/a/26998713
answers question: http://stackoverflow.com/q/26986099
downvote count: 0
has body: When you use @Parent, you get the object using ancestor. https://code.google.com/p/objectify-appengine/wiki/AdvancedPatterns
upvote count: 2
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26986099
score: 2

http://stackoverflow.com/q/26972246
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26972757
tagged with: android
score: 1
has title: How to import an eclipse android project that has libraries dependencies in android studio?
upvote count: 1
type: Question
tagged with: java
has body: How can one import eclipse android project that has some libraries dependencies in android studio? I tried using automatic import in android studio however there were lots of errors so I would like to import eclipse android project in android studio . Any suggestion would be of great help.
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/26972419
downvote count: 0

http://stackoverflow.com/q/26859056
has answer: http://stackoverflow.com/a/26859191
has body: I am a java developer and I have developed a web application for live video streaming in Java Spring and maven framework. I am trying to integrating the face recognition code with the existing web application. The face recognition code is in c language and I need to call those c functions in the java code. Can anybody guide me how to use this c code into a java web application? I have explored over the net regarding this but found nothing appropriate regarding this. I know JNI may works for this but how to integrate with web application? I hope my requirement is clear; (Spring+Hibernate+Maven) + (C-language code) -> web application Thanks in advance.
tagged with: spring
tagged with: c++
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26859191
has title: Call a C/C++ function in Java Spring Maven web application
tagged with: java
has comment: http://stackoverflow.com/comment/42279797
type: Question
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c
score: 0
has comment: http://stackoverflow.com/comment/42279774
answer count: 1
has comment: http://stackoverflow.com/comment/42279455

http://stackoverflow.com/q/26874508
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26877626
has body: I'm using perforce api to read the list of folders in a branch in java. I reached to a point which tells me to get Branch spec. http://www.perforce.com/perforce/doc.current/manuals/p4java-javadoc/com/perforce/p4java/server/IServer.html#getBranchSpec(java.lang.String) Used the following code to implement getDirectories() method. String serverUri = "p4java://&lt;server-address&gt;:1666?userName=username&amp;password=password"; IServer server = ServerFactory.getServer(serverUri, null); server.connect(); List&lt;IFileSpec&gt; inputList = FileSpecBuilder.makeFileSpecList("//domain/code/branches/"); System.out.println("HelloPerforce.main() &gt;&gt; passed list &gt;&gt; " + inputList ); List&lt;IFileSpec&gt; outputList = server.getDirectories(inputList , false, false, false); System.out.println("HelloPerforce.main() &gt;&gt; directory list &gt;&gt; " + outputList ); Output: The outputList is null. Expected output: List of folder names inside //domain/code/branches directory. Can someone please point me what am I missing here?
favorite count: 0
score: 4
has title: How to get the list of folders from a branch in perforce?
tagged with: perforce
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26877626

http://stackoverflow.com/a/49684838
answers question: http://stackoverflow.com/q/26933190
type: Answer
upvote count: 1
score: 1
has body: This is just some additional information regarding the accepted answer, it doesn't really answer the original question. This information pertains to not getting the entire IBM MQ message. Using the WMQ API you can use options that allow you to accept truncated messages when you browse. I haven't used wireshark or tcpdump to verify that it reduces the amount of data sent over the network, but I am guessing that it would. The options you would use are MQC.MQGMO_ACCEPT_TRUNCATED_MSG. You would also change the size of your message buffer prior go your message get. A short example can be found here: Java WMQ API example.
downvote count: 0

http://stackoverflow.com/q/26957539
favorite count: 0
tagged with: character
has answer: http://stackoverflow.com/a/26957582
upvote count: 1
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26957582
has answer: http://stackoverflow.com/a/59302858
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42454211
has body: Here I have code which prints single character count but I want each character occurrence of times. My code looks like this: String s = "abdsd3$asda$asasdd$sadas"; int counter = 0; for (int i = 0; i &lt; s.length(); i++) { if (s.charAt(i) == '$') { counter++; } } out.println("$ Occurence:" + counter + "times");` The output I want is: a:7, b:1, d:6, s:6, $:3 times. Can anybody help me? Your help will be appreciated.
has comment: http://stackoverflow.com/comment/42454320
type: Question
possible better answer: http://stackoverflow.com/a/59302858
score: -2
has answer: http://stackoverflow.com/a/52568749
has answer: http://stackoverflow.com/a/26957588
has title: How to count number of occurance of character in each string in java?
tagged with: string

http://stackoverflow.com/comment/42386792
has text: Ah, yeah, I didn't consider that case. In that case, you could just move the ```findViewById()``` into ```onCreate()```. Then you get the benefits of more modular code *and* the performance boost!
score: 0
comment on: http://stackoverflow.com/a/26917864
type: Comment
type: AnswerComment

http://stackoverflow.com/a/75019125
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26888762
has body: For anybody still having issues with the app installing, but not launching on devices or the emulator, even after invalidating caches and doing everything else: When I renamed the package in my project, it somehow also edited my Run/Debug Configurations. Make sure Launch under the Launch Options section is not set to None. Usually, this should be Default Activity.

http://stackoverflow.com/a/26959728
has comment: http://stackoverflow.com/comment/42458571
has comment: http://stackoverflow.com/comment/42459186
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42465662
accepted answer of: http://stackoverflow.com/q/26959566
has comment: http://stackoverflow.com/comment/42459065
answers question: http://stackoverflow.com/q/26959566
has comment: http://stackoverflow.com/comment/42459224
has body: Try to select best-matched pattern at first: public static void main(String[] args) { String strA = "ABGCCFFGTBG"; String strB = "GECCCDOABG"; System.out.println("Pattern: " + findPattern(strA, strB)); } public static String findPattern(String strA, String strB) { for (int length = Math.min(strA.length(), strB.length()); length &gt; 0; length--) { for (int i = 0; i &lt;= strA.length() - length; i++) { String pattern = strA.substring(i, i + length); if (strB.contains(pattern)) { return pattern; } } } throw new NoSuchElementException("No common pattern between " + strA + " and " + strB); } Output: Pattern: ABG
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42459315
upvote count: 1
type: Answer

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

http://stackoverflow.com/q/26899560
has comment: http://stackoverflow.com/comment/42374597
has comment: http://stackoverflow.com/comment/42377624
has title: ColdFusion 10 Update 14 Issue
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42358368
tagged with: coldfusion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42376016
type: Question
has comment: http://stackoverflow.com/comment/42376457
has body: I installed the update 14 for CF 10 today and updated the wsconfig. Since then, my site has not come back up. I noticed that a new folder (2) was created in the wsconfig folder. The following error is returned when trying to view any ColdFusion page on the server. Service Temporary Unavailable! The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Jakarta/ISAPI/isapi_redirector/1.2.32 () This is appearing in the error log. &gt; java.lang.reflect.InvocationTargetException at &gt; sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at &gt; sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) &gt; at &gt; sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) &gt; at java.lang.reflect.Method.invoke(Method.java:597) at &gt; com.adobe.coldfusion.bootstrap.Bootstrap.init(Bootstrap.java:86) at &gt; com.adobe.coldfusion.bootstrap.Bootstrap.main(Bootstrap.java:161) &gt; Caused by: java.lang.NoSuchMethodError: &gt; org.apache.jasper.xmlparser.ParserUtils.&lt;init&gt;(Z)V at &gt; com.adobe.coldfusion.launcher.ServerConfigParser.parse(ServerConfigParser.java:55) &gt; at com.adobe.coldfusion.launcher.Launcher.run(Launcher.java:193) ... 6 &gt; more Any idea what steps I can take to resolve this issue? Is there anyway to undo the update?
score: 0

http://stackoverflow.com/q/26897748
tagged with: java
duplicate of: http://stackoverflow.com/q/849813
has comment: http://stackoverflow.com/comment/42348573
type: UnansweredQuestion
answer count: 4
has answer: http://stackoverflow.com/a/26897888
has comment: http://stackoverflow.com/comment/42348639
favorite count: 0
has answer: http://stackoverflow.com/a/26898306
linked to: http://stackoverflow.com/q/7869911
has answer: http://stackoverflow.com/a/26897940
type: Question
has body: I have been looking through the Math library but I cannot seem to find a method that will double a number and return it. I need something that will do num+=num Of course the above will work but once the numbers get large, it no longer does what I need, even if I use a long instead of an int. Or is it perhaps the data type rather than a method that I need to change? I found a solution. BigInteger num = new BigInteger("1"); num = num.add(num); When reading about BigInteger it said it was immutable so I took that as not being able to change the value. I think I need a better understanding of immutable.
has title: Is there a Java Method that will return a doubled number?
has answer: http://stackoverflow.com/a/26898028
score: 0
has comment: http://stackoverflow.com/comment/42348695
upvote count: 1
has comment: http://stackoverflow.com/comment/42348584
downvote count: 1
linked to: http://stackoverflow.com/q/849813

http://stackoverflow.com/a/26961347
score: 0
type: Answer
has body: I have solved the problem. Thank you friends. Apparently,the version and OpenCv and JavaCv should match. Thank you !
answers question: http://stackoverflow.com/q/26939086

http://stackoverflow.com/q/26955310
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/26965196
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42450337
type: Question
accepted answer: http://stackoverflow.com/a/26965196
has comment: http://stackoverflow.com/comment/42464572
linked to: http://stackoverflow.com/q/11942961
tagged with: awt
has body: I am trying to draw a point, a polygon and a rectangle on the same JLabel but not really sure how to handle the paintComponent method to do so. Currently I am able to draw a point and polygon separately using 2 different classes that extends label, but when I try to put them in the same class because I need both of them on the same label, it starts to draw the polygon and does not allow to draw a point separately. Here is the code; I need help in debugging the code. import javax.swing.*; import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.util.*; class Drawing { public static void main(String[] args) { JFrame frame = new JFrame("Draw Everything"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new Test(new ImageIcon("map.JPG"))); frame.pack(); frame.setVisible(true); } } class Test extends JLabel implements MouseListener, MouseMotionListener { private boolean polygonDrawn = false; private final Point trackPoint = new Point(); private static ArrayList polygonPoints = new ArrayList(); private static Point point; public Test(ImageIcon imageIcon) { super(imageIcon, SwingConstants.LEFT); addMouseListener(this); addMouseMotionListener(this); } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); if (point != null) { Double x = point.getX(); Double y = point.getY(); g.setColor(Color.RED); g.fillOval(x.intValue(), y.intValue(), 5, 5); } int numPoints = polygonPoints.size(); if (numPoints == 0) { return; } Point prevPoint = (Point) polygonPoints.get(0); Iterator it = polygonPoints.iterator(); while (it.hasNext()) { Point curPoint = (Point) it.next(); draw(g, prevPoint, curPoint); prevPoint = curPoint; } if (polygonDrawn) { draw(g, prevPoint, (Point) polygonPoints.get(0)); } else { draw(g, prevPoint, trackPoint); } } @Override public Dimension getPreferredSize() { return new Dimension(820, 580); } @Override public void mouseClicked(MouseEvent…
downvote count: 0
answer count: 1
has title: drawing multiple graphics on the same JLabel
favorite count: 0
tagged with: jlabel
tagged with: java-2d
has comment: http://stackoverflow.com/comment/42457862

http://stackoverflow.com/comment/42460199
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26951808
type: Comment
has text: how do you get 2*r-3?

http://stackoverflow.com/comment/42342632
has text: Im trying to print the Values as Json with the Fasterxml library. From the base Object im getting all i want but when i put that Object into a HashMap its gonna give me only the String of the Instance like:de.test.carSharing.Person@7eab0d73
score: 0
comment on: http://stackoverflow.com/q/26894241
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42250861
has text: Actually it just seems to be returning false. The save button is still invisible. It's not showing up at all.
score: 0
comment on: http://stackoverflow.com/a/26836923
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42481805
comment on: http://stackoverflow.com/q/26972966
score: 0
type: Comment
type: QuestionComment
has text: refer link http://stackoverflow.com/questions/2671796/how-to-include-text-files-with-executable-jar

http://stackoverflow.com/q/26890203
accepted answer: http://stackoverflow.com/a/26890304
has body: I was wondering why I can't make the correct result of addition of time, e.g.: 3:11:0 from 2:50:20 + 0:20:40, however I only got something like 3:10:0. So, below is my work; //variable int hour, min, sec; int hour1, min1, sec1; int total, total1, total2; int total11,total12, total21, total22; //input1 Scanner input = new Scanner(System.in); System.out.print("Input hours\t: "); hour = input.nextInt(); System.out.print("Input minutes\t: "); min = input.nextInt(); System.out.print("Input seconds\t: "); sec = input.nextInt(); //output1 System.out.println("Time 1 is " + hour + ":" + min + ":" + sec); //input2 System.out.print("Input additional hours\t: "); hour1 = input.nextInt(); System.out.print("Input additional minute\t: "); min1 = input.nextInt(); System.out.print("Input additional seconds\t: "); sec1 = input.nextInt(); //output2 System.out.println("Time 2 is " + jam1 + ":" + menit1 + ":" + detik1); //process total = hour + hour1; total1 = min + min1; total11 = total1/60; total12 = total11%60; total2 = sec + sec1; total21 = total2/60; total22 = total2%60; if (total1 &gt; 60) { total1 = (min + min1) - 60; total = (hour + hour1) + total11; total2 = (sec + sec1)-60; } if (total2 &gt; 60) { total2 = (sec + sec1) - 60; total1 = (min + min1) + total22; } //finaloutput System.out.println("Your total time is " + total + ":" + total1 + ":" + total2); *Sorry about the grammar :) I really appreciate your answer :)
has answer: http://stackoverflow.com/a/26890450
tagged with: time
tagged with: addition
possible better answer: http://stackoverflow.com/a/26890450
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42334667
has answer: http://stackoverflow.com/a/26890304
has title: How to do addition of time in Java?
type: Question
has comment: http://stackoverflow.com/comment/42334434
has comment: http://stackoverflow.com/comment/42334590
tagged with: if-statement
has comment: http://stackoverflow.com/comment/42349584
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42334550

http://stackoverflow.com/comment/42250681
type: QuestionComment
has text: you have to distinguish between the static type and the dynamic type of a variable, but doesn't eclipse show the dynamic type of a variable in the variables view by default?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26843567

http://stackoverflow.com/comment/42334465
has text: i have submitted and then called if statement. what do you mean by M&V bit? will post code in question so you can see
comment on: http://stackoverflow.com/a/26890029
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42596629
type: QuestionComment
comment on: http://stackoverflow.com/q/26987588
type: Comment
score: 0
has text: Well, of course you want to call methods from the web service, why else would you be asking a web service-related question. *Why are you choosing this approach?* You could just use wsimport to generate the stubs for the service and be done, rather than trying to build your own message manually

http://stackoverflow.com/comment/42491890
score: 0
type: Comment
has text: based on this https://www.infinum.co/the-capsized-eight/articles/top-5-android-libraries-every-android-developer-should-know-about I chose UIL. [Also interesting](http://stackoverflow.com/questions/19995007/local-image-caching-solution-for-android-square-picasso-vs-universal-image-load)
comment on: http://stackoverflow.com/a/26976566
type: AnswerComment

http://stackoverflow.com/a/26908801
type: Answer
has comment: http://stackoverflow.com/comment/42368938
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26905473
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26905473
has body: It's not a cookie... anyway simplest solution I can think of is ... hiding your app under some light HTTP server as a proxy and use its access restriction rules, the benefits: light server shouldn't be a bottleneck as it's dedicated to this job it's probably awared of tricks and hacks that hackers tries to walk around the restrictions denied IPs doesn't even get into your app, so you're saving resources it helps in general to solve several other tasks Finally servers treat forwarded IPs in special way, i.e. when header manipulated like you show with curl, Apache will forward is as a list: 1.2.3.4,123.123.123.123 so you can catch bad IP anyway...

http://stackoverflow.com/q/26991397
has title: Beginner hibernate: Why does my hibernate query return only one result, instead of a list?
has answer: http://stackoverflow.com/a/26991642
tagged with: java
tagged with: hibernate
upvote count: 1
accepted answer: http://stackoverflow.com/a/26992072
has body: I'm very new to hibernate, and I'm trying to set up a new method in our PersonDAO. My hibernate mapping file looks like this: <?xml version="1.0"?> <hibernate-mapping package="com.foo.bar.domain"> A Person <generator class="native" /> <version name="version" type="integer" column="rversion" unsaved-value="null" /> <property name="UID" type="string" column="UID" length="16" not-null="true" unique="true"/> <property name="lastName" type="string" column="last_name" not-null="true" /> <property name="firstName" type="string" column="first_name" not-null="true" /> <property name="ownDepartment" type="string" column="own_department"/> <key column="person_id"/> <many-to-many column="responsibility_id" class="Responsibility"/> <key column="person_id"/> <element column="ADDITIONAL_DEPARTMENT" type="string"/> and I've written a method like this, in java, to fetch all the managers from a given department: public List<Person> getManagerByDepartment(final String givenDepartment){ List<Person> l = (List<Person>) this.getHibernateTemplate().executeFind(new HibernateCallback<List<Person>>() { public List<Person> doInHibernate(Session session) throws HibernateException, SQLException { String query = "select p from Person p join p.responsibilities responsibilities join p.additionalDepartments additionalDepartments where responsibilities.name = 'manager' and (p.ownDepartment = :givenDepartment or additionalDepartments = :givenDepartment)"; List<Person> result = (List<Person>) session.createQuery(query).setString("givenDepartment", givenDepartment).list(); return result; } }); return l; } now I do a manual query in SQL, and I can see that for a given department, there are definitely more than one people who have the additional responsibility 'manager'...why does my method only ever return one person, instead of all of them? I have a strong suspicion that my method, specifically my query, and not the mapping, is the issue, but I can't see what's wrong with it... I've jumped in at the de…
possible better answer: http://stackoverflow.com/a/26991642
has answer: http://stackoverflow.com/a/26992072
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2

http://stackoverflow.com/a/26941116
answers question: http://stackoverflow.com/q/26940993
type: AcceptedAnswer
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/42426448
downvote count: 0
has comment: http://stackoverflow.com/comment/42426475
score: 3
accepted answer of: http://stackoverflow.com/q/26940993
has body: Put your Button buttonClick = (Button) findViewById(R.id.button); inside onCreate. Eg: Button buttonClick; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonClick = (Button) findViewById(R.id.button); }

http://stackoverflow.com/comment/42426675
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26941375
has text: `And on line 461, eventEncountered is probably null.` .. line `461` is in method `submitData` and there is no `eventEncoutered` there.
type: AnswerComment

http://stackoverflow.com/q/26886315
has answer: http://stackoverflow.com/a/26886409
tagged with: arrays
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/42327338
has body: Im making an android app and this part is where a cursor will go through a database and store the 'title' section of the table into a string array. This is then called in another class and is used to dynamically show buttons based on the entries. The code for putting the titles into an array is as follows: public String[] getTitles() { SQLiteDatabase db =getReadableDatabase(); int numRows = (int) DatabaseUtils.queryNumEntries(db, SPORTS_TABLE_NAME); String title; String[] titleArray = new String[100]; String sql = "SELECT Title FROM Sports;"; Cursor cursor = db.rawQuery(sql, null); int i = 1; while (cursor.moveToNext()) { if(cursor != null &amp;&amp; cursor.moveToFirst()) { title = cursor.getString(0); titleArray[i] = title; i++; } if(cursor != null) db.close(); } cursor.close(); return titleArray; } Then it is called with the following code: int i = 1; String[] titlesArray = db.getTitles(); for(String titles: titlesArray){ Button btn = new Button(this); btn.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); btn.setId(i); btn.setText(titlesArray[i]); ll.addView(btn); i++; } Been looking for a while and think it needs a fresh pair of eyes.. any ideas?
accepted answer: http://stackoverflow.com/a/26886409
has comment: http://stackoverflow.com/comment/42327314
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42327309
type: AnsweredQuestion
tagged with: java
tagged with: indexoutofboundsexception
has title: String array throws index out of bounds exception
type: Question
has comment: http://stackoverflow.com/comment/42327214

http://stackoverflow.com/a/26905402
has comment: http://stackoverflow.com/comment/47852291
has comment: http://stackoverflow.com/comment/47853459
has comment: http://stackoverflow.com/comment/47854227
accepted answer of: http://stackoverflow.com/q/26905312
answers question: http://stackoverflow.com/q/26905312
has comment: http://stackoverflow.com/comment/47854276
has comment: http://stackoverflow.com/comment/47847229
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/47855817
score: 47
has comment: http://stackoverflow.com/comment/47853428
has body: The issue is that Collectors.toList, not surprisingly, returns a List&lt;T&gt;. Not an ArrayList. List&lt;Long&gt; ids = remove.stream() .map(MyObj::getId) .collect(Collectors.toList()); Program to the interface. From the documentation: Returns a Collector that accumulates the input elements into a new List. There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned; if more control over the returned List is required, use toCollection(Supplier). Emphasis mine - you cannot even assume that the List returned is mutable, let alone that it is of a specific class. If you want an ArrayList: ArrayList&lt;Long&gt; ids = remove.stream() .map(MyObj::getId) .collect(Collectors.toCollection(ArrayList::new)); Note also, that it is customary to use import static with the Java 8 Stream API so adding: import static java.util.stream.Collectors.toCollection; (I hate starred import static, it does nothing but pollute the namespace and add confusion. But selective import static, especially with the Java 8 utility classes, can greatly reduce redundant code) Would result in: ArrayList&lt;Long&gt; ids = remove.stream() .map(MyObj::getId) .collect(toCollection(ArrayList::new));
type: Answer
upvote count: 47
downvote count: 0

http://stackoverflow.com/a/57676672
downvote count: 0
answers question: http://stackoverflow.com/q/26889970
score: 15
type: Answer
has comment: http://stackoverflow.com/comment/113704460
has comment: http://stackoverflow.com/comment/113549348
has comment: http://stackoverflow.com/comment/121507703
upvote count: 15
has body: Configure application context and all will be ok.

http://stackoverflow.com/comment/42392400
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26921899
has text: @turingcomplete that was a typo error regarding not returning the object. My question was regarding cloning the object array a.

http://stackoverflow.com/comment/42464853
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26963325
score: 0
has text: The `wait()` method is throwing the exception, obviously. Do you mean 'who is interrupting the thread'?

http://stackoverflow.com/a/26894203
downvote count: 0
type: Answer
has body: Results with new ojdbc7.jar(before i used ojdbc6.jar from 11.2.0.2 bundle) and OracleJDBCRowSet. 19 rows: sql1 : That was: 1470 ms // before 7-8 seconds sql2 : That was: 1140 ms 99 rows: sql1 : That was: 1491 ms sql2 : That was: 1158 ms As you can see its much faster, but still slower than query with even much more data. Adding more column almost make no changes in execution and fetching time, so the problem partially solved. But seems that the improvements comes to RowSets only. OracleResultSet still work extremly slow. Also if you link new driver with Oracle SQL Developer it takes no effect. Sample code: public class Test { public static void main(String[] args) { final String sql1 = "select HIGH_VALUE from sys.DBA_TAB_PARTITIONS WHERE rownum &lt; 100"; final String sql2 = "select PARTITION_NAME, HIGH_VALUE_LENGTH,TABLESPACE_NAME,NUM_ROWS,BLOCKS,\n" + "EMPTY_BLOCKS,LAST_ANALYZED,AVG_SPACE,SUBPARTITION_COUNT,COMPRESSION " + "from sys.DBA_TAB_PARTITIONS WHERE rownum &lt; 100"; OracleDataSource ods = null; try { ods = new OracleDataSource(); } catch (SQLException ex) { System.exit(2); } ods.setDriverType("thin"); ods.setUser("vr"); ods.setPassword("oracle"); ods.setDatabaseName("ORCL"); ods.setServerName("192.172.18.1"); ods.setPortNumber(1521); try (Connection conn = ods.getConnection();) { try (OracleJDBCRowSet rs = new OracleJDBCRowSet(conn);) { rs.setFetchSize(200); rs.setReadOnly(true); rs.setCommand(sql2); // Start time long startTime = System.currentTimeMillis(); rs.execute(); while (rs.next()) { System.out.println("row#: " + rs.getRow() + " " + rs.getString(1)); } // Finish time long endTime = System.currentTimeMillis(); System.out.println("That was: " + (endTime - startTime) + " ms"); } } catch (SQLException e) { System.err.println(e.getMessage()); } } }
score: 1
accepted answer of: http://stackoverflow.com/q/26882021
upvote count: 1
answers question: http://stackoverflow.com/q/26882021
type: AcceptedAnswer

http://stackoverflow.com/comment/42461893
score: 0
comment on: http://stackoverflow.com/q/26961886
type: Comment
type: QuestionComment
has text: no, I include http:// and it happens randomly, sometimes I have a peek

http://stackoverflow.com/comment/42549207
comment on: http://stackoverflow.com/a/26999293
has text: Thanks for throwing the light for what to look for . When i did the below if(resourceInfo.getResourceClass().getAnnotationsByType(MyIgnoreAnnotation.class).length != 0) {} I am getting Compilation error and what should be present in place of MyIgnoreAnnotation.class Could you please help
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42417252
has text: Unless you can modify the producers to do an additional signal/notify there are two types of solution, 1) use a timeout and find a trade-off between cpu consumption and reponsiveness or 2) use additional threads waiting on the queues and notifying the consumer. The additional threads of the second approach will consume more memory but no significant cpu time as they are mostly waiting.
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26936299

http://stackoverflow.com/q/26883474
favorite count: 0
has answer: http://stackoverflow.com/a/26884246
has title: HashMap n-dimensional using a recursive function
has comment: http://stackoverflow.com/comment/42322587
has body: I don't know how to make a matrix n dimensional using HashMap. The idea is to enter a number which indicates the dimension of the matrix and from this make a recursive function which creates the n-dimensional HashMap. For example, if you want a 5 dimensional matrix, you have to do inside of it one with 4 dimensions, inside 3 dimensions and etc..
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42322715
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26884246
type: Question
tagged with: recursion
has comment: http://stackoverflow.com/comment/42322806
tagged with: dimensions
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/26883642
answer count: 2
has answer: http://stackoverflow.com/a/26883642
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/42374277
score: 1
comment on: http://stackoverflow.com/q/26911867
type: Comment
has text: maybe create one static ConnectAsync in your Singleton and when calling getInstance().connect() first check that this class is initialized and running (AsyncTask.getStatus()). if running then don't start another one
type: QuestionComment

http://stackoverflow.com/comment/42324857
comment on: http://stackoverflow.com/a/26884474
has text: then how can i fetch the child frame to front
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26871957
has comment: http://stackoverflow.com/comment/42302370
has body: Hi im trying to print all customers from db using jpa, but the output i get is in the following format : model.Customer@3d47d922, model.Customer@5f6f2271, model.Customer@6facbae5 Heres the dao method im using : public List&lt;Customer&gt; getAllCustomers() { EntityManager em = null; List&lt;Customer&gt; resultList = new ArrayList&lt;Customer&gt;(); try { em = JpaUtil.getFactory().createEntityManager(); TypedQuery&lt;Customer&gt; query = em.createQuery("select p from Customer p", Customer.class); resultList = query.getResultList(); } finally { JpaUtil.closeQuietly(em); } return resultList; Heres servlet where i try to output customers: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { CustomerDAO dao = new CustomerDAO(); response.getWriter().println(dao.getAllCustomers()); Heres my model class : @Entity public class Customer { @Id @SequenceGenerator(name = "my_seq", sequenceName = "seq1", allocationSize = 1) @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "my_seq") private Long id; private String first_name; private String surname; private String code; public enum Customertype{Private, Corporate}; @Enumerated(EnumType.STRING) private Customertype customer_type; public Customer() {} public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return first_name; } public void setFirstName(String firstname) { first_name = firstname; } public String getSurname() { return surname; } public void setSurname(String surName) { surname = surName; } public Customertype getCustomertype() { return customer_type; } public void setCustomertype(Customertype customerType) { this.customer_type = customerType; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } }
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: java
score: -1
type: Question
has answer: http://stackoverflow.com/a/26872011
answer count: 2
tagged with: jpa
has answer: http://stackoverflow.com/a/26872064
favorite count: 0
has title: Outputting data from db using jpa

colors
tags question: http://stackoverflow.com/q/26979308
tags question: http://stackoverflow.com/q/26872173
tag name: colors
type: Tag
tags question: http://stackoverflow.com/q/26840096

http://stackoverflow.com/comment/42236563
score: 0
has text: and where do I drop this into the Piece.java file ? and sorry for all the questions
type: AnswerComment
comment on: http://stackoverflow.com/a/26835216
type: Comment

http://stackoverflow.com/comment/42524799
comment on: http://stackoverflow.com/a/26996935
type: AnswerComment
has text: 'File file = new File(newDirectory,(prefix+System.currentTimeMillis()+".jpg"));' in 'createNewFile(String prefix)' how could I call here?
score: 0
type: Comment

http://stackoverflow.com/a/26938526
answers question: http://stackoverflow.com/q/26938123
type: Answer
score: 2
downvote count: 0
has body: Checkout my solution If you want de-couple between LightSwitch &amp; Light. You can easily add/remove the link between lights and switch Light class: public class Light { private boolean on; public void setOn(boolean on) { this.on = on; } public boolean isOn() { return on; } } LightSwitch class: public class LightSwitch { private boolean on; private Map&lt;String, SwitchListener&gt; listeners = new HashMap&lt;String, SwitchListener&gt;(); public void switchState() { on = !on; SwitchEvent event = new SwitchEvent(on); for (SwitchListener switchListener : listeners.values()) { switchListener.switchPerformed(event); } } public void addListener(String id, SwitchListener listener) { listeners.put(id, listener); } public void removeListener(String id) { listeners.remove(id); } } SwitchEvent class: public class SwitchEvent { private boolean on; public SwitchEvent(boolean on) { this.on = on; } public boolean isOn() { return on; } } SwitchListener class: public interface SwitchListener { void switchPerformed(SwitchEvent event); } USING example: public static void main(String[] args) { LightSwitch lightSwitch = new LightSwitch(); final Light light1 = new Light(); final Light light2 = new Light(); lightSwitch.addListener("light1", new SwitchListener() { @Override public void switchPerformed(SwitchEvent event) { light1.setOn(event.isOn()); } }); lightSwitch.addListener("light2", new SwitchListener() { @Override public void switchPerformed(SwitchEvent event) { // Example: light 1 on, light 2 off -- light 1 off, light 2 on light2.setOn(!event.isOn()); } }); // Test switch lightSwitch.switchState(); // light 1 ON, light 2 OFF lightSwitch.switchState(); // light 1 OFF, light 2 ON }
upvote count: 2

http://stackoverflow.com/comment/42238328
type: QuestionComment
has text: Did you start your Java process via cmd/sh? Then your destroy method will not reach the right process. You should maybe give an example code what you tried. And well, Java is pretty bad in everything platform specific. I would not be suprised if Eclipse uses native code for better integration with processes.
comment on: http://stackoverflow.com/q/26836240
score: 0
type: Comment

http://stackoverflow.com/q/26943571
has answer: http://stackoverflow.com/a/26943997
has answer: http://stackoverflow.com/a/26943689
has answer: http://stackoverflow.com/a/26943800
has comment: http://stackoverflow.com/comment/42430257
type: Question
accepted answer: http://stackoverflow.com/a/26943800
possible better answer: http://stackoverflow.com/a/26943689
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42433738
tagged with: mysql
has comment: http://stackoverflow.com/comment/42430211
tagged with: java
has body: I have a database named work created using mysql in which a table named register is created. It contain a column renewdate. I accessed the table from java swing like this conn=ConnectionDB.conn(); Date d=sysdate(); String sql="select renewdate from register"; try { ps=conn.prepareStatement(sql); ResultSet rs=ps.executeQuery(); Date dates; while(rs.next()) { dates = rs.getDate("renewdate"); System.out.println(dates); if(dates==d) { SendMailTLS.sendMail(); } } } My problem is to send an email when renewdate equals system date. I generate current date using function sysdate() and assigned it to d. Also assigned renewdate in table to dates using dates = rs.getDate("renewdate"). My problem is I can not match up both d and dates and thus can not sent email. Could you help me how to match d and dates. I tried while(rs.next()) all the dates from table register is obtained. But can not match with d using if(dates==d). Also I tried if(rs.next()), but it only fetch first renewdate from table. So how could i check all the values of renewdate and match with the current date to sent message
tagged with: date
type: AnsweredQuestion
has title: How to match system date with the date from database mysql

http://stackoverflow.com/comment/42319374
comment on: http://stackoverflow.com/a/26881758
score: 0
type: AnswerComment
type: Comment
has text: I have done that and the app crashed with log 11-12 15:47:14.496: E/AndroidRuntime(13396): at dalvik.system.NativeStart.main(Native Method)

http://stackoverflow.com/a/26935494
type: Answer
score: 31
answers question: http://stackoverflow.com/q/26935453
upvote count: 31
has comment: http://stackoverflow.com/comment/42419302
has comment: http://stackoverflow.com/comment/42420283
accepted answer of: http://stackoverflow.com/q/26935453
has body: The error is exactly what the compiler says it is - you've got a final field, but nothing setting it. Final fields need to be assigned to exactly once. You're not assigning to it at all. We don't know what the field is meant to represent beyond the documentation ("The standard initial password") - presumably there is some default password which you're meant to know. You should assign that value to the field, e.g. public static final String INITIAL = "defaultpassword"; Additionally: you don't need to write java.lang.String; just use the short name (String). It's very rarely a good idea to use fully-qualified names within your code; just import the types you're using, and be aware that everything in java.lang is imported automatically. Additionally: don't compare strings using ==; use .equals instead. Additionally: any time you have code like this: if (condition) { return true; } else { return false; } you can just write: return condition; For example, your acceptable method can be written as: public boolean acceptable(String suggestion) { return suggestion.length() &gt;= 6 &amp;&amp; !suggestion.contains(" "); }
has comment: http://stackoverflow.com/comment/102456751
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42420563

http://stackoverflow.com/comment/42288436
score: 0
has text: Ur mapping is wrong. Giving @JoinColumn on List is not possible saying that Study2 class to hold many keys of DataList table in one row
comment on: http://stackoverflow.com/q/26862289
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26879029
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26878965
downvote count: 0
answers question: http://stackoverflow.com/q/26878965
has body: JFrame with a BorderLayout, onto that, add a JPanel with a GridBagLayout. Add your other two panels onto this. See Laying Out Components Within a Container and How to Use GridBagLayout for more details import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Test { public static void main(String[] args) { new Test(); } public Test() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { public TestPane() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.weighty = 0.75; JPanel top = new JPanel(new GridBagLayout()); top.add(new JLabel("Top")); top.setBackground(Color.RED); add(top, gbc); gbc.gridy++; gbc.weighty = 0.25; JPanel bottom = new JPanel(new GridBagLayout()); bottom.add(new JLabel("Bottom")); bottom.setBackground(Color.BLUE); add(bottom, gbc); } @Override public Dimension getPreferredSize() { return new Dimension(200, 200); } } }
score: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/42483778
has text: It worked perfectly. Thank you, and for someone still learning GUI, this was very informative.
type: AnswerComment
comment on: http://stackoverflow.com/a/26967898
score: 0
type: Comment

http://stackoverflow.com/comment/42477427
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26966774
type: QuestionComment
has text: The max heap size for tomcat is 12 GB while the server has 16 GB memory in whole, so there seems to be plenty of free memory for memory mapped IO (there is no other major process running apart from tomcat). I am trying to run this basic query: START referee=node(*) MATCH referee<-[r:IS_FRIEND_OF]-(referrer:User) WHERE referee:`1677523` RETURN referrer;

http://stackoverflow.com/comment/42509939
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26988770
has text: Works like sex! Thanks bro!

http://stackoverflow.com/q/26832481
has body: Doing triple DES with the code : public class TripleDES { private static sun.misc.BASE64Decoder decoder = new sun.misc.BASE64Decoder(); private static sun.misc.BASE64Encoder encoder = new sun.misc.BASE64Encoder(); public static void main(String[] args) { try { try { Cipher c = Cipher.getInstance("DESede"); } catch (Exception e) { System.err.println("Installing SunJCE provider."); Provider sunjce = new com.sun.crypto.provider.SunJCE(); Security.addProvider(sunjce); } File keyFile = new File("D:/3DES/keygen.txt"); /* * writeKey(generateKey(),keyFile); * System.out.println("After writing to file"); */ SecretKey rKey = readKey(keyFile); System.out.println("Secret key :" + rKey); String encryptedMssg = encrypt(rKey, "afda"); System.out.println("Encrypted mssg :" + encryptedMssg); String decryptedMssg = decrypt(rKey, encryptedMssg); System.out.println("Decrypted mssg :" + decryptedMssg); } catch (Exception e) { System.err.println(e); System.err.println("Usage: java " + TripleDES.class.getName() + " -d|-e|-g &lt;keyfile&gt;"); } } public static SecretKey generateKey() throws NoSuchAlgorithmException { KeyGenerator keygen = KeyGenerator.getInstance("DESede"); System.out.println(keygen.generateKey()); return keygen.generateKey(); } public static void writeKey(SecretKey key, File f) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException { SecretKeyFactory keyfactory = SecretKeyFactory.getInstance("DESede"); DESedeKeySpec keyspec = (DESedeKeySpec) keyfactory.getKeySpec(key, DESedeKeySpec.class); byte[] rawkey = keyspec.getKey(); FileOutputStream out = new FileOutputStream(f); out.write(rawkey); out.close(); } public static SecretKey readKey(File f) throws IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidKeySpecException { DataInputStream in = new DataInputStream(new FileInputStream(f)); byte[] rawkey = new byte[(int) f.length()]; in.readFully(rawkey); in.close(); DESedeKeySpec keyspec = new DESedeKeySpec(rawkey); SecretKeyFactory keyfactory = S…
upvote count: 0
answer count: 1
tagged with: tripledes
favorite count: 0
has title: triple des implementation hex input
score: -3
type: UnansweredQuestion
tagged with: encryption
downvote count: 3
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26833130

http://stackoverflow.com/comment/42476155
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26967520
score: 0
has text: The domainpart of the JID was missing, to be correct. See also the javadoc of [createChat](https://www.igniterealtime.org/builds/smack/docs/latest/javadoc/org/jivesoftware/smack/ChatManager.html#createChat(java.lang.String,%20org.jivesoftware.smack.MessageListener)).

http://stackoverflow.com/a/26931781
has body: Nope, not even for tomcat. You are re-inventing the wheel. When you code a class like that, assuming that you are going to be something like an HTTP server, or whatever, you essentially are making a stand alone java application. How do you deploy that? What about: java my.main.java.file -claspatth whatever.jar;myApplication.jar;depends.jar;upon.jar When you deploy code to an application server, whetther full-fleged Java EE container (e.g. glassfish) or not (e.g. tomcat), you let the server handle the low level apis, such as new ServerSocket(port). You just code what comes after, when a request comes in, e.g. by coding http servlets.
answers question: http://stackoverflow.com/q/26931468
score: 0
type: Answer

http://stackoverflow.com/q/26947183
tagged with: java
type: Question
score: 3
tagged with: enums
has title: Spring 3.2.4 can't convert String to Enum in <util:map.../> although 'key-type' is specified
has answer: http://stackoverflow.com/a/26947697
has body: I'm trying to define a map bean with Spring 3.2.4 with an Enum as the key type, this way: &lt;util:map id="myMapping" key-type="com.acme.MyEnum"&gt; &lt;entry key="ENUM1" value="value1" /&gt; &lt;entry key="ENUM2" value="value2" /&gt; &lt;/util:map&gt; The MyEnum class is a trivial class: public enum MyEnum { ENUM1, ENUM2 } When creating the application context, Spring throws this exception: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myMapping': Error converting typed String value for bean property 'sourceMap'; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'com.acme.MyEnum'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.acme.MyEnum]: no matching editors or conversion strategy found (formatted for better readbility) I expected Spring to convert the String "ENUM1" to "MyEmum.ENUM1", because of the given key type key-type="com.acme.MyEnum" in the mapping bean declaration. I know how to solve this by doing an alternate bean definition, using &lt;entry&gt;, using the full qualified class name of the enum etc... But I would like to build the defintion as described for easy readability. Is this a known bug or a lack of understanding on my side? Thanks a lot for your help!
has answer: http://stackoverflow.com/a/26950098
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: dictionary
tagged with: http://stackoverflow.com/tag/xml
upvote count: 3

http://stackoverflow.com/comment/42234296
type: AnswerComment
type: Comment
has text: I have the AsyncTask in a completely separate class. How would I pass these values to the AsyncTask? Seems odd to create the object in the AsyncTask associated with just getting a location.
score: 0
comment on: http://stackoverflow.com/a/26834030

http://stackoverflow.com/a/26960533
has comment: http://stackoverflow.com/comment/42472923
score: 0
has comment: http://stackoverflow.com/comment/42470890
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26950140
type: Answer
answers question: http://stackoverflow.com/q/26950140
has body: FileObject.refresh() is what you're looking for. The editor should listen to its changes (through layers that you've mentioned).
has comment: http://stackoverflow.com/comment/42475194

http://stackoverflow.com/a/26954431
answers question: http://stackoverflow.com/q/26954205
score: 0
has body: I do not know exactly, but I think you want to get strings after some of specific characters. So I changed code like below. package org.owls.test; public class CheckStart { private static String checkStart(String word){ char [] punctuation = {'.' , ',' , ';' , ':', '?' , '!' , '"' , '\'' , ')' , '('}; int i; for (i = 0; i &lt; punctuation.length;i++){ for(int j = 0; j &lt; word.length(); j++){ if(word.charAt(j) == punctuation[i]){ word = word.substring(j); } } } return word; } public static void main(String[] args) { System.out.println(checkStart("gasf;dgjHJK")); } } So you can get ';dgjHJK' as returns. If there are multiple keywords and you want to substring from only first, you add break; to second loop in checkStart. Have a good day!
type: Answer
has comment: http://stackoverflow.com/comment/42448765

http://stackoverflow.com/a/26878678
has body: main() is static void. It can't return maxValue. I think you wanted to print it. // return maxValue; System.out.printf("maxValue = %d%n", maxValue); But perhaps you were trying to extract that to a method like public static int getLargestValue(int[] arr) { if (arr == null) { return Integer.MIN_VALUE; } int max = arr[0]; for (int i = 1; i &lt; arr.length; i++) { max = Integer.max(max, arr[i]); } return max; } Then you could call it in main() like public static int getLargestValue(int[] arr) { if (arr == null) { return Integer.MIN_VALUE; } int max = arr[0]; for (int i = 1; i &lt; arr.length; i++) { max = Integer.max(max, arr[i]); } return max; } public static void main(String[] args) { int[] array = { 45, 38, 27, 46, 81, 72, 56, 61, 20, 48, 76, 91, 57, 35, 78 }; System.out.println(getLargestValue(array)); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26878657

http://stackoverflow.com/comment/42429306
has text: Typically, if onDestroy() is not called it is because the process is being killed, so normal allocations will be freed by the process death anyway.
comment on: http://stackoverflow.com/q/26941868
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42277202
type: QuestionComment
comment on: http://stackoverflow.com/q/26857776
type: Comment
has text: @ScaryWombat yes,exactly!!! it would save lot of effort,and use standard API,because they are well tested before.
score: 0

http://stackoverflow.com/comment/42595879
type: Comment
comment on: http://stackoverflow.com/a/26903337
has text: I have uppdated my question also. Please reply asap. I will follow this post until I am done with its integration and will let you know when done
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42434280
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26945618
has text: Thanks for your help Mat. I believe your solution is very similar to the accepted answer.

http://stackoverflow.com/q/26871483
favorite count: 0
has body: I am trying to implement some code so I can marshall and unmarshall some xml using JAXB. Basically, I have a xml in the following format: <field description = "blabla" type = "blabla"> <field description = "blabla" type = "blabla"> I want to create a HashMap if Registers, where its key is the register type and its value is the register itself. I am not sure how to do it. Is it possible? I have already tried to use Adapters, but it didn't work. Can anyone help me here?
accepted answer: http://stackoverflow.com/a/26871941
has title: How to Marshall and Unmarshall Map using JAXB
type: Question
tagged with: dictionary
upvote count: 1
linked to: http://stackoverflow.com/q/3941479
answer count: 1
duplicate of: http://stackoverflow.com/q/3941479
has answer: http://stackoverflow.com/a/26871941
tagged with: java
tagged with: jaxb
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/q/26908376
type: UnansweredQuestion
has body: I have not been able to fix this error: Missing ; before statement. (line 2, file "Code"). I have searched for an answer on this site as well as other places and have found 1 or 2 related answers. Unfortunately they prove useless because they are specific to a certain condition. Here is the first ten lines of my code: function myFunction() { import java.util.*; import javax.swing.JOptionPane; class quizzed { public static void main(String[] args) { // TODO Auto-generated method stub int restart = 0; Scanner input = new Scanner (System.in); JOptionPane.showMessageDialog(null, "Welcome to a capital quiz! Ready. Go!"); Thank you.
has comment: http://stackoverflow.com/comment/42366912
score: -1
tagged with: java
downvote count: 1
type: Question
has title: Missing ; before statement: Google Scripts
upvote count: 0
has answer: http://stackoverflow.com/a/26909216
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42366889

osx-mavericks
type: Tag
tags question: http://stackoverflow.com/q/26875107
tag name: osx-mavericks

http://stackoverflow.com/a/26955031
accepted answer of: http://stackoverflow.com/q/26954895
score: 0
type: Answer
has body: You are not using List here but Array, In order to use a list do List&lt;integer&gt; list = new ArrayList&lt;integer&gt;() for( String f : fimg ) { list.add(f); } Now you you can simply retrieve by list.get(position) (ImageView image = (Imageview) new findViewById(list.get(position));) It will return the int !
answers question: http://stackoverflow.com/q/26954895
type: AcceptedAnswer

http://stackoverflow.com/comment/42319437
type: Comment
has text: Because of the different parameters?
type: QuestionComment
comment on: http://stackoverflow.com/q/26881813
score: 1

http://stackoverflow.com/a/26940994
has comment: http://stackoverflow.com/comment/42441529
has body: I guess problem is with your input file.Make sure your input is not of the form "cauchy hep(21\10\1991) ","cauchy hep" .Notice the space between ) and " remove the space if any since: if (line.charAt(0) == '"') { csvSplitBy = "\","; } else { csvSplitBy = ","; } csvSplitBy equals "\"," no space with the last character of string. If your file doesn't follow the pattern you specified whole line or whole file wil be treated as single string and will be stored in movies[0] .So there will no string at index 1 of movies that's why ArrayIndexOutOfBound. Remove the space Or you can include the space the beginning " \"," again notice the space between " \"," .It will solve the problem.
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26940342
has comment: http://stackoverflow.com/comment/42441936
score: 1
answers question: http://stackoverflow.com/q/26940342
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42426441
comment on: http://stackoverflow.com/a/26941322
score: 0
type: AnswerComment
has text: A queue doesn't support their indexing requirement.
type: Comment

http://stackoverflow.com/comment/42526520
type: QuestionComment
has text: What does your `Procfile` look like? I'm wondering if you are binding to the correct port, which is configured with `$PORT` env var.
score: 0
comment on: http://stackoverflow.com/q/26923554
type: Comment

http://stackoverflow.com/a/26952563
downvote count: 0
has body: You can only pass by value in Java. Your best solution is the second one your son suggested, i.e. return an object that has the head and tail.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26952513

jndi
tags question: http://stackoverflow.com/q/26882282
tags question: http://stackoverflow.com/q/26920068
tags question: http://stackoverflow.com/q/26892729
tags question: http://stackoverflow.com/q/26903751
tag name: jndi
type: Tag
tags question: http://stackoverflow.com/q/26901832

http://stackoverflow.com/comment/42380313
type: Comment
comment on: http://stackoverflow.com/a/26884315
has text: again thanks for you help, but still i have confusion. When i send Authorization Basic with 64 encoding in header, i will access the token, but after token detail recive, when i access the URL there is not need to send the token in header, just again send the basic authorization. Why this problem occur ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26909638
accepted answer of: http://stackoverflow.com/q/26909521
upvote count: 8
type: Answer
has body: Reason for infinite loop is that when you try entering input, you press enter key and that extra character (enter) is disregarded by scanner when calling nextInt. Hence when you enter invalid number you get exception and scanner again sees enter character as you didnt consumed that character and hence you never come out of it. In order to avoid it try consuming that character when you get exception like: catch (InputMismatchException e) { System.err.println("Wrong input! Input only integer numbers please..."); sn.nextLine(); } And that should resolve your issue.
score: 8
answers question: http://stackoverflow.com/q/26909521
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26854564
score: -1
type: Question
upvote count: 0
has body: I need to upload a file from java client running on my system to web-server(yahoo hosting) using PHP script. I have java code and php code as follows. The java program is not showing up any error and running successfully but the text file is not being uploaded to web server. Please help and suggest necessary changes. javaClient.java import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; public class javaClient { public static void main(String[] args) throws Exception { HttpURLConnection httpUrlConnection = (HttpURLConnection) new URL("http://www.xyzAbc.com/project_files/upload.php").openConnection(); httpUrlConnection.setDoOutput(true); httpUrlConnection.setRequestMethod("POST"); File myFile = new File ("/Users/pp/Documents/client_file.pdf"); byte [] mybytearray = new byte [(int)myFile.length()]; FileInputStream fis = new FileInputStream(myFile); OutputStream os = httpUrlConnection.getOutputStream(); BufferedInputStream bis= new BufferedInputStream(fis); bis.read(mybytearray,0,mybytearray.length); System.out.println("Sending the file of size:"+ mybytearray.length + " bytes"); os.write(mybytearray,0,mybytearray.length); System.out.println("File sent."); BufferedReader in = new BufferedReader(new InputStreamReader(httpUrlConnection.getInputStream())); String s = null; while ((s = in.readLine()) != null) { System.out.println(s); } os.flush(); bis.close(); os.close(); fis.close(); in.close(); } } upload.php &lt;?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name'])." has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?&gt;
has answer: http://stackoverflow.com/a/26854791
has title: Sending a file from java client to PHP web-server (yahoo web hosting)
answer count: 1
tagged with: client
tagged with: file-upload
favorite count: 0
type: UnansweredQuestion
tagged with: php
downvote count: 1
tagged with: java
tagged with: webserver

http://stackoverflow.com/comment/42644937
has text: Well, I was pretty shure but I checked it out and you are right. Now totally deserved an up-vote!
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26987358

http://stackoverflow.com/a/26916883
accepted answer of: http://stackoverflow.com/q/26916806
score: 3
has comment: http://stackoverflow.com/comment/42384592
has body: Have you checked that the pinout of that cable is correct for your application ? You need a so-called "null-modem" cable, which will cross rx and tx. This is needed so that PortA.tx (transmit) goes to PortB.rx (Recieve) http://ftp1.digi.com/support/images/nmodems.gif There is a good chance that the cable you have is a "straight through" type, since equipment with a female-style connector will have it's rx/tx switched around compared to male-style connectors. (Devices with one type connector is called DTE and DCE) Here is a good example. http://www.bb-elec.com/Images/whitepaper-images/WhatIsRS232-DCE-DTEPinDiagram.aspx http://www.wut.de/kpics/e-8wwww-17-grus-000.gif
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42400469
type: Answer
has comment: http://stackoverflow.com/comment/42383232
answers question: http://stackoverflow.com/q/26916806
upvote count: 3

http://stackoverflow.com/q/26942962
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26944638
has title: No value is return on the JDialog after clicking ok button
answer count: 2
has body: My class that extends to JDialog won't return a value after clicking okay. Could anyone show what I'm doing wrong? I want it to return a value which is a double. Here's my code: import javax.swing.*; import javax.swing.border.*; import java.awt.*; import java.awt.BorderLayout; import java.awt.event.*; public class DepositWindow extends JDialog { private JButton jbtOk; private JButton jbtCancel; private JLabel jlbAccountNumber; private JTextField jtfAmount; public DepositWindow() { setModal(true); // Create panel p1 for the buttons and set GridLayout // Set BorderLayout with horizontal gap 5 and vertical gap 10 setLayout(new BorderLayout(5, 10)); JPanel p1 = new JPanel(); p1.setBorder( new TitledBorder("Actions")); p1.setLayout(new FlowLayout(FlowLayout.RIGHT, 1, 1)); jbtOk = new JButton("OK"); jbtCancel = new JButton("Cancel"); p1.add(jbtOk); p1.add(jbtCancel); this.add(p1,BorderLayout.SOUTH); JPanel p2 = new JPanel(new GridLayout(2,2)); p2.setBorder( new TitledBorder("Account")); p2.add(new JLabel("Account Number")); jlbAccountNumber = new JLabel("*****-56"); p2.add(jlbAccountNumber); p2.add(new JLabel("Amount")); jtfAmount = new JTextField(10); p2.add(jtfAmount); // add contents into the frame add(p2, BorderLayout.CENTER); jbtOk.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ setVisible(false); } }); } public double getAmount(){ return Double.parseDouble(jtfAmount.getText()); } /** Main method */ public static void main(String[] args) { DepositWindow frame = new DepositWindow(); frame.setTitle("Deposit Window"); frame.pack(); frame.setLocationRelativeTo(null); // Center the frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); double amount = frame.getAmount(); } } It's giving me these errors when I run my main Error: Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: empty String at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1011) at java.lang.…
favorite count: 0
tagged with: jdialog
tagged with: return
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42431965
has comment: http://stackoverflow.com/comment/42432489
has answer: http://stackoverflow.com/a/26944883
tagged with: java
score: 0
upvote count: 1

http://stackoverflow.com/comment/42272410
type: Comment
has text: within windows I am using netbeans to add the jar to the project file compiling out the new jar project file and running via commandline in linux, that way the included jar is within the new compiled jar.... this works in windows by executing the runnable jar file by double clicking or running via command line. in linux I transfer the compiled jar over and run via command line
score: 0
comment on: http://stackoverflow.com/q/26854659
type: QuestionComment

jenkins
tags question: http://stackoverflow.com/q/26920034
tag name: jenkins
tags question: http://stackoverflow.com/q/26874073
tags question: http://stackoverflow.com/q/26906972
tags question: http://stackoverflow.com/q/26988031
tags question: http://stackoverflow.com/q/26901995
tags question: http://stackoverflow.com/q/26836882
tags question: http://stackoverflow.com/q/26890878
tags question: http://stackoverflow.com/q/26879950
tags question: http://stackoverflow.com/q/26989137
type: Tag

http://stackoverflow.com/comment/42399816
type: Comment
comment on: http://stackoverflow.com/q/26926805
has text: What didn't work? Who says that using the seda component is not recommended?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/83168618
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/42730132
has text: It works for me, spring boot version:1.5.9.RELEASE. However, I find the root cause is I should put ApplicationConfig at the parent package of my entity package. So, it could automatically scan the entities in hierarchy.
score: 1

http://stackoverflow.com/comment/42410964
score: 0
type: Comment
type: QuestionComment
has text: S should be myString in the setter function
comment on: http://stackoverflow.com/q/26933066

http://stackoverflow.com/comment/42330946
has text: If you want a better explanation, edit you question to include some information about your data structure. @Ankita gave an example in the answer below.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26859554

http://stackoverflow.com/comment/42315701
type: AnswerComment
type: Comment
has text: @OM: Check edit, there's nothing wrong with the code itself. Try copying and pasting the code, AND use the test input file I provide. Just fyi, you can print the stacktrace so you can see the line number to the piece of code that's causing the problem... which would be helpful. If you're receiving the error it's because you're source code does not match what you're posting or there's an edge case in you're input file that's causing an issue.
comment on: http://stackoverflow.com/a/26857307
score: 0

http://stackoverflow.com/comment/42308619
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26869944
has text: You could still manually trigger sorting by directly interacting with the ListStore and calling grid.getHeader().updateSortIcon.

http://stackoverflow.com/comment/42592377
comment on: http://stackoverflow.com/q/26895725
has text: It works for me. That is, it prints full date time and not just date because you chose to use `DateTime` rather than `Date`, but other than that I get the correct output as you wrote above.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26927495
type: Answer
has comment: http://stackoverflow.com/comment/42404002
downvote count: 0
has comment: http://stackoverflow.com/comment/42401719
score: 1
answers question: http://stackoverflow.com/q/26927473
has body: Just store the result in a variable and return it after the try block. public String admin () { String result=null; String username = loginUserTF.getText(); String password = loginPassPF.getText(); String query = "SELECT * FROM userinfo where username=? and password=?"; try{ connect.pst=connect.con.prepareStatement(query); connect.pst.setString(1, username); connect.pst.setString(2, password); connect.rs = connect.pst.executeQuery(); if (rs.next()) result = connect.rs.getString("Administrator"); } catch(Exception e){ } return result; } I would also suggest that you don't keep your catch clause empty. You should handle any exceptions you catch.
has comment: http://stackoverflow.com/comment/42401313
has comment: http://stackoverflow.com/comment/42401524
upvote count: 1

http://stackoverflow.com/q/26851317
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42266017
has title: How to retrieve IP address from DNS response message
type: Question
score: 0
has answer: http://stackoverflow.com/a/26851686
tagged with: dns
answer count: 1
has body: I have been trying to program DNS request-reply for a small project. Here is the DNS request message de42010000010000000000000377777706676f6f676c6503636f6d0000010001 that I am sending to query the ip address for www.google.com. The server I am requesting to is 141.26.64.1. I managed to get the response packet. But I am not sure how to retrieve the IP address from the resonse array of bytes. I found an example on the internet which assumes that the last four bytes of the response contains the resolved IP address. Is it always true? Or from which bit location the 4 bytes of the resolved IP starts. For the time being I don't want to go into the finest details of DNS response datagram because I am trying to keep my code as simple as possible. So I just want to know if there is a specific bit location where those 4-bytes bigin. Thanx in advance
has comment: http://stackoverflow.com/comment/42265058
tagged with: java

http://stackoverflow.com/comment/42435461
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26946618
type: Comment
has text: Yes, your answer is also correct, I didn't see that either. Should you integrate your answer with mine, vice versa, or just keep it like this?

http://stackoverflow.com/q/26897344
has answer: http://stackoverflow.com/a/26897444
tagged with: fileinputstream
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/93911619
linked to: http://stackoverflow.com/q/19500458
has comment: http://stackoverflow.com/comment/42347774
has comment: http://stackoverflow.com/comment/42347847
accepted answer: http://stackoverflow.com/a/26897444
tagged with: keystore
has body: Weird problem and I verified it is reading the same file. This does not work: keystore = KeyStore.getInstance("PKCS12"); InputStream inputStream = ClassLoader.getSystemResourceAsStream("keystores/active.pfx"); keystore.load(inputStream, "the_password".toCharArray()); This, however, does work: keystore = KeyStore.getInstance("PKCS12"); InputStream inputStream = new FileInputStream(new File("src/main/resources/keystores/active.pfx")); keystore.load(inputStream, "the_password".toCharArray()); I get the following error: DER length more than 4 bytes: 111 It's that change of the input stream and I can't figure out what the difference is. I triple-checked the file to make sure it was using the same file. Why is Java treating these streams differently? If I figure out that, I can probably figure out how to fix the problem.
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: inputstream
has title: difference between FileInputStream and ClassLoader.getSystemResourceAsStream
type: Question

http://stackoverflow.com/a/26973396
answers question: http://stackoverflow.com/q/26973231
upvote count: 3
has body: Add @XmlTransient to ignore it. @XmlTransient public abstract String getResponseData();
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/q/26846862
upvote count: 3
tagged with: java
downvote count: 0
has body: I am trying to write a program that allows the user to make a set of folders in a specific place. I have tried many things so far, but nothing seems to work. To be a bit clearer, I am having the user input a folder path (using JFileChooser) and it will set the directory for them in a text field(JTextField). I would like to know how I could make it so that when it creates the folder in the user-defined path, it also names the folder accordingly. Here is a bit of a 'working' sample code of what I have so far: public static void addComponentsToPane(Container pane) { if (RIGHT_TO_LEFT) { pane.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); } //Components pane.setLayout(new GridBagLayout()); JLabel label; GridBagConstraints c = new GridBagConstraints(); JButton buttonH; JButton buttonB; JButton cButton; JCheckBox checkboxP; JCheckBox checkboxV; JCheckBox checkboxD; JCheckBox checkboxM; if(shouldFill) { c.fill = GridBagConstraints.HORIZONTAL; } //Input Label label = new JLabel(" Please Enter Folder Destination "); if(shouldWeightX) { c.weightx = 0.5; } c.ipady = 10; c.fill = GridBagConstraints.BOTH; c.gridwidth = 2; c.gridx = 0; c.gridy = 0; pane.add(label, c); //Blank Label label = new JLabel (" "); c.fill = GridBagConstraints.BOTH; c.ipady = 5; c.gridx = 2; c.gridy = 1; pane.add(label, c); //Text Field text = new JTextField(" Folder Path "); c.ipady = 0; c.fill = GridBagConstraints.BOTH; c.weightx = 0.0; c.gridx = 0; c.gridy = 2; c.gridwidth = 3; pane.add(text, c); text.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent t) { textAreaPath = text.getText(); p1 = Paths.get(textAreaPath); } }); //Browse Button buttonB = new JButton(" Browse "); c.fill = GridBagConstraints.BOTH; c.gridx = 3; c.gridwidth = 1; c.gridy = 2; pane.add(buttonB, c); buttonB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent b) { JFileChooser fc = new JFileChooser(); FileNameExtensionFilter filter = new FileNameExtensionFilter…
has comment: http://stackoverflow.com/comment/42258674
tagged with: file-io
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27192189
tagged with: directory
favorite count: 0
has comment: http://stackoverflow.com/comment/42257243
type: Question
answer count: 1
has title: Make directory from path with desired directory name
accepted answer: http://stackoverflow.com/a/27192189

http://stackoverflow.com/comment/42383051
comment on: http://stackoverflow.com/q/26893717
score: 1
has text: Are you familiar with debugging NPE's? You need to inspect the stacktrace, find the line causing the exception, find the variable on that line that is null, and then trace back into your code to see why it is null. You will run into these time and time again, so being familiar with them and how to handle them will be important. I again suspect that it may be null due to your Strings not behaving as you think they should be behaving. Again, a small compilable program would help us **immensely**. I can't stress this point enough.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26930380
score: 1
tagged with: java
tagged with: dom
type: Question
answer count: 2
has title: Remove an XML Node if an attribute has a specific value
has answer: http://stackoverflow.com/a/26930591
downvote count: 0
has body: I have the need to search into an XML for some attributes and delete its Node if the attribute is found. For example, I want to remove the book nodes which have attributes beginning with "#false" Gambardella, Matthew XML Developer's Guide Computer 44.95 <publish_date>2000-10-01</publish_date> An in-depth look at creating applications with XML. So far, I have been able to capture all "#false" Elements using an XPath expression: String search = "//@*[starts-with(.,'#false')]"; NodeList nodeList = (NodeList) xPath. compile(search).evaluate(doc, XPathConstants.NODESET); ((Node)nodeList.item(0)).getParent(); // NULL!! However the problem is that the Parent Node of "available" Elements is null so I cannot find a way to remove the whole "book" Node. Any help ?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26930591
has answer: http://stackoverflow.com/a/26930705
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
possible better answer: http://stackoverflow.com/a/26930705
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/26840012
type: Question
has comment: http://stackoverflow.com/comment/42274102
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26840054
has body: I am looking for a protocol which is non-blocking(does not wait for missing packets) like UDP but it tracks the missing packets so I can download the missing packets later/in parallel. The main objective is to increase the download speed by avoiding waiting time for packets and still getting the complete file. Kindly if there is something like this out there that can help increase download speed then name it. Thanks.
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/26840054
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42244737
has title: Protocol for downloading file
tagged with: java
tagged with: http

http://stackoverflow.com/comment/42464019
type: Comment
has text: @MarcinOrlowski Why do you think I did not? I searched but was not understanding what was wrong. Sorry, but I am brand new to Java.
score: 0
comment on: http://stackoverflow.com/a/26961261
type: AnswerComment

http://stackoverflow.com/a/26917550
type: AcceptedAnswer
type: Answer
has body: Declare one TableColumn&lt;String, Object&gt; tableColumn and use this, but keep track of the class of values (according to column.get("DATA_TYPE"). You may use this to branch processing when you extract values, cast to the approproate data type. Not very elegant, but since the data is any of three types...
accepted answer of: http://stackoverflow.com/q/26917458
answers question: http://stackoverflow.com/q/26917458
score: 0

http://stackoverflow.com/q/26920114
answer count: 1
has title: Converting array-formatted string input to string array efficiently
tagged with: string
has body: Say one has string input in the form below: { 'OTH', 'REJ', 'RSTO', 'RSTOS0', 'RSTR', 'S0', 'S1', 'S2', 'S3', 'SF', 'SH' } What would be an efficient way to convert it to an array of Strings with each element being OTH, REJ, etc.? I've currently done this using String.replace() and String.split() and have also considered the use of regex-s for the same, but was wondering whether there was a more easier/intuitive way of doing so.
has answer: http://stackoverflow.com/a/26920565
score: 0
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26920565
tagged with: arrays

http://stackoverflow.com/comment/42425594
type: QuestionComment
has text: Yeah, that's about the only way that line could throw an NPE.
comment on: http://stackoverflow.com/q/26940784
score: 0
type: Comment

1wire
type: Tag
tag name: 1wire
tags question: http://stackoverflow.com/q/26881525

http://stackoverflow.com/q/26979638
upvote count: 2
tagged with: scene2d
tagged with: java
has answer: http://stackoverflow.com/a/26979995
answer count: 1
tagged with: libgdx
has title: How to update table row in Libgdx?
accepted answer: http://stackoverflow.com/a/26979995
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
has body: I have a score table with an array of players added in my initial constructor like so: for( int i=0; i&lt;this.players.size; i++ ) { scoreTable.add( new Label(players.get(i).getName(), skin) ); // first column scoreTable.add( new Label(players.get(i).getScore() + "", skin) ); // second column scoreTable.row(); } +----------+--------+ | Player A | 0 | +----------+--------+ | Player B | 0 | +----------+--------+ | Player C | 0 | +----------+--------+ Now in my render() method, I want to update the player score in the table but I have no idea how to get the referencing index to be able to do so. Any ideas would be appreciated as I can't seems to find any example on the net or doc.

http://stackoverflow.com/comment/42512531
comment on: http://stackoverflow.com/q/26990428
has text: Please post the whole thing
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26836428
has answer: http://stackoverflow.com/a/26836611
accepted answer: http://stackoverflow.com/a/26836576
downvote count: 0
tagged with: sorting
favorite count: 0
type: AnsweredQuestion
has title: What is the difference between using comparable by passing instance of our model class to comparable and passing wrapper to comparable?
has comment: http://stackoverflow.com/comment/42239765
has body: Suppose I have a Student class with attributes name and id. And I want to sort the List of students in natural order of their respective ids using Collections.sort() method. I can do it in following two ways: public class Student implements Comparable&lt;Student&gt; { private Long id; private String name; // getters and setters.. public int compareTo(Student student){ return this.getId().compareTo(student.getId()); } } And the other way is: public class Student implements Comparable&lt;Long&gt; { private Long id; private String name; // getters and setters.. public int compareTo(Long id){ return this.getId().compareTo(id); } } And then use the Collections.sort() method to sort the list of students. My question or confusion is what difference does it make if we use one over other as they both produce the same result.
upvote count: 1
has answer: http://stackoverflow.com/a/26836576
tagged with: collections
has comment: http://stackoverflow.com/comment/42238832
type: Question
score: 1
tagged with: java
tagged with: comparable
possible better answer: http://stackoverflow.com/a/26836611
answer count: 2

http://stackoverflow.com/a/26940773
answers question: http://stackoverflow.com/q/26940739
type: Answer
upvote count: 2
score: 1
downvote count: 1
has body: See here: Assign JavaScript variable to Java Variable in JSP As that states, it's really not possible as the JSP executes on the server, and the javascript executes later in the browser.

http://stackoverflow.com/q/26887803
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26889289
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42332485
tagged with: java
has body: I need to find if any of several strings of my List exist in a List of files with extension .txt and .xml. I have my own list of strings: "hello","goodbye","etc". I need the list of files with "hello" or "goodbye" or "etc". For example: a.csv contains: a|b|hello|d b.xml contains: <c>goodbye</c> The List of files in this case are: /path/folder1/a.csv /path/folder2/b.xml And then, renombrate with folder name: /path/folder1/a.csv.folder1 /path/folder2/b.xml.folder2
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42396331
score: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Example with Grep4j 1.5 version (for jdk 1.5)

http://stackoverflow.com/q/26963967
tagged with: java
has answer: http://stackoverflow.com/a/26964160
type: Question
has body: Not exactly sure why I am getting java.lang.NullPointerException for the String array? I looked for hours but can't find any problem. Please help private String[] stringList; int j = 0; StringClass stringRef = new StringClass(); while (//As long as there is string available from what I am reading in) { str = //String read in; stringRef.setString(str); stringList[j] = stringRef.returnString(); //Shows that this line is the error j++; } Here is the class: public class StringClass { private String stringNew; public void setString(String newStr){ stringNew = newStr; } public String returnString(){ return stringNew; } }
tagged with: null
tagged with: arrays
answer count: 1
score: 0
has title: Why am I getting java.lang.NullPointerException for a String array?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42465839
tagged with: error-handling
has comment: http://stackoverflow.com/comment/42465861

http://stackoverflow.com/q/26833880
downvote count: 0
favorite count: 0
tagged with: querydsl
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42576971
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/24482259
tagged with: spring-data
has answer: http://stackoverflow.com/a/26992942
upvote count: 1
tagged with: classpath
type: Question
has body: I generate My Qclasses in target/generated-sources/java and the Qclasses are generating good but when i want to use them in my src code /YY/src/controller/XXX.java for example like that QLot lot = QLot.lot; I get QLot cannot be resolved to a variable . It seems that the generated Qclasses are not in the classpath !! com.mysema.maven apt-maven-plugin 1.0.6 process target/generated-sources/java com.mysema.query.apt.jpa.JPAAnnotationProcessor
accepted answer: http://stackoverflow.com/a/26992942
has title: including Qclasses in the classpath
has comment: http://stackoverflow.com/comment/42571938
answer count: 1

http://stackoverflow.com/q/26980671
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have an AsyncTask and from what I can tell I am passing the eventId wrong because in log it shows up as "Ljava.lang.String;@423e4370" The AsyncTask is: private class CallCategoryList extends AsyncTask&lt;String, Void, String&gt; { protected String doInBackground(String... eventId) { return readCategoryJSONFeed("http://webservice/service/category_list.php", eventId.toString()); } ... } I call it by doing: new CallCategoryList().execute(fv); fv is got by calling a function that returns it from a class public String getEventByName(List&lt;Event&gt; eventList, String eventName) { for (Event event : eventList) { if (event.getEventName().equals(eventName)) { return event.getId(); } } return null; } Other questions along this line suggest creating another class to hold the variable. Is there not a simple way to pass this variable with execute?
has title: I need to pass a variable in AsyncTask execute but can't figure out how to do it
score: 0
tagged with: types
answer count: 1
tagged with: variables
tagged with: android-asynctask
has answer: http://stackoverflow.com/a/26980986
accepted answer: http://stackoverflow.com/a/26980986

http://stackoverflow.com/q/26873050
type: AnsweredQuestion
has title: JodaTime difference between plusHours and plusDays for Daylight Savings Time
downvote count: 0
favorite count: 0
type: Question
tagged with: dst
score: 3
has comment: http://stackoverflow.com/comment/42304626
has comment: http://stackoverflow.com/comment/42316822
has answer: http://stackoverflow.com/a/26983925
has comment: http://stackoverflow.com/comment/42534567
upvote count: 3
has comment: http://stackoverflow.com/comment/42501796
answer count: 1
has body: According to the JodaTime Javadoc, plusHours and plusDays both handle DST adjustments when adding time to a date. However, from my tests adding a days worth of hours vs adding 1 day gives a different result. Can someone explain to me why the following code gives the output below? Code: SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); Date date = format.parse("2014-11-01T02:00:00.000-0700"); System.out.println("origDate: " + date); System.out.println("plusDays: " + new DateTime(date).plusDays(1).toDate()); System.out.println("plusHours: " + new DateTime(date).plusHours(24).toDate()); Output: origDate: Sat Nov 01 02:00:00 PDT 2014 plusDays: Sun Nov 02 02:00:00 PST 2014 plusHours: Sun Nov 02 01:00:00 PST 2014
tagged with: java
accepted answer: http://stackoverflow.com/a/26983925
tagged with: jodatime

jboss-arquillian
tags question: http://stackoverflow.com/q/26941725
tag name: jboss-arquillian
tags question: http://stackoverflow.com/q/26970904
type: Tag
tags question: http://stackoverflow.com/q/26855306
tags question: http://stackoverflow.com/q/26888914

http://stackoverflow.com/comment/82098791
score: 1
has text: Why this answer was not marked as correct is beyond me. Great explanation, thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/39368250
type: Comment

http://stackoverflow.com/a/26980139
answers question: http://stackoverflow.com/q/26979949
has body: ImageIcon will load in the background as a feature. You can also accomplish this fairly easily with a background thread e.g.: final String path = "/example.png"; new SwingWorker&lt;BufferedImage, Void&gt;() { @Override public BufferedImage doInBackground() throws IOException { return ImageIO.read(ClassName.class.getResource(path)); } @Override public void done() { try { BufferedImage img = get(); // put img somewhere } catch(InterruptedException ignored) { } catch(ExecutionException ex) { ex.printStackTrace(System.err); } } }.execute(); Also, window.repaint(); graphics.drawImage(bgImage2, 0, 0, null); This worries me a little bit. In general we do not need to ask for a repaint of an entire top-level container. You should also not be using getGraphics() to paint. Non-top-level Swing components are double-buffered but if you are painting outside of the paint structure you do not get this. It will result in flickering. Two good sources for correct custom painting are: Lesson: Performing Custom Painting Painting in AWT and Swing Painting should be done passively by overriding paintComponent on a JComponent. A JLabel can also display an ImageIcon as a feature so you do not necessarily have to do custom painting if you just want to display an image.
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42494523
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26979949
has comment: http://stackoverflow.com/comment/42494845

http://stackoverflow.com/comment/42314354
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26873302
type: QuestionComment
has text: Now **that's** a proper MCVE. Thanks and 1+.

http://stackoverflow.com/a/26876978
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26876918
has body: It is working fine; but it is not the expression you want. Suppose the card is in the player's hand; presumably it is NOT also in the dealer's hand. And visa-versa. That is: every card is not in some hand. From your comment, it sounds like you want a and (&amp;&amp;): the card should be in neither the player's nor the dealer's hand.

http://stackoverflow.com/a/26920798
upvote count: 1
has comment: http://stackoverflow.com/comment/42409326
downvote count: 0
type: Answer
has body: I assume you are wanting to use the JSlider as a progress bar and that at the moment you are setting the max value, the current position is at the end of the audioClip. (Are you dealing with Clip or AudioClip? AudioClip doesn't have a way to read its position AFAIK.) If you are using Clip, it would be safer to set the max with audioClip.getMicrosecondLength(). Since the audio has to play on a different thread than the one where the JSlider is being updated, I'd recommend making your audioClip a volatile variable. That might help with cross-thread weirdness that sometimes occurs. Thread.sleep(1) at best can only update every millisecond. On some systems (older Windows) the method's reliance on the system clock means the actual updates are as slow as 16 millis apart. But updating the JSlider at more than 60 fps is probably moot. Screen monitors often are set to 60Hz, and there's only so much the human eye can take in. Also there is only so much the ear can discern in terms of timing. For example, it is hard to tell if two percussive events happen at the same time if there is less than a couple milliseconds difference.
has comment: http://stackoverflow.com/comment/42421767
answers question: http://stackoverflow.com/q/26905208
score: 1

http://stackoverflow.com/comment/42307631
score: 0
comment on: http://stackoverflow.com/q/26874831
type: Comment
type: QuestionComment
has text: `int[] num` instead of `int num[]`

http://stackoverflow.com/comment/42405691
type: QuestionComment
comment on: http://stackoverflow.com/q/26929810
has text: If I don't get the URL of that file, it doesn't work (dunno why).
score: 0
type: Comment

http://stackoverflow.com/comment/42382469
comment on: http://stackoverflow.com/q/26913518
has text: I wish I had time to deploy it to another platform but unfortunately I do not. So when you specify a profile to open in your Firefox driver, it opens that exact profile and not an imitation of sorts? Might help if we could verify that this is expected behavior.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/68236375
score: 1
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26891747
has body: This should solve the problem. public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() { } TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } static TreeNode arrayToTree(Integer array[]) { return arrayToTree(array, 0); } static TreeNode arrayToTree(Integer array[], int index) { if (index &gt;= array.length) return null; if (array[index] == null) return null; return new TreeNode(array[index], arrayToTree(array, index * 2 + 1), arrayToTree(array, index * 2 + 2)); }

http://stackoverflow.com/q/26913341
has comment: http://stackoverflow.com/comment/42388442
has comment: http://stackoverflow.com/comment/42383069
tagged with: inner-classes
has comment: http://stackoverflow.com/comment/42585293
answer count: 2
has title: Java 8 Double curly bracket initialization and name collision
accepted answer: http://stackoverflow.com/a/26916271
has comment: http://stackoverflow.com/comment/42376342
has comment: http://stackoverflow.com/comment/42422067
tagged with: java-8
downvote count: 1
has comment: http://stackoverflow.com/comment/42385756
has comment: http://stackoverflow.com/comment/42388110
has comment: http://stackoverflow.com/comment/42380469
has comment: http://stackoverflow.com/comment/42376884
tagged with: java
has comment: http://stackoverflow.com/comment/42606128
has body: The following class has an inner class called Entry. This code will not compile in Java 8 as the compiler assumes the Entry referenced within the double curly brace initializer is of type Map.Entry and not Scope.Entry. This code compiles in previous versions (at least 6 and 7) of the JDK but is broken in JDK 8. My question is "why?" Map.Entry is not imported in this class, so there is no reason for the compiler to assume that the value is of type Map.Entry. Is there some implicit scope being brought in or something for anonymous classes? Error: scope/Scope.java:23: error: incompatible types: scope.Scope.Entry cannot be converted to java.util.Map.Entry for (final Entry entry : entries) { scope/Scope.java:22: error: cannot find symbol put(entry.getName(), entry); Example Code: package scope; import java.util.HashMap; import java.util.HashSet; import java.util.Set; public class Scope { public static class Entry&lt;T&gt; { public String getName() { return "Scope"; } } public static void main(String[] args) { final Set&lt;Entry&gt; entries = new HashSet&lt;&gt;(); new HashMap&lt;String, Entry&gt;() {{ // Why does the Java 8 compiler assume this is a Map.Entry // as it is not imported? for (final Entry entry : entries) { put(entry.getName(), entry); } }}; } }
has comment: http://stackoverflow.com/comment/42382448
has answer: http://stackoverflow.com/a/26919894
has comment: http://stackoverflow.com/comment/42401189
has comment: http://stackoverflow.com/comment/42378806
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42384183
upvote count: 20
has comment: http://stackoverflow.com/comment/42376586
has comment: http://stackoverflow.com/comment/42383685
has comment: http://stackoverflow.com/comment/91672611
has comment: http://stackoverflow.com/comment/42401177
tagged with: shadowing
has comment: http://stackoverflow.com/comment/42376244
has answer: http://stackoverflow.com/a/26916271
has comment: http://stackoverflow.com/comment/42583643
linked to: http://stackoverflow.com/q/924285
favorite count: 0
possible better answer: http://stackoverflow.com/a/26919894
score: 19
type: Question
has comment: http://stackoverflow.com/comment/42381008

http://stackoverflow.com/a/26849564
upvote count: 2
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/42261725
downvote count: 1
answers question: http://stackoverflow.com/q/26848762
has body: If you don't want to use ArrayList, arraycopy is an alternative: System.arraycopy(words, 0, result, 0, i); System.arraycopy(words, i+1, result, i, result.length-i); where i is your index to delete. Hope I can help. EDIT: Of course you should initially define the correct array lengths: char[] result = new char[words.length-1];

http://stackoverflow.com/comment/42247469
comment on: http://stackoverflow.com/q/26839410
score: 0
has text: No, I didn't. Now I tried to do so, but still the same error.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26905367
has comment: http://stackoverflow.com/comment/42362750
accepted answer of: http://stackoverflow.com/q/26905138
has comment: http://stackoverflow.com/comment/42362671
has comment: http://stackoverflow.com/comment/42362229
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26905138
has comment: http://stackoverflow.com/comment/42362363
type: Answer
has comment: http://stackoverflow.com/comment/42362785
downvote count: 0
score: 1
has body: when user login finish login activity and start home activity. when user logout finish home activity and start login activity
has comment: http://stackoverflow.com/comment/42362829
has comment: http://stackoverflow.com/comment/42362587

http://stackoverflow.com/q/26976337
has answer: http://stackoverflow.com/a/26983412
type: Question
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/42489124
tagged with: visual-c++
score: 0
answer count: 2
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: fread
linked to: http://stackoverflow.com/q/13553349
has comment: http://stackoverflow.com/comment/42487678
accepted answer: http://stackoverflow.com/a/26983412
has comment: http://stackoverflow.com/comment/42488108
possible better answer: http://stackoverflow.com/a/26976586
has answer: http://stackoverflow.com/a/26976586
has body: So my problem is: I need to get some primitive values(floats) from a file I used and parsed in Java to my C code(testing between Java and C implementation). So in Java I used ByteBuffer.allocate() to get bytes and Files.write() to write them in the file. File looks OK, I checked him with Hex Editor(real values, not just zero's). Now in C, for reading the data I used: float * floatArray = malloc(numData * sizeof(float)); //numData is int, 1000 for example FILE * stream = fopen(input, "rb"); //input is the name of my binary file rewind(stream); fread(floatArray, numData, sizeof(float), stream); fclose(stream); and for test: for(i = 0; i &lt; 128; i++) { printf("%f, ", floatArray[i]); } but only thing I see is 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, 0.00000000, + next 114 zeros For more details: Input file has like 158 MB. It actually has lot of zeros in it, but for example, first 3 numbers should be 9, 52 and 29. Another thing is that I already checked the return value of fread and it returns the right value (numData). I checked other questions on the site but I didn't really found my problem. Other ones had problems like they set file indicator with fseek at the end of the file when they got all the zero's. I guess it can't be endianess problem too because I think I would get bad values and not zero's only. I use Visual C++ 2008 Express edition on Windows 7. Sorry for my formatting and english, it's my first question. I'll be thankfull for any kind of help.
has title: fread() read zero values
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/26856882
type: AcceptedAnswer
type: Answer
score: 3
downvote count: 0
has body: These are the lines causing your problem: // Reassign people person1 = person2; person2 = person3; person3 = person1; If the variables had the following starting values: person1 = "A"; person2 = "B"; person3 = "C"; ... and then you ran it through your code: person1 = person2 -&gt; person1 is now set to "B" (the value "A" is discarded) person2 = person3 -&gt; person2 is now set to "C" person3 = person1 -&gt; person3 is now set to the value of person1 which is "B" So now variable person1 and person3 are set to the same object.
accepted answer of: http://stackoverflow.com/q/26856748
answers question: http://stackoverflow.com/q/26856748
upvote count: 3

http://stackoverflow.com/q/26869742
answer count: 3
has comment: http://stackoverflow.com/comment/42376691
possible better answer: http://stackoverflow.com/a/26913223
has title: GXT : Cancel click event on grid header
has answer: http://stackoverflow.com/a/26869944
has answer: http://stackoverflow.com/a/26926124
tagged with: gwt
type: AnsweredQuestion
tagged with: java
tagged with: gxt
type: Question
accepted answer: http://stackoverflow.com/a/26926124
has comment: http://stackoverflow.com/comment/42378411
has answer: http://stackoverflow.com/a/26913223
has comment: http://stackoverflow.com/comment/42379609
has body: I have a grid like this one . The default behavior of this widget is to sort the column when clicking on the header. I want to disable that, and leave only the options in the context menu. grid.addHeaderClickHandler(new HeaderClickHandler() { @Override public void onHeaderClick(HeaderClickEvent event) { event.getEvent().cancelBubble(true); event.getEvent().preventDefault(); event.getEvent().stopPropagation(); Window.alert("Event caught"); } }); The alert gets displayed before the sorting. But when clicking Ok the default behavior kicks in. Do you have any suggestions on how to accomplish this?
score: 0

jar
tags question: http://stackoverflow.com/q/26841493
tags question: http://stackoverflow.com/q/26937242
tags question: http://stackoverflow.com/q/26885900
tags question: http://stackoverflow.com/q/26935050
tags question: http://stackoverflow.com/q/26839129
tags question: http://stackoverflow.com/q/26906887
tags question: http://stackoverflow.com/q/26949419
tags question: http://stackoverflow.com/q/26895114
type: Tag
tags question: http://stackoverflow.com/q/26933499
tags question: http://stackoverflow.com/q/26953260
tags question: http://stackoverflow.com/q/26983709
tags question: http://stackoverflow.com/q/26846978
tag name: jar
tags question: http://stackoverflow.com/q/26949333
tags question: http://stackoverflow.com/q/26915518
tags question: http://stackoverflow.com/q/26944851
tags question: http://stackoverflow.com/q/26927573
tags question: http://stackoverflow.com/q/26958954
tags question: http://stackoverflow.com/q/26939628
tags question: http://stackoverflow.com/q/26962455
tags question: http://stackoverflow.com/q/26854557
tags question: http://stackoverflow.com/q/26991843
tags question: http://stackoverflow.com/q/26858843
tags question: http://stackoverflow.com/q/26977653
tags question: http://stackoverflow.com/q/26868966
tags question: http://stackoverflow.com/q/26923775
tags question: http://stackoverflow.com/q/26918008
tags question: http://stackoverflow.com/q/26919437

http://stackoverflow.com/q/26956258
tagged with: java
tagged with: html-parsing
has answer: http://stackoverflow.com/a/26956350
type: Question
tagged with: jsoup
score: 5
upvote count: 5
has body: I'm using jsoup to clean a html page, the problem is that when I save the html locally, the images do not show because they are all relative links. Here's some example code: import org.jsoup.Jsoup; import org.jsoup.nodes.Document; public class so2 { public static void main(String[] args) { String html = " The Title " + " "; Document doc = Jsoup.parse(html,"https://whatever.com"); // baseUri seems to be ignored?? System.out.println(doc); } } Output: The Title The output still shows the links as a href="/data/abstract/ash/2014/5/9/Paper_69295_abstract_120490_0.gif". I would like it to convert them to a href="http://whatever.com/data/abstract/ash/2014/5/9/Paper_69295_abstract_120490_0.gif" Can anyone show me how to get jsoup to convert all the links to absolute links?
accepted answer: http://stackoverflow.com/a/26956350
tagged with: http://stackoverflow.com/tag/html
downvote count: 0
answer count: 1
has title: Convert relative to absolute links using jsoup
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/a/26982449
score: 0
type: Answer
has body: I figured it out. I was recycling an old Tomcat 5 server.xml because I wanted to make sure it would work with my old tomcat config. Turns out it was causing this strange issue. Apologies.
answers question: http://stackoverflow.com/q/26979083
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26979083

http://stackoverflow.com/comment/42419304
comment on: http://stackoverflow.com/q/26936346
score: 0
has text: OK, is this timeout in the link you provided technically the same as WSS TimeToLive request property in SOAP UI?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42455415
has text: Is it a good idea to print `"null"` if `x` is smaller than `2.5`?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26958255
type: AnswerComment

http://stackoverflow.com/comment/42370731
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26910543
has text: why not `date1.equals(date2))`?

http://stackoverflow.com/a/26912116
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26911928
answers question: http://stackoverflow.com/q/26911928
type: AcceptedAnswer
downvote count: 0
has body: You can use a regexp to do that : content = content.replaceAll("(&lt;td id=\"sub_referat1\"&gt;).*?(&lt;/td&gt;)", "$1Max Mustermann$2"); $1 is the content of the first capture group, $2 is the content of the second capture group. .*? matches anything, but not greedy (to stop at the first &lt;/td&gt;).
type: Answer

http://stackoverflow.com/q/26917629
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/26917708
downvote count: 2
score: -2
has comment: http://stackoverflow.com/comment/42383805
accepted answer: http://stackoverflow.com/a/26917708
tagged with: math
tagged with: java
has title: How could I replicate the opposite of this lerping function?
has body: In the lerping function below, it will slow down a camera which is following a moving object, and as the moving object slows down or stops the camera catches up to it. I need the opposite. I need the camera to move ahead of the moving object and slow down back to the object when the object slows/stops. I can't seem to make it work. Any ideas? //this is the opposite of what I want. float lerp = 0.1f; Vector3 position = this.getCamera().position; position.x += (Obj.x - position.x) * lerp; position.y += (Obj.y - position.y) * lerp;
answer count: 1

http://stackoverflow.com/q/26986718
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42514228
has comment: http://stackoverflow.com/comment/42507150
tagged with: jax-rs
tagged with: rest
has body: I have a problem when i want to expose my EJB Project as JAX-RS service. I've tried to find a solution many times but i've not fixed it. I've succeeded deploy my application but i didn't found my rest service in localhost:4848 => Applications => My_Application. Normally, if a rest service is deployed, there is "Launch" button. I use glassfish4 and eclipse Java EE. My EJB Project is like that: Package ejb: TestSessionBean.java Package rest: RestTest.java and RestTestApp.java TestSessionBean.java @Path("/peter") @Stateless @LocalBean public class TestSessionBean { public TestSessionBean() { // TODO Auto-generated constructor stub } @GET public String sayHello() { return "Hello"; } } RestTest.java @Path("/ep") public class RestTest { @GET public String sayBonjour() { return "Bonjour"; } } RestTestApp.java @ApplicationPath("/test/*") public class RestTestApp extends Application { } I also tried to config my project: Properties => Project Facets => enable JAX-RS (but when i clicked on "Further configuration available", i had "Type: Disable Library Configuration". I tried localhost:8080/ejbtest/test/peter/ and localhost:8080/ejbtest/test/ep but both didn't work. But if i create a new Dynamic Web Project all and copy all of my source files in ejbtest into this project. It works! So i think about something to do in eclipse configuration of ejb project. Any solution? Thank you in advanced.
has comment: http://stackoverflow.com/comment/42515571
has comment: http://stackoverflow.com/comment/42515740
has title: Expose EJB as JAX-RS service
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42506916
tagged with: web-services
has comment: http://stackoverflow.com/comment/42514163
has comment: http://stackoverflow.com/comment/42514845
tagged with: ejb
tagged with: java

http://stackoverflow.com/comment/42231723
type: Comment
has text: Give a link to your screen shot **image**, and we'll be able to insert it into your question. I see that you're using GroupLayout, a layout which is was built for and is useful for computer-generated code, but is very difficult to use manually. If you're creating manual layouts, you'd usually use one of the easier to use core Java layout managers or download the MigLayout.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26832615

http://stackoverflow.com/comment/42390325
has text: You need to provide the rest of your code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26921133
score: 1

http://stackoverflow.com/comment/42282569
has text: All the requests will first go to a servlet which is part of the framework. We cannot modify this! And this servlet decides which action method is to be called!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26859738

http://stackoverflow.com/comment/42306736
type: QuestionComment
has text: thank you guys for the help, i would upvote your comments but i don't have enough reputation points.
score: 0
comment on: http://stackoverflow.com/q/26869873
type: Comment

http://stackoverflow.com/q/26852924
score: 1
tagged with: java
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/26853379
has comment: http://stackoverflow.com/comment/42268351
has title: Selenium, WebDriver for Chrome Stopping the window opening
answer count: 1
downvote count: 0
favorite count: 0
has body: When using the WebDriver driver for Chrome a chrome window opens, and navigates to the specified page. Is there a way to stop the window from opening? Edit: I am using it to scrape the web page so there is no need for me to see the actual webpage. The desired behaviour would be that the scraping would be done "Silently"?
has comment: http://stackoverflow.com/comment/42268371
accepted answer: http://stackoverflow.com/a/26853379
upvote count: 1
tagged with: selenium-webdriver
tagged with: selenium-chromedriver
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42268729
linked to: http://stackoverflow.com/q/14122185

http://stackoverflow.com/comment/42269011
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26853227
has text: You must NOT declare any variables or make any methods which are not in this class. You may use classes from the Java library but the outputs must be stored in existing variables. The only variable available to use is a parameter string called x and a double called x
score: 0

http://stackoverflow.com/comment/42276895
type: AnswerComment
type: Comment
has text: how do i include the classpath..?
comment on: http://stackoverflow.com/a/26857540
score: 2

http://stackoverflow.com/comment/42297700
type: Comment
has text: Sorry @rickyhitman10. Thanks for pointing out my error. I updated my answer to fit your needs
score: 0
comment on: http://stackoverflow.com/a/26869222
type: AnswerComment

http://stackoverflow.com/a/26923961
type: Answer
downvote count: 0
score: 1
has body: Try using under mentioned code: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView mTV = (TextView) findViewById(R.id.tv); String mString = "Me: hello.."; mTV.setText(boldText(mString,0,2)); } private Spannable boldText(String mText, int mStart, int mEnd) { Spannable WordtoSpan = new SpannableString(mText); WordtoSpan.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), mStart, mEnd, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return WordtoSpan; } }
answers question: http://stackoverflow.com/q/26923782
upvote count: 1

http://stackoverflow.com/comment/42442441
score: 0
type: Comment
type: QuestionComment
has text: The problem is that I made my scrollpane from scratch, using only JComponents/JPanels, and I want to change a scrollbar appearance if it can be scrolled (mouse is over the scrollable area).
comment on: http://stackoverflow.com/q/26950589

http://stackoverflow.com/a/26891805
has body: Here is a solution which only uses an extra local variable to reduce nesting. It will find the minimum non-zero value (if it exists) or zero in the case they are all 0. It also uses fewer comparisons. ... int min1, min2; if (a2 == 0 || (a1 &lt; a2 &amp;&amp; a1 != 0)) min1 = a1; else min1 = a2; if (a4 == 0 || (a3 &lt; a4 &amp;&amp; a3 != 0)) min2 = a3; else min2 = a4; if (min1 == 0 || (min2 &lt; min1 &amp;&amp; min2 != 0)) min1 = min2; if (min1 == 0 || (a5 &lt; min1 &amp;&amp; a5 != 0)) min1 = a5; return min1;
accepted answer of: http://stackoverflow.com/q/26891113
upvote count: 2
answers question: http://stackoverflow.com/q/26891113
type: Answer
has comment: http://stackoverflow.com/comment/42338847
score: 2
has comment: http://stackoverflow.com/comment/42339807
has comment: http://stackoverflow.com/comment/42337999
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26842842
tagged with: java
possible better answer: http://stackoverflow.com/a/26843484
has answer: http://stackoverflow.com/a/26843484
has comment: http://stackoverflow.com/comment/42250210
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42255389
type: Question
tagged with: jframe
answer count: 2
has title: Saving changes made in a JFrame
tagged with: swing
has answer: http://stackoverflow.com/a/26843657
accepted answer: http://stackoverflow.com/a/26843657
linked to: http://stackoverflow.com/q/7777640
has comment: http://stackoverflow.com/comment/42252899
has body: I have a simple JFrame where the user is changing the background color of it using a JPopupMenu. When the user exit the application, I want to save the changes made in the background. I have tried to handle this with method windowClosing() from WindowAdapter class but when when I launch the application again, I don't see the changes I made earlier. I don't know what the problem is. I will appreciate any help. Here's my code. /*i have removed unnnecessary codes*/ public class Popupframe extends JFrame{ private JRadioButtonMenuItem[] items; private final Color[] colorvalues={Color.BLUE,Color.YELLOW,Color.RED}; static Color bgcolor=Color.CYAN; JRadioButtonMenuItem[] cheek; public Popupframe() { super("using popups"); String[] colors = {"Blue","Yellow","Red"}; setBackground(bgcolor); addMouseListener(new Handler()); } private class Handler extends MouseAdapter implements ActionListener { @Override public void actionPerformed(ActionEvent event) { for(int i=0; i&lt;items.length; i++) { if(event.getSource()==items[i]) { getContentPane().setBackground(colorvalues[i]); bgcolor=colorvalues[i]; } } } } public static void main(String[] args) { Popupframe frame=new Popupframe(); frame.setSize(width,height); frame.setDefaultCloseOperation(Popupframe.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { int ok=JOptionPane.showConfirmDialog(frame,"are sure?","close",JOptionPane.WARNING_MESSAGE); if(ok==JOptionPane.OK_OPTION) { bgcolor=frame.getContentPane().getBackground(); System.out.println(bgcolor); System.exit(0); } } }); frame.setVisible(true); }
score: 0

http://stackoverflow.com/comment/42249844
comment on: http://stackoverflow.com/q/26842986
score: 0
type: Comment
has text: Is `entity` class or Object?
type: QuestionComment

http://stackoverflow.com/comment/42321903
type: Comment
has text: Yes it was helpful! I thought that attribute class only means the type of the separator between two lines...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26877635

http://stackoverflow.com/comment/42401018
has text: I don't think it can be done in one line, kind of matching the value of accountType to a variable name or something like this. Using a map is the closest you can get: one line to retrieve it (if you do not do any error checking), and one line for each view to register.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26927416
type: Comment

http://stackoverflow.com/comment/43109487
comment on: http://stackoverflow.com/a/27324435
has text: This parameter is set to true when the tweets are retrieved from the API, and setJSONStoreEnabled is set to true. The former condition does not apply to my question.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42528412
score: 0
comment on: http://stackoverflow.com/q/26989004
type: Comment
type: QuestionComment
has text: The problem is that the mapper is configured to exclude ALL fields but the marked ones (`@JsonProperty`). This setting can't be changed. The fields exposed by the `Link` class are not marked, and are therefore not serialized as json. The resulting JSON only contains `"links":[{},{},...]`

http://stackoverflow.com/a/26869461
has comment: http://stackoverflow.com/comment/42297908
answers question: http://stackoverflow.com/q/26869077
type: Answer
score: 0
has body: I think the solution is to loop as long as the number has not been found. boolean foundFive = false; Scanner sc = new Scanner (new File("c:/Users/ASUS/Desktop/Numbers.txt")); while (sc.hasNextInt() &amp;&amp; !foundFive) { int number = sc.nextInt(); System.out.print(number+ " "); if (number == 5) { foundFive = true; } } sc.close();

http://stackoverflow.com/comment/42264751
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26850885
has text: @thank you so much for your help. it compiles now. somehow my loop keep running on "please enter 1 to keep playing or 2 to exit:". I will try to modify my loop body and see how it goes

http://stackoverflow.com/q/26893045
type: Question
has comment: http://stackoverflow.com/comment/42339823
has comment: http://stackoverflow.com/comment/42339821
tagged with: java
has comment: http://stackoverflow.com/comment/42340203
has comment: http://stackoverflow.com/comment/42343035
score: 0
answer count: 2
has body: i want try get my system print out all on one line, example "jack of hearts" "2 of clubs " "ace of hearts" i can get it to print out "jack of hearts " some pointers would be a huge help, have only a few weeks experience with java, im using bluj to run and test public class Cards { public static final int CARDS_IN_DECK = 52; public static final int SPADES = 0; public static final int HEARTS = 1; public static final int DIAMONDS = 2; public static final int CLUBS = 3; public static int deck[]; public static int deckSuit[]; public static void main () { { int i; // counter int j; String value; createDeck(); // this is a function call // Show the cards in the deck System.out.println("Your hand is as follows:"); for (i=0 ; i &lt; 5; i++) // this is the loop for 5 card draw { if (deck[i]&lt;=10 &amp;&amp; deck[i]&gt;1) // this is inbetween this range of numbers System.out.println(deck[i] + " of " + deckSuit[i]); if(deck[i]==11) System.out.println("jack" + " of " + deckSuit[i]); else if(deck[i]==12) System.out.println("queen" + " of " + deckSuit[i]); else if(deck[i]==13) System.out.println("king" + " of " + deckSuit[i]); else if(deck[i]==14) System.out.println("ace" + " of " + deckSuit[i]); if(deckSuit[i] == 0) System.out.println(" of " + "SPADES"); // i want to try and get a print out "jack of spades else if (deckSuit[i] == 1) System.out.println(" of " + "HEARTS"); else if (deckSuit[i] == 2) System.out.println(" of " + "DIAMONDS"); else if (deckSuit[i] == 3) System.out.println(" of " + "CLUBS"); } } } // create the deck // // deck[] contains the values of 52 cards // values 2 to 14 // 2 - 10 are normal , 11 = Jack, 12 = Queen // 13 = King, 14 = Ace // // suit[] contains the values of the suits of the 52 cards // 0 Spades, 1 Hearts, 2 Diamonds, 3 Clubs // // so if deck[2] = 11 and suit[2] = 1 // then that card would be the Jack of Hearts // public static void createDeck() { int i,j, place; // // // create a deck of cards deck = new int[CARDS_IN_DECK]; deckSuit = new int[CAR…
favorite count: 0
has answer: http://stackoverflow.com/a/26893822
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26893096
has title: Printing my Program Output to a Single Line instead of on Multiple Lines
upvote count: 1
has comment: http://stackoverflow.com/comment/42340041
downvote count: 1

http://stackoverflow.com/comment/42444657
has text: Unfortunately this probably can't be done unless the size of the universe (maximum int size) is considered constant. If it is, you can use the solution given here: http://stackoverflow.com/questions/11781720/most-common-element-in-an-array-finding-the-relative-majority-deterministical#
score: 0
comment on: http://stackoverflow.com/q/26950004
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42429436
score: 0
type: AnswerComment
type: Comment
has text: It's more that I need to do something like this: `httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs));`
comment on: http://stackoverflow.com/a/26942356

http://stackoverflow.com/a/26960268
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26884169
accepted answer of: http://stackoverflow.com/q/26884169
type: Answer
has comment: http://stackoverflow.com/comment/42565154
has comment: http://stackoverflow.com/comment/42554138
has body: Application exceptions are intended to provide convey additional information to the caller. In this case, the caller of an @Timeout method is the EJB container, which cannot know the intent of your application exception, so they are not allowed. If you need to signal failure to the container so that it will retry, I recommend catching the AccesNomenclatureException and rethrowing it as EJBException, which is a system exception rather than an application exception. Otherwise, if you just want to ignore the failure, then catch it and log it rather than rethrowing it.

http://stackoverflow.com/q/26980305
has answer: http://stackoverflow.com/a/26981111
has answer: http://stackoverflow.com/a/26980635
has title: How do I use Iterator from within a function?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42496617
type: Question
has answer: http://stackoverflow.com/a/26981554
score: 0
tagged with: iterator
tagged with: printing
tagged with: iterable
answer count: 3
has body: I'm trying to get my mind around the Iterator functionality in Java through some examples, and I can't figure out how to access the iterator so that I can start printing out the collection. So I have this function: class A &lt;Item&gt; implements Iterable &lt;Item&gt; { //....does stuff } public Iterator &lt;Item&gt; iterator() { return new Itor(); } class Itor implements Iterator &lt;Item&gt; { //.....custom Iterator functions within } Basically, class A is a data structure that holds a list of values, and I want to print these values out using iterator from within another class. How would I implement that? I'm not sure on how the syntax would look like. Let's say I have another class class B { private class Node { A&lt;Integer&gt; n; // I have another class that inserts values into the A class // and I want to be able to print n out. } private void printA() { Iterator it = A.iterator(); //I get the non-static method error here. } }
possible better answer: http://stackoverflow.com/a/26980635
accepted answer: http://stackoverflow.com/a/26981554

http://stackoverflow.com/comment/42314642
type: Comment
has text: `main()`, you mean? Case matters.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26878866

http://stackoverflow.com/q/26982068
tagged with: void
has answer: http://stackoverflow.com/a/26982440
downvote count: 2
tagged with: methods
has body: I need to display the following information Enter size of array: 3 Enter student name: jane doe Enter student id number: 14234567 Enter student name: john doe Enter student id number: 12345678 Enter student name: peter griffin Enter student id number: 14238251 Array Contents jane doe 14234567 john doe 12345678 peter griffin 14238251 i have to use the following methods To ask the user for the size they wish the array to be and then create an array of type Student of the specified size. public static Student[] createArray() To populate the array by asking the user to input a name and ID number for each object stored within the array public static void populateArray(Student[] array) To displays the contents of the array public static void displayArray(Student[] array) This is what I have so far class Student { //private instances private String name = "unassigned"; private long idNumber = 0; //Default constructor public Student() { name = "Not Given"; idNumber = 0; } //Constructs a new Student with passed name and age parameters. public Student(String studentName, long studentIdNumber) { name = studentName; idNumber = studentIdNumber; } //Returns the name of this student. public String getName( ) { return name; } // Returns the idNumber of this person. public long getIdNumber( ) { return idNumber; } //Sets the name of this student. public void setName(String studentName ) { name = studentName; } //Sets the idNumber of this student. public void setIdNumber(long studentIdNumber ) { idNumber = studentIdNumber; } } // end class and import java.util.Scanner; public class StudentTest { static int array; //create method createArray public static Student[] createArray() { Scanner int_input = new Scanner(System.in); //user enters size of array System.out.print("Enter Size of Array: "); array = int_input.nextInt(); //create array Student[] array = new Student[0]; return array;//return array }//end method //create method populateArray public static void populateArray(Student[] ar…
type: Question
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26982440
upvote count: 0
tagged with: arrays
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42498387
has comment: http://stackoverflow.com/comment/42498390
has title: How to use void methods
score: -2

http://stackoverflow.com/q/26895114
answer count: 1
tagged with: jar
accepted answer: http://stackoverflow.com/a/26895386
has title: Gradle jar generation
linked to: http://stackoverflow.com/q/25535885
tagged with: build.gradle
has comment: http://stackoverflow.com/comment/42343956
type: AnsweredQuestion
tagged with: java
tagged with: gradle
has answer: http://stackoverflow.com/a/26895386
type: Question
has body: When war plug-in is enabled in build.gradle, jar generation is automatically disabled. Is it possible to fix it or does it require splitting the project into two projects?
score: 0

http://stackoverflow.com/comment/42399490
type: Comment
comment on: http://stackoverflow.com/a/26926255
has text: ok, thanks, sure it's not real life example, c# programmers asked about this feature in java, because in c# it wiil be called child method anyway
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42375905
score: 0
comment on: http://stackoverflow.com/q/26913148
type: QuestionComment
type: Comment
has text: Why are you converting the arraylist to an array when you can just use the list directly?

http://stackoverflow.com/comment/42593388
has text: I have the kystore with the private key in it :getlinked, Nov 14, 2014, PrivateKeyEntry, Certificate fingerprint (SHA1): 2C:82:F7:E8:09:C2:7D:7C:71:9E:86:C0:EC:85:22:AE: 20:7D:43:14, I generated CSR, I got the trial certificates, and imported them to the keystore, it was successful, no problem whatsoever,when I restart the server, the browser shows it as untrusted, certificate path has only mydomain in it with keystore validity -validity 30, and I really dont know why?
score: 0
comment on: http://stackoverflow.com/a/26913911
type: AnswerComment
type: Comment

http://stackoverflow.com/a/31660763
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/51312233
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26872164
has body: I just faced the same problem but the type was 6. The issue was caused by not closing (invoking .close()) the prepared statements and the result sets that hold the query results. Instantiating new prepared statements and result sets is not enough, you must close them always. Lesson learned.

http://stackoverflow.com/comment/42280526
score: 0
type: AnswerComment
has text: I've looked this up in the java doc. This tells me only that ?: starts a non-capturing group. But does not really define what a non-capturing group does. Could you explain it?
type: Comment
comment on: http://stackoverflow.com/a/26859854

http://stackoverflow.com/q/26899114
favorite count: 0
has comment: http://stackoverflow.com/comment/42351461
upvote count: 0
type: AnsweredQuestion
tagged with: java
score: -1
type: Question
has body: Note: The below referenced Provider is the root of an extension so to speak. They provide various things and as such when they are unloaded/removed so should all of their functionality/objects that is has provided. So what I want is to allow for Provider to be in a way weakly reachable. I don't want the GC to simply collect it when I'm low on memory or just because it's not used a lot. What I'm looking for is that when said Provider is unloaded, that all of it's counter-parts are then perhaps weakly reachable etc. The reasoning behind this is say a Provider has provided a particular handler, well if the provider is gone, that means the handler should no longer be needed and should be dropped. What I'm asking in a nut shell is: What is the best way for objects that have been provided by another object to be "dropped" (set to be removed/weakly reachable/GC'd)? I have read up on strong, soft, weak, and phantom references. Soft/weak references are looking nice, although I'm not quite sure if they are really what I'm looking for (see above- I don't want the provider to be GC'd at will, but instead have what it has been provided be GC'd etc when the provider is no longer around). Events are an option, although I was interested in knowing if I could do it on a different level so that developers couldn't (easily) jump into the event and prevent the GC'ing of particular objects (which would prevent other objects from getting GC'd). Thanks for any and all help/insight!
has comment: http://stackoverflow.com/comment/42352159
has comment: http://stackoverflow.com/comment/42351144
has comment: http://stackoverflow.com/comment/42351219
has title: Is the usage of WeakRefence here practical?
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26899758
has comment: http://stackoverflow.com/comment/42352189
accepted answer: http://stackoverflow.com/a/26899758

http://stackoverflow.com/comment/42427205
type: QuestionComment
has text: Nope.. what i want to do is update user's info when he logs in and update again when he logs out. but how do it get the user id when he logs in and logs out in listeners? I dont mind using any listener plain sessionlistener or spring's event listener
comment on: http://stackoverflow.com/q/26941676
score: 0
type: Comment

http://stackoverflow.com/q/26988607
has comment: http://stackoverflow.com/comment/42509327
type: Question
has title: error in spring hibernate integration
has comment: http://stackoverflow.com/comment/42509333
has body: everytime when i am running my spring with hibernate socket program it saves for the first time but i am sending infinitely from the client side but in server end only first time it is saving..What type of problem i am facing?? how to resolve package utilclass; import org.hibernate.*; import org.springframework.orm.hibernate3.HibernateTemplate; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; public class HibernateUtemplate { private static HibernateTemplate template; public void setTemplate(HibernateTemplate template){ HibernateUtemplate.template=template; } public static SessionFactory getSessionFactory(){ return template.getSessionFactory(); } public static Session getSession(){ getSessionFactory().getCurrentSession().beginTransaction(); return getSessionFactory().getCurrentSession(); } public static void commitTransaction() { getSession().getTransaction().commit(); } public static void rollbackTransaction() { getSession().getTransaction().rollback(); } public static void closeSession() { getSession().close(); } } this is my generic file package daoimplclasses; import java.io.Serializable; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import org.springframework.orm.hibernate3.HibernateTemplate; import utilclass.HibernateUtemplate; import daointerfaces.GenericDao; public abstract class GenericDaoimpl&lt;T, ID extends Serializable&gt; implements GenericDao&lt;T, ID&gt; { //HibernateTemplate template; protected Session getSession() { return HibernateUtemplate.getSession(); } public void save(T entity) { //template.saveOrUpdate(entity); HibernateUtemplate.getSession().saveOrUpdate(entity); // HibernateUtemplate.beginTransaction().saveOrUpdate(entity); } public void merge(T entity) { // template.merge(entity); HibernateUtemplate.getSession().merge(entity); // HibernateUtemplate.beginTransaction().merge(entity); } public void update(T entity) { // template.update(entity); HibernateUtemplate.getSession().update(en…
has comment: http://stackoverflow.com/comment/42509489
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42509503
tagged with: sockets
tagged with: swing
answer count: 0
score: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/42455090
comment on: http://stackoverflow.com/a/26957941
score: 0
type: AnswerComment
type: Comment
has text: Apologies i missed it! Edited the answer and thanks for bringing it to my attention.

http://stackoverflow.com/a/26981032
has comment: http://stackoverflow.com/comment/47887857
has comment: http://stackoverflow.com/comment/47892067
score: 2
has comment: http://stackoverflow.com/comment/42500200
downvote count: 0
has comment: http://stackoverflow.com/comment/47890223
has comment: http://stackoverflow.com/comment/47891984
has body: You have some styles defined in your json file, but you don't have a default style defined. Also you posted the styles for the ProgressBar, not the Window. When you define styles you need to always define a style with the name default. This style will be chosen in the case you didn't pass a style name parameter while creating your windows. To fix your json, you could add a style with name default or just rename one of your existing ones to default. See the json uiskin example: com.badlogic.gdx.scenes.scene2d.ui.Window$WindowStyle: { default: { titleFont: default-font, background: default-window, titleFontColor: white }, dialog: { titleFont: default-font, background: default-window, titleFontColor: white, stageBackground: dialogDim } }, For more details check out the libgdx skins wiki
type: Answer
answers question: http://stackoverflow.com/q/26977968
upvote count: 2
has comment: http://stackoverflow.com/comment/42498749

http://stackoverflow.com/q/26866464
type: Question
has body: I'm not sure how to correct this in order to make it work, /** Should remove the Account with the account number specified as a parameter if it the Account exists. The appropriate boolean value should then be returned via a method result dialog box. */ public boolean removeAccount(String accountNumber) { int index = 0; for(Account account : accounts) { if((account.getAccountNumber() == accountNumber) &amp;&amp; index &lt; accounts.size()) accounts.remove(account); else index++; } } tried with an iterator public boolean removeAccount(String accountNumber) { Iterator&lt;Account&gt; i = accounts.iterator(); while (i.hasNext()) { Account s = i.next(); // must be called before you can call i.remove() if(s.getAccountNumber().equals(accountNumber)) return i.remove(); } return false; } and I get "incompatible type: void cannot be converted to boolean"
tagged with: arraylist
score: 0
has answer: http://stackoverflow.com/a/26866575
answer count: 4
duplicate of: http://stackoverflow.com/q/42369301
has answer: http://stackoverflow.com/a/26869251
has comment: http://stackoverflow.com/comment/42292208
has title: How to remove an account from an arraylist with the account number specified as a parameter
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26866535
tagged with: java
has answer: http://stackoverflow.com/a/26866506
linked to: http://stackoverflow.com/q/42369301

http://stackoverflow.com/a/26924305
downvote count: 0
answers question: http://stackoverflow.com/q/26923716
score: 1
accepted answer of: http://stackoverflow.com/q/26923716
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: Your Program seems to be OK. I copied your code and run it on my machine. It gives correct output i.e., 0 5 If you are using eclipse create a new configuration and also change your input directory. Then it might work.

facebook
tags question: http://stackoverflow.com/q/26973509
type: Tag
tags question: http://stackoverflow.com/q/26972729
tags question: http://stackoverflow.com/q/26852071
tags question: http://stackoverflow.com/q/26861715
tags question: http://stackoverflow.com/q/26987165
tag name: facebook
tags question: http://stackoverflow.com/q/26967739
tags question: http://stackoverflow.com/q/26843167
tags question: http://stackoverflow.com/q/26969438
tags question: http://stackoverflow.com/q/26882666

http://stackoverflow.com/q/26932336
has body: I can implicitly conver int to long and long to Long. Why is it not possible to implicitly convert int to Long? Why can't Java do the implicit conversion on the last line of the example? int i = 10; //OK long primitiveLong = i; //OK Long boxedLong = primitiveLong; //OK boxedLong = i; //Type mismatch: cannot convert from int to Long
favorite count: 0
has comment: http://stackoverflow.com/comment/42409780
answer count: 3
has comment: http://stackoverflow.com/comment/42409571
accepted answer: http://stackoverflow.com/a/26932393
upvote count: 11
has answer: http://stackoverflow.com/a/26932427
possible better answer: http://stackoverflow.com/a/26932422
has answer: http://stackoverflow.com/a/26932422
downvote count: 1
has title: Why is implicit conversion from int to Long not possible?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21034955
tagged with: java
score: 10
has answer: http://stackoverflow.com/a/26932393
type: Question

http://stackoverflow.com/q/26948013
tagged with: timer
has answer: http://stackoverflow.com/a/26948191
tagged with: swing
accepted answer: http://stackoverflow.com/a/26948191
type: AnsweredQuestion
tagged with: java
has body: in my code having capture button it individually capturing image once but now i want set timer to capturing image per second package capturewebcam; import java.awt.Component; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.media.Buffer; import javax.media.CannotRealizeException; import javax.media.Manager; import javax.media.MediaLocator; import javax.media.NoPlayerException; import javax.media.Player; import javax.media.control.FrameGrabbingControl; import javax.media.format.VideoFormat; import javax.media.util.BufferToImage; import javax.swing.JLabel; public class CaptureImage { Player broadcast = null; Image img = null; public Component componen()throws IOException, NoPlayerException{ Component comp_video; MediaLocator loo = new MediaLocator("vfw://0"); try { broadcast = Manager.createRealizedPlayer(loo); broadcast.start(); } catch (CannotRealizeException ex) { Logger.getLogger(CaptureImage.class.getName()).log(Level.SEVERE, null, ex); } if((comp_video = broadcast.getVisualComponent()) != null) { comp_video.setSize(322,315); return comp_video; } else{ return null; } } public void capture_image(){ FrameGrabbingControl grab = (FrameGrabbingControl) broadcast.getControl("javax.media.control.FrameGrabbingControl"); Buffer buff = grab.grabFrame(); BufferToImage image = new BufferToImage((VideoFormat)buff.getFormat()); img = image.createImage(buff); } public void set_image_label(JLabel lb){ capture_image(); lb.setIcon(new javax.swing.ImageIcon(img)); } public void save_image(String path){ BufferedImage image = (BufferedImage) img; File outputfile = new File(path); try { ImageIO.write(image, "png", outputfile); } catch (IOException ex) { Logger.getLogger(CaptureImage.class.getName()).log(Level.SEVERE, null, ex); } } }
upvote count: 1
has comment: http://stackoverflow.com/comment/42438091
type: Question
has title: how to set timer for capturing images from web cam?
downvote count: 0
answer count: 1
tagged with: netbeans-7
score: 1
favorite count: 0

http://stackoverflow.com/a/26874157
answers question: http://stackoverflow.com/q/26873929
type: Answer
has comment: http://stackoverflow.com/comment/42306309
upvote count: 1
downvote count: 1
has body: if imports are missing in eclipse: click on the Toolkit class - then press ctrl+1 - now chosse the quickfix offered. That will import the class automatically or: press ctrl+shift+o - choose the import you need
score: 0

http://stackoverflow.com/comment/42249107
score: 0
comment on: http://stackoverflow.com/a/26842539
has text: But do you have any ideas how to access MyAsyncTask from another class?
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26949993
type: Answer
has body: Don't directly set text to your jTextField intance inside your loop otherwise your jTextField won't get updated. But temp those text in variable, then set it to jTextField after your loop ends. And don't use 'if' rather 'while' , because you want to iterate each row in database String SQL = "select CATEGORY,ITEM,QTY,Avg_Price from (select CATEGORY,ITEM,QTY,AVG_PRICE, rownum rw from final_inv) where rw ="+i+""; String text [] = new String [10]; // just for temp the strings rs = stmt.executeQuery(SQL); while(rs.next()){ text[1] +=rs.getString(1); text[2] +=rs.getString(2); text[3] +=rs.getString(3); text[4] +=rs.getString(4); } jTextField1.setText(rs.getString(text[1] )); jTextField2.setText(rs.getString(text[2] )); jTextField3.setText(rs.getString(text[3] )); jTextField4.setText(rs.getString(text[4] )); i++; rs=stmt.executeQuery(SQL); while (rs.next()){ text[1] +=rs.getString(1); text[2] +=rs.getString(2); text[3] +=rs.getString(3); text[4] +=rs.getString(4); } jTextField5.setText(rs.getString(text[1])); jTextField6.setText(rs.getString(text[2])); jTextField7.setText(rs.getString(text[3])); jTextField8.setText(rs.getString(text[4]));
has comment: http://stackoverflow.com/comment/42450227
has comment: http://stackoverflow.com/comment/42450253
answers question: http://stackoverflow.com/q/26949271
has comment: http://stackoverflow.com/comment/42450225
score: 0
has comment: http://stackoverflow.com/comment/42450264
has comment: http://stackoverflow.com/comment/42450220
has comment: http://stackoverflow.com/comment/42450233

http://stackoverflow.com/q/26885875
answer count: 3
has answer: http://stackoverflow.com/a/26885918
has answer: http://stackoverflow.com/a/26886607
type: UnansweredQuestion
tagged with: android
has title: ViewHolder pattern with multiple layouts
has body: i'm using ViewHolder pattern for fast scroll with no luck heres my code so far: public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; ListItem item = getItem(position); if(rowView == null) { LayoutInflater inflater = activity.getLayoutInflater(); ViewHolder viewHolder = new ViewHolder(); if(item.isSectionHeader()) { rowView = inflater.inflate(R.layout.section_header, null); viewHolder.header = (TextView)rowView.findViewById(R.id.section_header); } else { rowView = inflater.inflate(R.layout.list_row_coupon, null); viewHolder.image = (NetworkImageView)rowView.findViewById(R.id.thumbnail); } rowView.setTag(viewHolder); } ViewHolder holder = (ViewHolder) rowView.getTag(); if (imageLoader == null) imageLoader = ApplicationController.getInstance().getImageLoader(); holder.image.setImageUrl(cell.getThumbnailUrl(), imageLoader); holder.header.setText(cell.getShortDescription()); return rowView; } but it crashes the same code without if condition its working any ideas? 11-12 13:30:21.500: E/AndroidRuntime(18745): FATAL EXCEPTION: main 11-12 13:30:21.500: E/AndroidRuntime(18745): Process: com, PID: 18745 11-12 13:30:21.500: E/AndroidRuntime(18745): java.lang.NullPointerException 11-12 13:30:21.500: E/AndroidRuntime(18745): at ListAdapter.getView(ListAdapter.java:128) 11-12 13:30:21.500: E/AndroidRuntime(18745): at android.widget.AbsListView.obtainView(AbsListView.java:2255) 11-12 13:30:21.500: E/AndroidRuntime(18745): at android.widget.ListView.measureHeightOfChildren(ListView.java:1263) 11-12 13:30:21.500: E/AndroidRuntime(18745): at android.widget.ListView.onMeasure(ListView.java:1175) 11-12 13:30:21.500: E/AndroidRuntime(18745): at android.view.View.measure(View.java:16497) heres some part of my logcat
tagged with: android-arrayadapter
tagged with: java
has comment: http://stackoverflow.com/comment/42326372
type: Question
has answer: http://stackoverflow.com/a/26886021
tagged with: listview
score: 0

http://stackoverflow.com/comment/42374398
has text: Hm, at first glance, I'd suggest another layer of abstraction: Make the Service provide the functions you are performing on the connection. This will hide all the connection stuff into the service. My feeling is, that this setup will be easier to maintain (and write in the first place). This way you can include "retry" functionality hidden to the service's client.
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26911867

http://stackoverflow.com/comment/42416757
type: Comment
comment on: http://stackoverflow.com/a/26935998
has text: This is awesome, thanks a lot. However, It has not solved my problem yet. I will post an MVCE later on
type: AnswerComment
score: 0

http://stackoverflow.com/a/26959650
has comment: http://stackoverflow.com/comment/42457970
has body: You can use this regex to match up to 36.99: ^([89]|[12][0-9]|3[0-6])(\.[0-9]{1,2})?$ RegEx Demo To match up to 36 only use this regex (thanks to @Croises): ^(?:([89]|[12][0-9]|3[0-5])(\.[0-9]{1,2})?|36)$
has comment: http://stackoverflow.com/comment/42457785
upvote count: 3
has comment: http://stackoverflow.com/comment/42469933
type: Answer
has comment: http://stackoverflow.com/comment/42457940
downvote count: 0
has comment: http://stackoverflow.com/comment/42457722
score: 3
has comment: http://stackoverflow.com/comment/42458602
answers question: http://stackoverflow.com/q/26959612

http://stackoverflow.com/q/26832730
has comment: http://stackoverflow.com/comment/42275775
type: UnansweredQuestion
has title: Running the applets in a web browser
has comment: http://stackoverflow.com/comment/42243660
has comment: http://stackoverflow.com/comment/42258686
has comment: http://stackoverflow.com/comment/42233754
answer count: 0
tagged with: java
tagged with: embedded-resource
type: Question
has comment: http://stackoverflow.com/comment/42259631
tagged with: image
has comment: http://stackoverflow.com/comment/42232596
linked to: http://stackoverflow.com/q/16847394
has comment: http://stackoverflow.com/comment/42260556
has body: I run an Applet on the Applet Viewer of Eclipse and Netbeans IDEs, the applet contain a text and image, it runs fine, it displays the image and the text correctly. When I run it on the browsers as Firefox 31 and Firefox 33, and Google Chrome Version 38.0.2125.111 m, it displays the text, and not the image. I test the absolute and relative path, but the result was the same. This image displays the details: http://s23.postimg.org/qm9huz6sr/10_11_2014_14_45_46.jpg When I display the java console on the browsers, it doesn't show any problem or exception.
score: 0
has comment: http://stackoverflow.com/comment/42253920
has comment: http://stackoverflow.com/comment/42232165
tagged with: applet

executorservice
type: Tag
tags question: http://stackoverflow.com/q/26938210
tags question: http://stackoverflow.com/q/26929523
tag name: executorservice
tags question: http://stackoverflow.com/q/26965788

http://stackoverflow.com/q/26977523
has comment: http://stackoverflow.com/comment/42489734
has body: I would like to get some help on converting an integer to word. I am very new to Java, i kind of have an idea of what i think im going to be doing but need some help with it. The code should print the words of number from 0-999 and once -1 typed in the scanner the program should stop. Like this: Please type a number between 0 and 999: 1 ONE Please type a number between 0 and 999: 11 ELEVEN Please type a number between 0 and 999: 122 ONE HUNDRED AND TWENTY TWO Please type a number between 0 and 999: 1000 NUMBER OUT OF RANGE Please type a number between 0 and 999: -1 Thank you for using our program I also have to use methods to make this "Cleaner"
has comment: http://stackoverflow.com/comment/42489899
type: AnsweredQuestion
upvote count: 0
score: -5
has title: Converting number to word
has answer: http://stackoverflow.com/a/58739340
has comment: http://stackoverflow.com/comment/42489822
tagged with: java
possible better answer: http://stackoverflow.com/a/35200307
has comment: http://stackoverflow.com/comment/42489725
has answer: http://stackoverflow.com/a/35200307
has answer: http://stackoverflow.com/a/43275183
type: Question
tagged with: jgrasp
accepted answer: http://stackoverflow.com/a/26978523
has comment: http://stackoverflow.com/comment/42490170
has comment: http://stackoverflow.com/comment/42490063
has answer: http://stackoverflow.com/a/46465520
has answer: http://stackoverflow.com/a/49003140
has answer: http://stackoverflow.com/a/42470692
has comment: http://stackoverflow.com/comment/42490004
linked to: http://stackoverflow.com/q/23212238
has answer: http://stackoverflow.com/a/26978523
has comment: http://stackoverflow.com/comment/42489658
has comment: http://stackoverflow.com/comment/42490983
answer count: 10
has answer: http://stackoverflow.com/a/79028725
has comment: http://stackoverflow.com/comment/42490402
favorite count: 0
downvote count: 5
has answer: http://stackoverflow.com/a/45603010
has comment: http://stackoverflow.com/comment/42490201
has answer: http://stackoverflow.com/a/50966373

http://stackoverflow.com/comment/42447012
has text: Yes, I did. The issue you predicted occurred and your solution fixed it.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26953296

spring
tags question: http://stackoverflow.com/q/26895621
tags question: http://stackoverflow.com/q/26843287
tags question: http://stackoverflow.com/q/26916102
tags question: http://stackoverflow.com/q/26937029
tags question: http://stackoverflow.com/q/26859227
tags question: http://stackoverflow.com/q/26939483
tags question: http://stackoverflow.com/q/26910930
tags question: http://stackoverflow.com/q/26850419
tags question: http://stackoverflow.com/q/26858510
tags question: http://stackoverflow.com/q/26972773
tags question: http://stackoverflow.com/q/26889252
tags question: http://stackoverflow.com/q/26893321
tags question: http://stackoverflow.com/q/26886121
tags question: http://stackoverflow.com/q/26981796
tags question: http://stackoverflow.com/q/26911052
tags question: http://stackoverflow.com/q/26883281
tags question: http://stackoverflow.com/q/26903844
tags question: http://stackoverflow.com/q/26916598
tags question: http://stackoverflow.com/q/26907296
tags question: http://stackoverflow.com/q/26854932
tags question: http://stackoverflow.com/q/26881914
tags question: http://stackoverflow.com/q/26893686
tags question: http://stackoverflow.com/q/26833880
tags question: http://stackoverflow.com/q/26929048
tags question: http://stackoverflow.com/q/26845227
tags question: http://stackoverflow.com/q/26952300
tags question: http://stackoverflow.com/q/26874539
tags question: http://stackoverflow.com/q/26912896
tags question: http://stackoverflow.com/q/26911311
tags question: http://stackoverflow.com/q/26853891
tags question: http://stackoverflow.com/q/26926193
tags question: http://stackoverflow.com/q/26948124
tags question: http://stackoverflow.com/q/26910547
tags question: http://stackoverflow.com/q/26889659
tags question: http://stackoverflow.com/q/26936156
tags question: http://stackoverflow.com/q/26879840
tags question: http://stackoverflow.com/q/26908726
tags question: http://stackoverflow.com/q/26862521
tags question: http://stackoverflow.com/q/26990865
tags question: http://stackoverflow.com/q/26860855
tags question: http://stackoverflow.com/q/26970581
tags question: http://stackoverflow.com/q/26870177
tags question: http://stackoverflow.com/q/26833921
tags question: http://stackoverflow.com/q/26858611
tags question: http://stackoverflow.com/q/26858605
tags question: http://stackoverflow.com/q/26893657
tags question: http://stackoverflow.com/q/26972988
tags question: http://stackoverflow.com/q/26859669
tags question: http://stackoverflow.com/q/26870785
tags question: http://stackoverflow.com/q/26914644
tags question: http://stackoverflow.com/q/26991102
tags question: http://stackoverflow.com/q/26980363
tags question: http://stackoverflow.com/q/26862786
tags question: http://stackoverflow.com/q/26952301
tags question: http://stackoverflow.com/q/26914456
tags question: http://stackoverflow.com/q/26894640
tags question: http://stackoverflow.com/q/26935960
tags question: http://stackoverflow.com/q/26977872
tags question: http://stackoverflow.com/q/26979216
tags question: http://stackoverflow.com/q/26876137
tags question: http://stackoverflow.com/q/26837789
tags question: http://stackoverflow.com/q/26953154
tags question: http://stackoverflow.com/q/26860837
tags question: http://stackoverflow.com/q/26906789
tags question: http://stackoverflow.com/q/26931346
tags question: http://stackoverflow.com/q/26932845
tags question: http://stackoverflow.com/q/26885301
tags question: http://stackoverflow.com/q/26988420
tags question: http://stackoverflow.com/q/26882245
tags question: http://stackoverflow.com/q/26892429
tags question: http://stackoverflow.com/q/26981537
tags question: http://stackoverflow.com/q/26891341
tags question: http://stackoverflow.com/q/26972035
tags question: http://stackoverflow.com/q/26964306
type: Tag
tags question: http://stackoverflow.com/q/26906293
tags question: http://stackoverflow.com/q/26964688
tags question: http://stackoverflow.com/q/26898003
tags question: http://stackoverflow.com/q/26842334
tags question: http://stackoverflow.com/q/26883338

http://stackoverflow.com/q/26847199
accepted answer: http://stackoverflow.com/a/26906543
tagged with: scala
score: 2
type: AnsweredQuestion
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/42303513
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42586137
has title: Play Framework Scala Proxy For Http Post
has comment: http://stackoverflow.com/comment/42287217
tagged with: proxy
has comment: http://stackoverflow.com/comment/42259928
tagged with: playframework
answer count: 1
has body: I'm using play! framework with scala and trying to create a proxy for http requests, GET and POST. The GET actions seems to be working, the issue is with the POST action, where I'm not able to pass the payload of the request. I tried several things, like the code below, but none seems to be working. def postAction(query: String) = Action.async { implicit request =&gt; val data = if (request.body.asText != None) request.body.asText.get else "" WS.url(DEMO_URL + query).post(data).map(resp =&gt; Ok(resp.body).as("application/json")) } Last thing to mention is that I'm new to both play! and scala.
has comment: http://stackoverflow.com/comment/42262156
has answer: http://stackoverflow.com/a/26906543
favorite count: 0

http://stackoverflow.com/a/26882942
type: AcceptedAnswer
type: Answer
has body: Create a state (boolean) to know when you need to handle the scanned barcode. Example: boolean mustHandleScan = true. When your scanned did recognise a barcode, change that boolean to false. And only do the search if the boolean is true. You can use a timer (maybe countdowntimer) to change the boolean to true after x seconds. This is an easy solution to implement, I'm using this too.
has comment: http://stackoverflow.com/comment/42321602
accepted answer of: http://stackoverflow.com/q/26882785
answers question: http://stackoverflow.com/q/26882785
score: 0

http://stackoverflow.com/a/26958551
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26957321
score: 1
answers question: http://stackoverflow.com/q/26957321
has body: You need to wait for "Result" to get populated. Here is the updated code snippet. It should work for you: // Add this line if (!selenium.isElementPresent("//*[@id='content']/p[2]/span/font/b")) { Thread.sleep(2000); } // Verify if the result is 5 String result = selenium.getText("//*[@id='content']/p[2]/span/font/b"); System.out.println(result); // Update this line if (result.trim().equals("5")) { System.out.println("Pass"); } else { System.out.println("Fail"); } And you need to use the .equals method to compare the two string values. Note - A better approach is to replace Thread.sleep with dynamic wait methods, like waitForPageToLoad, waitForElementPresent (custom methods), etc.
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26946914
has comment: http://stackoverflow.com/comment/42438925
has comment: http://stackoverflow.com/comment/42436081
answers question: http://stackoverflow.com/q/26897908
score: 11
has comment: http://stackoverflow.com/comment/44844875
upvote count: 11
has body: IDFModel.transform() accepts a JavaRDD or RDD of Vector, as you see. It does not make sense to compute a model over a single Vector, so that's not what you're looking for right? I assume you're working in Java, so you mean you want to apply this to a JavaRDD&lt;LabeledPoint&gt;. LabeledPoint contains a Vector and a label. IDF is not a classifier or regressor, so it needs no label. You can map a bunch of LabeledPoint to just extract their Vector. But you already have a JavaRDD&lt;Vector&gt; above. TF-IDF is merely a way of mapping words to real-valued features based on word frequencies in the corpus. It also does not output a label. Maybe you mean you want to develop a classifier from TF-IDF-derived feature vectors, and some other labels you already have? Maybe that clears things up but otherwise you'd have to greatly clarify what you are trying to achieve with TF-IDF.
has comment: http://stackoverflow.com/comment/42438828
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/49150852
type: Answer
accepted answer of: http://stackoverflow.com/q/26897908
downvote count: 0

http://stackoverflow.com/comment/42336712
type: Comment
comment on: http://stackoverflow.com/a/26890619
type: AnswerComment
score: 0
has text: Already did it, but always appear in A, B,C,D in name columns

http://stackoverflow.com/q/26922554
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26922587
score: 1
has title: Affecting Boolean Variables with Mouse Events Using Swing
favorite count: 0
has body: I am not sure why the mouse events set by my mouse listener are not affecting whether or not the hat is drawn. The variable "mouseInside" seems not to be affected by the mouse events. How do I change the variable to false with the mouse events? import java.awt.*; import javax.swing.*; import java.awt.event.*; import java.awt.geom.*; public class EyesOpen extends JPanel{ private Ellipse2D.Double head; private Ellipse2D.Double eyeOne; private Ellipse2D.Double eyeTwo; private Rectangle2D.Double hatBody; boolean mouseInside; public EyesOpen(){ this.setFocusable(true); this.requestFocus(); this.setPreferredSize(new Dimension(500,500)); head = new Ellipse2D.Double(180,180,140,140); eyeOne = new Ellipse2D.Double(220,220,20,20); eyeTwo = new Ellipse2D.Double(260,220,20,20); hatBody = new Rectangle2D.Double(170,180,160,20); class MyMouseListener implements MouseListener{ public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e){ mouseInside=true; } public void mouseExited(MouseEvent e){ mouseInside=false; } public void mousePressed(MouseEvent e){ } public void mouseReleased(MouseEvent e){ } } this.addMouseListener(new MyMouseListener()); } public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; g2.setPaint(Color.BLUE); g2.fill(head); g2.setPaint(Color.BLACK); g2.fill(eyeOne); g2.setPaint(Color.BLACK); g2.fill(eyeTwo); if(mouseInside=true){ g2.setPaint(Color.BLACK); g2.fill(hatBody);} } public static void main(String[] args){ JFrame f = new JFrame("Head"); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setLayout(new FlowLayout()); f.add(new EyesOpen()); f.pack(); f.setVisible(true); } }
type: Question
has comment: http://stackoverflow.com/comment/42392927
tagged with: java
has comment: http://stackoverflow.com/comment/42392828
upvote count: 1
tagged with: swing
answer count: 1
has comment: http://stackoverflow.com/comment/42392655
has answer: http://stackoverflow.com/a/26922587

http://stackoverflow.com/comment/42296038
comment on: http://stackoverflow.com/a/26868473
type: AnswerComment
has text: Though this is the correct answer design-wise, he said specifically he doesn't want to use an array.
score: 4
type: Comment

http://stackoverflow.com/comment/42383932
type: Comment
comment on: http://stackoverflow.com/a/26917536
score: 0
type: AnswerComment
has text: volatile use is in the same category as single-thread, uncontended synchronization.

http://stackoverflow.com/comment/42448234
score: 0
type: Comment
type: QuestionComment
has text: What is your question? How would `TestStopWatch` know what class `start()` and `stop()` refer to?
comment on: http://stackoverflow.com/q/26954045

http://stackoverflow.com/comment/42469969
type: QuestionComment
has text: when the method is static you gonna use it like the name of the class.the name of method
comment on: http://stackoverflow.com/q/26966430
score: 0
type: Comment

http://stackoverflow.com/a/26870434
score: 0
type: Answer
has body: You can use generics feature if java version is 7 (or upper) public static &lt;T&gt; T get(CacheHelper key){ return (T)(lookup.get(key.getId()); } And you can then call it as follows : Myclass.&lt;String&gt;get(key); In the above example I supposed the Myclass be a class containing the get() method
answers question: http://stackoverflow.com/q/26870357
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/26913173
answer count: 2
linked to: http://stackoverflow.com/q/543049
has answer: http://stackoverflow.com/a/26916201
has answer: http://stackoverflow.com/a/26914475
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/543049
type: Question
has title: Search XML using XPath with JDOM/JAXEN/SAXON
tagged with: java
tagged with: saxon
has comment: http://stackoverflow.com/comment/42380778
tagged with: jdom-2
has body: I do have an XML document that I'm parsing using JDOM-2.0.5. The following code works fine and bookNodes list contains all book nodes from my XML file: SAXBuilder builder = new SAXBuilder(); // @see http://xerces.apache.org/xerces-j/features.html // Disable namespace validation builder.setFeature("http://xml.org/sax/features/namespaces", false); Document doc = null; try { doc = builder.build(xmlURL); } catch (JDOMException | IOException e) { e.printStackTrace(); return null; } // get browse elmt Element browse = doc.getRootElement().getChild("browse"); // Get all browse's chlidren List<Element> bookNodes = browse.getChildren("book"); for (Element book : bookNodes) { // Do things with the selected nodes //... } And here's an example of my XML datas: <?xml version="1.0" encoding="utf-8"?> <status code="0"/> http://www.example.com/books Browse, search and .... en-us Sun, 09 Nov 2014 00:00:02 +0000 Copyright 2014, XXX Books Gambardella, Matthew XML Developer's Guide Computer 44.95 <publish_date>2000-10-01</publish_date> An in-depth look at creating applications with XML. Ralls, Kim The Midnight Rain Fantasy 5.95 <publish_date>2000-12-16</publish_date> A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world. Corets, Eva The Sundered Grail Fantasy 5.95 <publish_date>2001-09-10</publish_date> The two daughters of Maeve, half-sisters, battle one another for control of England. Sequel to Oberon's Legacy. Randall, Cynthia Lover Birds Romance 4.95 <publish_date>2000-09-02</publish_date> When Carla meets Paul at an ornithology conference, tempers fly as feathers get ruffled. Question.1: I want to only select book nodes containing some text. So, I used XPath's query //book[contains(./title, 'The')] and jaxen-1.1.6 with following code: filter = "//book[contains(./title, 'The')]"; // should return 2 elements (2nd and 3rd nodes) // use the default implementation XPathFactory xFactory = XPathFactory.instance(); XPathExpress…
score: 0

http://stackoverflow.com/comment/42434455
type: AnswerComment
type: Comment
has text: I deleted it because I was basically the same as yours, but came later. I undeleted it since you think it adds something. In that specific case, storing the id is useless. In fact I borrowed code that I'm actually using where the Answer class is indeed in a top-level class, and can be used for any kind of entity, making it reusable (and reused).
comment on: http://stackoverflow.com/a/26946017
score: 0

http://stackoverflow.com/a/26946733
upvote count: 3
has body: for(i = 0; (char) System.in.read() != 's'; i++) System.out.println("pass # " + i);
answers question: http://stackoverflow.com/q/26946719
accepted answer of: http://stackoverflow.com/q/26946719
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer

http://stackoverflow.com/comment/42261377
comment on: http://stackoverflow.com/a/26849319
score: 0
type: Comment
has text: I can't use String method? Could you show me please.
type: AnswerComment

http://stackoverflow.com/a/26857384
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42276593
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42276733
has comment: http://stackoverflow.com/comment/42276768
answers question: http://stackoverflow.com/q/26857341
accepted answer of: http://stackoverflow.com/q/26857341
has comment: http://stackoverflow.com/comment/42276653
has body: You have a package. So you must specify the classpath. One way to do that is to use the folder that contains your top level package (c:\myJavaProject\tint31\) like set CLASSPATH=c:\myJavaProject\tint31\ javac -d . TestPhone2.java or you might use -classpath like javac -d . -classpath c:\myJavaProject\tint31\ TestPhone2.java
type: AcceptedAnswer

http://stackoverflow.com/q/26876945
tagged with: java
tagged with: overriding
accepted answer: http://stackoverflow.com/a/26877048
type: AnsweredQuestion
has body: I am just getting into implementing Apache Pivot into my programing and I am having issues with @Override. I get an error code in variation of this: "The method shutdown(boolean) of type Chief must override or implement a supertype method" This is my code very simple but cant manage to get it to work. I marked the locations where the error happens with //Error resides here. package portal; import java.awt.Color; import java.awt.Font; import org.apache.pivot.collections.Map; import org.apache.pivot.wtk.Application; import org.apache.pivot.wtk.Display; import org.apache.pivot.wtk.HorizontalAlignment; import org.apache.pivot.wtk.Label; import org.apache.pivot.wtk.VerticalAlignment; import org.apache.pivot.wtk.Window; public class Chief { private Window window = null; //Error resides here @Override public void startup(Display display, Map&lt;string, String&gt; properties) { window = new Window(); Label label = new Label(); label.setText("Hello World!"); label.getStyles().put("font", new Font("Arial", Font.BOLD, 24)); label.getStyles().put("color", Color.RED); label.getStyles().put("horizontalALignment", HorizontalAlighnment.CENTER); label.getStyles().put("verticalAlignment", VerticalALignment.CENTER); window.setContent(label); window.setTitle("Hello World!"); window.setMaximized(true); window.open(display); } //Error resides here @Override public boolean shutdown(boolean optional) { if (window !=null) { window.close(); } return false; } //Error resides here @Override public void suspend() { } //Error resides here @Override public void resume() { } }
answer count: 1
type: Question
tagged with: apache-pivot
score: 0
has answer: http://stackoverflow.com/a/26877048
has title: @Override Issues with Apache pivot

http://stackoverflow.com/a/26873537
has body: Indeed, with argument-resolver component you won't get near to what you need. A simple interceptor would do though, something like public class CheckSessionInterceptor extends HandlerInterceptorAdapter { @Autowired private CheckSessionIdHandler checkSessionIdHandler; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // ... return checkSessionIdHandler.checkSessionValid(request); } } and simply bind it to desired URI patterns &lt;interceptors&gt; &lt;interceptor&gt; &lt;mapping path="/*" /&gt; &lt;beans:bean class="org.example.mvc.interceptors.CheckSessionInterceptor"&gt;&lt;/beans:bean&gt; &lt;/interceptor&gt; &lt;/interceptors&gt; Of course, if you follow this approach you CheckSessionHandler would not need to implement any iterfaces
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26869951
answers question: http://stackoverflow.com/q/26869951

http://stackoverflow.com/comment/42305959
comment on: http://stackoverflow.com/a/26873336
type: AnswerComment
score: 0
has text: What is weird is that if I remove those calls to this method the process speed up tremendously. There are not intermediate calls, the calls are direct and that is why I use cache because I could not find any other explanation.
type: Comment

http://stackoverflow.com/a/26970948
has body: set scrollpane rowheader dimension like, scrollPane.getRowHeader().setPreferredSize(new Dimension(120, 50)); add above statement after scrollPane.setRowHeaderView(headerTable); and comment the line //headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26970601
upvote count: 2
answers question: http://stackoverflow.com/q/26970601

http://stackoverflow.com/a/26905879
answers question: http://stackoverflow.com/q/26879174
score: 0
has body: Try to check Maven -> Importing -> Automatically download sources. Also you can try to disable "Java bytecode decompiler" plugin.
type: Answer

http://stackoverflow.com/comment/42246071
has text: I have tried another command,which is converting csv to xml, from the same java code and its working fine. The difference between the two cases is that the xml in the first case is huge. Could that be a problem?
comment on: http://stackoverflow.com/q/26839674
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26937230
type: Question
has comment: http://stackoverflow.com/comment/42418669
answer count: 1
has body: I would like to draw a line using the equation of a line which basically gives a slope/gradient and the y intercept "c" I've tried to draw the line using two points using public void paint(Graphics g) { g.drawLine(x1,y1,x2,y2); } but i would like to draw a line using the equation instead. Any help is appreciated.
score: 0
linked to: http://stackoverflow.com/q/7410614
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26937275
tagged with: line
duplicate of: http://stackoverflow.com/q/7410614
tagged with: java
tagged with: javafx
has title: How to draw a line using the equation: y=mx + c in java

http://stackoverflow.com/q/26845227
type: Question
has body: can i use both jdbcTemplet as well as hibernate. because there are very complex joins in my application and that can be done easily with jdbc templete...and hibernate give ease on insert update and delete...
has answer: http://stackoverflow.com/a/26845288
downvote count: 0
answer count: 1
has title: can i use both jdbcTemplet as well as hibernate
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26845288
upvote count: 1
tagged with: spring
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/42252147
type: Comment
type: AnswerComment
has text: @Bader I just put that line in a simple application that reads a line with Scanner.nextLine(), and entered 93d8s. ` Scanner scan = new Scanner(System.in); int num = Integer.parseInt(scan.nextLine ().replaceAll("[^0-9]+", "")); System.out.println (num);`
score: 0
comment on: http://stackoverflow.com/a/26843485

http://stackoverflow.com/q/26953383
tagged with: emacs
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26953419
has title: Emacs: set key that is local to java mode.
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/26953419
has body: I am inspired by this url. It suggests setting a global key (global-set-key (kbd "RET") 'newline-and-indent). However, I would like to set RET to 'newline-and-indent ONLY in the Java mode. What code should I add to the init.el in order to achieve this ?

http://stackoverflow.com/comment/42568007
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26981882
has text: Its not a jar that is being created. Its just a POJO.

http://stackoverflow.com/q/26926943
has answer: http://stackoverflow.com/a/26927156
has body: I have purchased an image-gallery and implemented it into my webpage. Now the gallery is in the foreground every time and the menu is below. I have tried to fix it with z-index but it doesn't seem to work. I have uploaded the webpage so that you can see the code. I'm unable to post the java code because I purchased it and I'm not allowed to post it. Link to see what i mean Thanks for your help, Patrick HTML: &lt;!DOCTYPE html&gt; &lt;html lang="de" class="no-js"&gt; &lt;head&gt; &lt;meta charset="UTF-8" /&gt; &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt; &lt;title&gt;Portfolio von &lt;/title&gt; &lt;meta name="description" content="Das ist das Portfolio von" /&gt; &lt;meta name="keywords" content="photo, photos, Foto, Fotografie, Messerli, usw" /&gt; &lt;meta name="author" content="xyz" /&gt; &lt;link rel="shortcut icon" href="img/favicon.ico"&gt; &lt;link rel="stylesheet" type="text/css" href="css/normalize.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="css/demo.css" /&gt; &lt;link rel="stylesheet" href="fonts/font-awesome-4.2.0/css/font-awesome.min.css"&gt; &lt;link rel="stylesheet" type="text/css" href="css/menu_cornermorph.css" /&gt; &lt;link rel="shortcut icon" href="img/Chantale-favicon.png" /&gt; &lt;!--NUR BEI GALLERIE!!! --&gt; &lt;link rel="stylesheet" type="text/css" href="content/global.css"&gt; &lt;script type="text/javascript" src="java/FWDIGP.js"&gt;&lt;/script&gt; &lt;!--[if IE]&gt; &lt;script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"&gt;&lt;/script&gt; &lt;![endif]--&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="container"&gt; &lt;div class="menu-wrap"&gt; &lt;nav class="menu"&gt; &lt;!-- &lt;div class="profile"&gt;&lt;img src="img/user1.png" alt="Matthew Greenberg"/&gt;&lt;span&gt;Matthew Greenberg&lt;/span&gt;&lt;/div&gt; --&gt; &lt;div class="link-list"&gt; &lt;a href="index.html"&gt;&lt;span&gt;Home&lt;/span&gt;&lt;/a&gt; &lt;a hre…
has comment: http://stackoverflow.com/comment/42400293
score: 0
answer count: 1
has title: How i get my menu in the foreground?
accepted answer: http://stackoverflow.com/a/26927156
tagged with: http://stackoverflow.com/tag/html
tagged with: css
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42400204
tagged with: java
has comment: http://stackoverflow.com/comment/42400180
has comment: http://stackoverflow.com/comment/42400179
type: Question

http://stackoverflow.com/a/26984541
downvote count: 1
answers question: http://stackoverflow.com/q/26984482
has body: Your code is fine, but you should use System.out.println() instead of System.out.print() The problem is that you are printing first your month and then, inmediately after the number 0 (variable days) in the SAME Line. Suggestion for next time, use a debugger :)
score: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/46625005
score: 0
comment on: http://stackoverflow.com/q/26904725
has text: I think you should pass some more info about architecture of your pc and software installation. Python is 64 bit? Java is 64 bit. If python is not, I fear that there can be issues. I read "mixed mode linux-amd64 ".
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42334202
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26888513
has text: @Selvin: Thanks, I've already tried to use StrictMode and don't seem to have any policy violations. Currently trying to use this: http://developer.android.com/tools/debugging/debugging-tracing.html. Is there anything else you could suggest?

http://stackoverflow.com/a/26835342
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26834749
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26834749
has body: The key here is whatever has exported the data has done it wrong. Possibly someone has run something from the MongoDB shell and redirecting console output to a file. That is basically "doing it wrong". There is a concept called MongoDB Extended JSON and has in fact been picked up in a few other areas, notably the EJSON project.What this tries to do is make sure that any exported JSON maintains "type" information to the BSON type identifier ( or other Object Type, in the purpose of EJSON ) so that a similar "extended JSON" parser can "re-construct" the object to it's intended form. For a "date" object, the intented JSON representation is this: { "death": { "$date": "2007-03-17T04:00:00Z" } } Since com.mongodb.util.JSON.parse is enabled with knowledge of the Extended JSON spec, then any such JSON contruct will result in a correct date object being constructed from the parsed data. So what you have right now is just a "string". In fact, if it is not "quoted" like this: ´ { "death" : "Date('2007-03-17T04:00:00Z')" } Then it is not in fact even valid JSON and would even need to be manipulated to a correct form before even a basic JSON parser would not error. At any rate, the result is just a "string" still, so you would need to make a regex match for the numerical data, then pass that to a date object construct. Clearly the "best" thing to do here is to fix the "export" source of the data so that it is doing this date parsing to JSON in the correct extended way. Then the parser you are using will do the right thing.

http://stackoverflow.com/a/26981210
score: 1
upvote count: 1
has body: ByteBuffer.putInt always puts the int as the full 32 bits -- 4 bytes. You're seeing the leading three zero bytes in the length field.
answers question: http://stackoverflow.com/q/26981097
downvote count: 0
type: Answer

hp-uft
tags question: http://stackoverflow.com/q/26846688
tag name: hp-uft
type: Tag

http://stackoverflow.com/q/26953634
answer count: 2
downvote count: 3
tagged with: apache
has comment: http://stackoverflow.com/comment/61822404
possible better answer: http://stackoverflow.com/a/26953737
tagged with: tomcat
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/26953737
has comment: http://stackoverflow.com/comment/42447500
has body: I've worked with Apache web server before, using PHP, Ruby, and serving static JavaScript/HTML pages. One thing that I'm confused on with Tomcat is basically WHY does Tomcat exists in the first place, rather than using Apache with installed JVM? Why of all these popular languages does Java need it's own specialize container, namely Tomcat? If one wants to use PHP to serve content, simply install PHP on the Apache server and voila when a user goes to mysite.com/mypage.php this happens: Apache server gets the corresponding file mypage.php sees PHP, uses the PHP intepreter to process the page returns the result Why isn't it the same as this when working with Java? In my mind it should go like this: simply have Java and JVM installed on Apache server and then when user goes to mysite.com/mypage this happens: Apache server gets the corresponding file sees Java, uses JVM to compile/process the page returns the result Is it because Java files need to be compiled, and it wouldn't make sense to re-compile it at every request? Then why not just map the request to proper .class file? This might sound absurd to those confident with Tomcat, but as you can see I unfortunately don't get it.
tagged with: php
linked to: http://stackoverflow.com/q/30632
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42447621
has title: Why invent Tomcat when Apache can already have JVM
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26954036
accepted answer: http://stackoverflow.com/a/26954036
upvote count: 3
score: 0

http://stackoverflow.com/a/26935315
type: Answer
has body: I found this solution: DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // stop the network loading of DTD files factory.setValidating(false); factory.setNamespaceAware(true); factory.setFeature("http://xml.org/sax/features/namespaces", false); factory.setFeature("http://xml.org/sax/features/validation", false); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false); factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); (see here TransformerFactory - avoiding network lookups to verify DTDs) Since we know that &lt;int-xml:xslt-transformer&gt;supports source-factory and result-factory, there will be just need to provide your onw implementation for them, e.g. based on exisiting DomSourceFactory and DomResultFactory, respectivally, and inject that code there in the constructor. Of course you can inject DocumentBuilderFactory to that DomSourceFactory and DomResultFactory, but you should write some custom FactoryBean&lt;DocumentBuilderFactory&gt; to initialize DocumentBuilderFactory in its getObject().
answers question: http://stackoverflow.com/q/26934157
score: 0

http://stackoverflow.com/a/26953671
has comment: http://stackoverflow.com/comment/42447668
answers question: http://stackoverflow.com/q/26953597
score: 0
type: AcceptedAnswer
has body: I recommend using the first approach as it will work in cases when the second approach will not: Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName); I once initially used the second approach in a JUnit test and then we had to change it to use context class loader to allow running the test from IDE. See: Difference between thread&#39;s context class loader and normal classloader , particularly this line 'In this case the object needs to use Thread.currentThread().getContextClassLoader() directly if it wants to load resources that are not available on its own classloader.'
type: Answer
accepted answer of: http://stackoverflow.com/q/26953597

http://stackoverflow.com/q/26956155
has answer: http://stackoverflow.com/a/26956471
answer count: 3
has comment: http://stackoverflow.com/comment/42452098
favorite count: 0
has answer: http://stackoverflow.com/a/26966075
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/42451955
tagged with: swing
has answer: http://stackoverflow.com/a/26956486
has comment: http://stackoverflow.com/comment/42451735
tagged with: jbutton
has body: I'm trying to make button show a message when pressed, it's not working. Can anyone tell me what I missed? In the end I have the KeyListener and the if for JOptionPane, but the website is not letting me post it (I'm new to this). Anyway, it would be really nice if someone could tell me what I'm doing wrong, thanks. public javalearning(){ FlowLayout f = new FlowLayout(); setLayout(f); this.setSize(200,200); JFrame j = new JFrame(); this.setTitle("this is a tittle"); JButton button = new JButton(); button.setText("Button"); this.add(button); JButton button2 = new JButton(); button2.setText("Button2"); this.add(button2); this.setVisible(true); }
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42451714
type: Question
has title: The JButton is not responding, why?
has comment: http://stackoverflow.com/comment/42451695
has comment: http://stackoverflow.com/comment/42451744
has comment: http://stackoverflow.com/comment/42451856
downvote count: 3

http://stackoverflow.com/comment/42487006
comment on: http://stackoverflow.com/q/26975976
type: Comment
type: QuestionComment
score: 0
has text: Show us the whole code. Can't debug anything with that

http://stackoverflow.com/comment/42354626
type: Comment
type: QuestionComment
has text: Are the numerator and denominator floating-point or integer types?
score: 0
comment on: http://stackoverflow.com/q/26901178

http://stackoverflow.com/q/26932184
tagged with: java
tagged with: hibernate
upvote count: 1
type: Question
has title: JPA merge() on detached entity makes insert when it exists
answer count: 1
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/26935673
has body: i use JPA with hibernate provider. heres my part code: @Entity @IdClass(xxxPK.class) @NamedQueries({ ... }) @Inheritance(strategy = InheritanceType.JOINED) public class xxx extends AbstractEntity { public static final String GET_TRADES = "getInstruments"; public static final String GET_STRUCTURE = "getStructure"; public static final String GET_ALL = "getAllTrades"; @Column(nullable = false) @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "xxx") @SequenceGenerator(name = "xxxx", sequenceName = "xxxxS", allocationSize = 1) private Long systemId; @Id @Column(nullable = false) private Integer version; ////// And an descendant: @Entity @PrimaryKeyJoinColumns( { @PrimaryKeyJoinColumn(name = "systemId"), @PrimaryKeyJoinColumn(name = "version") } ) public class YYY extends xxx { ////// I create an YYY instance and persiti is as i expect. After that i have per one row in each table in db: fx = Persistence.invoke(new Persistence.Invoke&lt;YYY&gt;() { @Override public YYY run(EntityManager em) { BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(new ClassPathResource("json/XXX_from.json").getFile())); } catch (IOException ex) { System.out.print("File is not found"); } YYYfx = (YYY) EntityConverter.getConverter(YYY.class).fromJson(reader); em.persist(fx); return fx; } }); So, after that fx is detached and as SPEC. sais i can make it persistent in another session by calling merge(), so call it but: Persistence.invoke(new Persistence.Invoke&lt;Object&gt;() { @Override public Object run(EntityManager em) { fx.setZZZ("A"); em.merge(fx); return null; } }); After that i have an another row in XXX and YYY tables with a new primary. It looks like provider takes fx as TRANSIENT not as DETACHED then it sais ok - it is a new object and i would insert it. I dont know what to do i ve lost 4 hours on such stupid case. Please help! public class Persistence { private static EntityManagerFactory emf; public static EntityManagerFactory getEmf() { r…
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26935673
score: 1

http://stackoverflow.com/q/26877243
has title: How to test parsing a date with SimpleDateFormat without ParseException
favorite count: 0
answer count: 3
tagged with: android
tagged with: datetime
has answer: http://stackoverflow.com/a/26877503
tagged with: regex
accepted answer: http://stackoverflow.com/a/26877503
possible better answer: http://stackoverflow.com/a/26877539
has comment: http://stackoverflow.com/comment/42311674
downvote count: 0
has comment: http://stackoverflow.com/comment/42311804
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26877539
has answer: http://stackoverflow.com/a/26877385
type: Question
has body: I am parsing dates with Android class java.text.SimpleDateFormat by passing a specific pattern. However I use multiple data sources and there can be two different date patterns, sometimes there is no day of the week in the date, i.e. I expect to run either one of the two pieces of code: new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).parse(myDate); new SimpleDateFormat("dd MMM yyyy", Locale.US).parse(myDate); But I did not find any way to discriminate between these two cases on another criterion than the value of the String myDate. So far, I can run one of the two lines of code and catch the ParseException in case I run the wrong one (and I run the other in the catch block). My second option is to do some previous analysis with String.matches(String) or manipulating Pattern. As unnecessarily throwing an Exception is a bad practice, and before I reinvent the wheel by implementing the Date parsing tools, is there any other class or library that would let me test a pattern (ideally something like SimpleDateFormat.isParseable(String) that would return false if SimpleDateFormat.parse(String) throws a ParseException). So far I searched among SimpleDateFormat methods and its parents, but I could not find any tip or anyone running in such problem. Here is the current code: Date parseDate(String myDate){ String expectedDate = ""; try{ expectedDate = new SimpleDateFormat("EEE dd MMM yyyy", Locale.US).parse(myDate); // this is the first possible pattern for the date } catch(ParseException e){ // I consider it bad practice and too expensive to run code there expectedDate = new SimpleDateFormat("dd MMM yyyy", Locale.US).parse(myDate); // this is the second possible pattern for the date } return expectedDate; } And, as I added in a comment, I noticed the issue because I order a list of items displayed in a ListView based on their date and I can notice the difference in terms of performance.
upvote count: 1
has comment: http://stackoverflow.com/comment/42337710

http://stackoverflow.com/q/26876611
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42310767
has answer: http://stackoverflow.com/a/26876930
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/3422673
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26876930
has title: How to store predicates in configuration file in java
has comment: http://stackoverflow.com/comment/42310968
favorite count: 0
has body: I have a list of hashmap&lt;string, real&gt;. I want to access each element on the list, apply a predicate on it and add the element to another list if the predicate returns true. For example suppose I have a list of hashmap like this - {(a, 15), (b, 17), (c, 12)}, {(a, 12), (b, 13), (d, 90)}. My predicate would be something like a &gt; 7 &amp; b &lt; 15 . Now I would apply this predicate on each element of the list and will find that the second element satisfy the predicate. Applying the predicate should be easy as all I have to do is to access the element and compare its value with values supplied with predicate. The part where I am stuck is how to save such a predicate in a configuration file, such that it can be easily converted into a class and new predicates can be added without fiddling with core code.
upvote count: 2
score: 2

http://stackoverflow.com/comment/44200800
comment on: http://stackoverflow.com/q/26933374
score: 0
type: QuestionComment
has text: Sorry, I was on vacation.. so: lucene=4.10.1, spring=3.2.12.RELEASE and Java=jdk1.7.0_60
type: Comment

http://stackoverflow.com/q/26950218
has comment: http://stackoverflow.com/comment/42441725
type: Question
has comment: http://stackoverflow.com/comment/42441699
tagged with: hashmap
answer count: 1
has answer: http://stackoverflow.com/a/26950240
has comment: http://stackoverflow.com/comment/42442263
tagged with: class
score: 0
tagged with: generics
has title: Specific class instead of generics in Java
accepted answer: http://stackoverflow.com/a/26950240
type: AnsweredQuestion
tagged with: java
has body: How can I extend HashMap with a specific class. public class TestMap&lt;K, V&gt; extends HashMap&lt;K, V&gt; I want V to be an Integer. Writing Integer instead of V overrides Integer class and causes bugs(Integer i = 1 does not work) when integer is used. How can I fix this?n

http://stackoverflow.com/a/26955945
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26954506
has body: I resolved the problem of having double number of initial connections from the connection pool. The problem was related to the sample code from the site mentioned. It had wrong configuration for the Spring contexts. The same xml file was included in Application Context and MVC Context. I noticed it after wasting a lot of time. The BasicDataSource was getting instantiated two times. So, there were double number of connections. Once again it is proven not to blindly trust tutorials that don't have certain standard. One should follow StackOverflow and official documentation of the respective API.
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26954506

http://stackoverflow.com/q/26956514
has answer: http://stackoverflow.com/a/26956584
score: 0
tagged with: java
answer count: 2
has title: Thread gets killed after few iterations
has answer: http://stackoverflow.com/a/26956798
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42452434
has comment: http://stackoverflow.com/comment/42452402
has body: I'm trying to create an application which contains a service that starts when device boots up &amp; then logs some events. Service entry in manifest.xml &lt;receiver android:name="com.myservices.BReceiver" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt; &lt;category android:name="android.intent.category.HOME" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt; &lt;service android:name="com.myservices.MyService" &gt; &lt;/service&gt; BReceiver.java public class BReceiver extends BroadcastReceiver { private static final String TAG = "BReceiver"; @Override public void onReceive(Context context, Intent intent) { Log.e(TAG, "onReceive started"); // Main Logging Service Intent service = new Intent(context, MyService.class); context.startService(service); Log.e(TAG, "onReceive ended"); } } MService.class public class MyService extends IntentService { private static final String TAG = "MyService"; private static final long TIMER = 2000; public MyService() { super("MyService"); } @Override protected void onHandleIntent(Intent intent) { startLogginThread(); } /** * For logging */ private void startLogginThread() { Thread thread = new Thread() { public void run() { while (true) { try { // Logging events myLogger(); Log.e(TAG, "Awake"); // TIMER Thread.sleep(TIMER); } catch (Exception e) { Log.e("MyService", "local Thread error "+ e.toString()); } } } }; thread.start(); } private void myLogger() { // Creating new file to store logs. // Check if SD card is available else use internal memory. File dir = null; if (MyServiceUtil.isExternalStorageReadable() &amp;&amp; MyServiceUtil.isExternalStorageWritable()) { // External Memory File sdCard = Environment.getExternalStorageDirectory(); dir = new File(sdCard.getAbsolutePath() + "/MyLogger"); dir.mkdirs(); } else { // Internal Memory dir = getFilesDir(); } // Rename to txt for reading File file = new File(dir, "log.txt"); if (!file.exists()) { try { file.createNewFile(); } catch (IOException…
type: Question
tagged with: multithreading
tagged with: android

http://stackoverflow.com/comment/42497127
type: Comment
comment on: http://stackoverflow.com/q/26980868
score: 0
has text: @avgvstvs when redirect isn't occurring in an exception block, then everithing is fine :) - redirect works right i.e. redirects to "/local.action"
type: QuestionComment

http://stackoverflow.com/q/26841839
has comment: http://stackoverflow.com/comment/42247592
has comment: http://stackoverflow.com/comment/42247761
upvote count: 2
has comment: http://stackoverflow.com/comment/42247773
has comment: http://stackoverflow.com/comment/42247685
downvote count: 7
answer count: 1
has comment: http://stackoverflow.com/comment/42247697
favorite count: 0
linked to: http://stackoverflow.com/q/4576330
tagged with: android
has answer: http://stackoverflow.com/a/26842104
accepted answer: http://stackoverflow.com/a/26842104
type: AnsweredQuestion
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/42248437
has body: I am fresher in Android field kindly explain these lines especially setContentView(R.layout.activity_display_message); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); }
type: Question
has title: Kindly explain below lines of code

http://stackoverflow.com/comment/54717049
type: AnswerComment
comment on: http://stackoverflow.com/a/33460868
has text: Ok, As you are taking about that **HOY** view, as far i understand that is also a view which is added not any Item-decorator. Define another type of view in getItemViewType() method in adapter `public int getItemViewType(int position) { if (lsItem.size() == 0) return EMPTY_VIEW; /*null Indicate Loader*/ if (lsItem.get(position) == null) return PROGRESS_VIEW; return super.getItemViewType(position); }` this is how I created two defferent type of view in my recyclerview
score: 0
type: Comment

http://stackoverflow.com/a/26903475
downvote count: 0
has body: Some of the components within JSF/PrimeFaces implement the NamingContainer inerface. Such components affect the way client ids of its children are generated. The examples of such components include &lt;h:form&gt; (HtmlForm class) and &lt;p:accordionPanel&gt; (AccordionPanel class). While you seem to be aware of the former, you did not know that the latter was a naming container as well. When you want to AJAX-update a given component you need to specify either its id, in case it's located relative to the same naming container, or its client id, in case it's relative to the view root. Tying it to your view structure we get update=":formId:accordionPanelId:dataTableId". The last issue to concern is that every component must have an id set so that it could be found within a component tree and surely be unique. In case you supply an id of your own, like in id="myComponentId", you will set the id for the component. Otherwise component id will be autogenerated by the JSF framework for you: that's why you ind those j_idt43 ids. To sum it up, you need to explicitly specify id for your accordion panel and include it in your path to the to-be-updated component (exactly as proposed in wittakarn's answer).
answers question: http://stackoverflow.com/q/26897886
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/42372191
type: AnswerComment
comment on: http://stackoverflow.com/a/26890202
score: 0
type: Comment
has text: Thanks a lot! The list helps a ton, I decided to just print an array with the location of seats 1-36 and then have the user pick a number then check the list for true or false.

http://stackoverflow.com/comment/42416503
has text: My code was just a try which doesn't work at all. I would like to learn how to do it properly.
type: QuestionComment
comment on: http://stackoverflow.com/q/26934147
type: Comment
score: 0

http://stackoverflow.com/comment/42338520
has text: Why do you have an instance of Scanner when it's never used?
comment on: http://stackoverflow.com/q/26892229
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42376566
type: QuestionComment
has text: `Object k` is not related to the genric type `K key`. It could be named `Object foo` and the code would still do the exact same thing
score: 0
comment on: http://stackoverflow.com/q/26913648
type: Comment

http://stackoverflow.com/comment/42238001
comment on: http://stackoverflow.com/a/26833364
score: 0
type: Comment
has text: Thanks @Radiodef and everyone this one really helpful community. I just hope to get to all you guys level of knowledge in programming. I just finished C++ and sql database programming classes. Although I love C++. I am really loving Java so far and hope to get better at it. I really do appreciate you guys though!
type: AnswerComment

http://stackoverflow.com/q/26987627
tagged with: sapi
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27025625
type: UnansweredQuestion
has body: This is regarding to the question in Detecting phone numbers using sapi. I used that grammar in the answer. But it gets numbers with space how can I create grammar get numbers without space?
has title: Detecting phone numbers using sapi
tagged with: java
type: Question

http://stackoverflow.com/q/26938043
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/42420794
score: 1
tagged with: java
type: Question
downvote count: 0
favorite count: 0
has title: Make a Thread wait for a Graphics2D method to finish
tagged with: graphics2d
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42426444
has body: I tried to write a simple structure for a 2D game in java, using active rendering and fps independent game updates and I ran into a problem with my run() method. As you can see in the code below, I create a BufferedImage frameBuff, draw a bunch of rectangles on it and render it to the JPanel panel in the nested Window class. My problem is, when I set my fps cap really low, I can see that the first BufferedImage frameBuff is not really drawn to the panel, eventhough the renderImage() method gets called. This seems to be due to the fact, that the Graphics2D object does not finish drawing before i render frameBuff to the panel. Sure I could just sleep some time after drawing before I render the frameBuff, but the amount of time needed to finish drawing to the frameBuff might vary when the scene gets more complex. So is there a way to wait/sleep exactly until g2d has finished drawing? import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.*; import javax.swing.border.EmptyBorder; public class Game implements Runnable { private Window gui; private int frameCap; private double delta, fixedSpeed, frameTimeCap; private long lastFrame, currentFrame; private BufferedImage frameBuff; private Thread mainThread; private boolean running; private static final long oneSecondInNano = 1000000000; private static final long oneMilliInNano = 1000000; public static void main(String[] args) { new Game(60, 0); } /** * Sets up the Game, setting its fixed speed (time relative) and the * framecap. * * @param fixedSpeed * - the speed at which the game should run in units/second * * Example: If a rectangle should move 60 * pixels/second, the speed would be set to 60 and the rectangle * would be moved by 1*delta every frame) * @param frameCap * - the amount of frames/second the game must not exceed */ public Game(double fixedSpeed, int frameCap) { this.frameCap = frameCap; if(this.frameCap == 0) this.frameTimeCap = 0; else this.frameTimeCap = oneSecondInNano/frameCap; this.fi…
tagged with: thread-synchronization

http://stackoverflow.com/q/26990694
tagged with: rest
has comment: http://stackoverflow.com/comment/42515062
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/26992345
accepted answer: http://stackoverflow.com/a/26992345
possible better answer: http://stackoverflow.com/a/27016146
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27016146
score: 0
answer count: 2
has body: Could someone please tell me why I am getting empty body in the controller. Here is my test public void updatePackage() throws Exception { JSONObject updateObj = new JSONObject(); updateObj.append("packageType", "packageType-update-endpoint"); SPackage updatedResponse = null; try { String json = updateObj.toString(); System.out.println("**** JSON **** "); System.out.println(json + "----------" + this.response.getId()); ResultActions result = mvcController.perform(put("/package/" + this.response.getId()) .content(json) .contentType(MediaType.APPLICATION_JSON)) .andDo(print()) .andExpect(status().isOk()); updatedResponse = JsonUtil.&lt;SPackage&gt;convertJsonToObject( result.andReturn().getResponse().getContentAsString(), SPackage.class); } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception" + e); } } and here my controller method @RequestMapping(value = "/package/{id}", method = RequestMethod.PUT) @ResponseStatus(HttpStatus.OK) @ResponseBody public SPackage updatePackage(@PathVariable String id, @RequestBody JSONObject sPackage) { if (sPackage == null) { throw new BadRequestException("Given package is null"); } return softwarePackageService.updatePackage(id,sPackage); } I am using Spring MVC Controller Mock
has comment: http://stackoverflow.com/comment/42515341
has comment: http://stackoverflow.com/comment/42515685
has title: Sending JSON object to Spring controller
has comment: http://stackoverflow.com/comment/42514989
has comment: http://stackoverflow.com/comment/42517055

http://stackoverflow.com/a/26940419
answers question: http://stackoverflow.com/q/26940368
has comment: http://stackoverflow.com/comment/42425022
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: There is a problem in your loop: for(int j = i+1; j &lt; i; j++){ if(list.get(i) &gt; list.get(j)) { int big = list.get(i); int small = list.get(j); list.set(i, small); list.set(j, big); } i+1 is always > i so your loop won't work
score: 3
has comment: http://stackoverflow.com/comment/42425964
accepted answer of: http://stackoverflow.com/q/26940368
upvote count: 3

http://stackoverflow.com/comment/42286599
score: 0
has text: That fixed it thank you! but what difference do the '\' make?
type: Comment
comment on: http://stackoverflow.com/a/26863452
type: AnswerComment

http://stackoverflow.com/q/26892480
has comment: http://stackoverflow.com/comment/42344984
tagged with: java
score: 10
upvote count: 10
has comment: http://stackoverflow.com/comment/42386544
has answer: http://stackoverflow.com/a/26895171
answer count: 1
downvote count: 0
favorite count: 0
tagged with: rest
has title: What is the proper media-type for HAL+JSON?
tagged with: spring
has body: I'm using Spring to create a RESTful service and I'm curious about the syntax for media-types. From my understanding, the general media-type for HAL+JSON is application/hal+json. Also, from my understanding, a vendor-specific custom media-type that supports HAL+JSON would be something like application/vnd.api.entity.hal+json. However, I have also seen application/vnd.api.entity+hal+json. Which one is correct? Also, what would the correct wild-card type be for HAL+JSON? Would it be application/*.hal+json or application/*+hal+json. Links to any pertinent RFC's would be appreciated. Thanks!
accepted answer: http://stackoverflow.com/a/26895171
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42379203
tagged with: media-type
has comment: http://stackoverflow.com/comment/42381350
tagged with: http
type: Question

http://stackoverflow.com/a/26963416
has body: The Javadoc of Thead.State.TIMED_WAITING reads: 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 And indeed, the following test program prints TIMED_WAITING: public class Test { public static void main(String[] args) throws Exception { Thread t = new Thread() { public void run() { try { Thread.sleep(10000); } catch (InterruptedException e) { e.printStackTrace(); } }; }; t.start(); Thread.sleep(100); // make sure the other thread has started System.out.println(t.getState()); } }
has comment: http://stackoverflow.com/comment/42464805
accepted answer of: http://stackoverflow.com/q/26963361
type: Answer
answers question: http://stackoverflow.com/q/26963361
has comment: http://stackoverflow.com/comment/75400530
score: 10
upvote count: 10
type: AcceptedAnswer
downvote count: 0

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/26913426
tags question: http://stackoverflow.com/q/26838810
tags question: http://stackoverflow.com/q/26849190

http://stackoverflow.com/a/26856160
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26856148
has comment: http://stackoverflow.com/comment/42274388
has body: As per the java.util.Formatter API: For the floating-point conversions 'a', 'A', 'e', 'E', and 'f' the precision is the number of digits after the radix point. If the conversion is 'g' or 'G', then the precision is the total number of digits in the resulting magnitude after rounding. So printf (which uses the Formatter behind the scenes) rounds and has always rounded.
type: Answer
accepted answer of: http://stackoverflow.com/q/26856148
has comment: http://stackoverflow.com/comment/122127556

http://stackoverflow.com/q/26856487
has answer: http://stackoverflow.com/a/39797947
tagged with: java
upvote count: 59
has answer: http://stackoverflow.com/a/31882623
downvote count: 1
tagged with: android-5.0-lollipop
tagged with: android-recyclerview
type: Question
has answer: http://stackoverflow.com/a/26905442
has title: Recyclerview painfully slow to load cached images form Picasso
has answer: http://stackoverflow.com/a/59891830
has answer: http://stackoverflow.com/a/55115394
has answer: http://stackoverflow.com/a/36919009
has answer: http://stackoverflow.com/a/34683402
has comment: http://stackoverflow.com/comment/60644942
has body: I have implemented a RecyclerView that contains mainly images which is loading in through Picasso. My problem is that as soon as I scroll down or up the view, the placeholder image appears for approx. a second before it is replaced by the actual image. It scrolls very smoothly, but is practically unusable. This happens every time something scrolls off the screen. Picasso is clearly caching the images to the disk, as they load faster than the initial load time, but they are definitely instantly reloading from the cache. What did i implement incorrectly? My adapter code: public class ExploreAdapter extends RecyclerView.Adapter&lt;ExploreAdapter.ExploreViewHolder&gt; { private List&lt;ExploreItem&gt; exploreItemList; private Context mContext; private int deviceWidth = PrefUtils.getDeviceWidth(); public ExploreAdapter(Context context, List&lt;ExploreItem&gt; exploreItemList){ this.mContext = context; this.exploreItemList = exploreItemList; } @Override public int getItemCount(){ return exploreItemList.size(); } @Override public void onBindViewHolder(ExploreViewHolder exploreViewHolder, int i){ ExploreItem item = exploreItemList.get(i); exploreViewHolder.getvTitle().setText(item.getTitle()); exploreViewHolder.getvUsername().setText(item.getUsername()); exploreViewHolder.getvNumLikes().setText(item.getNbOfLikes()); Picasso.with(mContext).load(item.getMediaLocation().trim()) .resize(deviceWidth, deviceWidth) .centerCrop() .placeholder(R.drawable.profile_background) .into(exploreViewHolder.getvImage()); Picasso.with(mContext).load(item.getUserProfilePicUrl().trim()) .placeholder(R.drawable.profile_picture) .into(exploreViewHolder.getvProfilePic()); } @Override public ExploreViewHolder onCreateViewHolder(ViewGroup viewGroup, int i){ View itemView = LayoutInflater. from(viewGroup.getContext()). inflate(R.layout.explore_item, viewGroup, false); return new ExploreViewHolder(itemView); } public static class ExploreViewHolder extends RecyclerView.ViewHolder{ private TextView vTitl…
tagged with: picasso
linked to: http://stackoverflow.com/q/20090265
favorite count: 0
has answer: http://stackoverflow.com/a/29702557
answer count: 9
has answer: http://stackoverflow.com/a/39463177
type: UnansweredQuestion
score: 58
tagged with: android

http://stackoverflow.com/q/26907712
has comment: http://stackoverflow.com/comment/42365915
tagged with: ssl
type: UnansweredQuestion
tagged with: nest-api
has title: Nest authentication unstable
has body: I used the auth(token, new Firebase.AuthListener()) function of firebase to authentication and access data, and I found that it sometimes spend long time(more than 5 minutes) to finished authentication. But this situation does not happened few month ago. The Firebase library I downloaded from https://developer.nest.com/documentation/cloud/firebase-client-libraries , so my firebase library version is 1.1.1. Had anyone happen this kind of situation? I had try to use authWithCustomToken(...) to replace the auth(...), but it not work. How do I used this function to authentication in nest? And I found that the firebase added SSL to their protocol, is it the reson that caused above situation? I download a firebase.js from https://www.firebase.com/blog/2012-07-27-firebase-now-supports-ssl.html , but I don't know how to use this file to create a *.crt or *.cer file, does anyone can help me? /******************************* Update ***********************************/ The following are sample code as follow: access_token I already get from nest via http request, String Access_Token_URL = "https://api.home.nest.com/oauth2/access_token"; URL u = new URL(Access_Token_URL); HttpURLConnection conn = (HttpURLConnection) u.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestMethod("POST"); String cmd = "code="+pincode+"&amp;client_id=" + Client_ID + "&amp;client_secret="+ Client_secret +"&amp;grant_type=authorization_code"; DataOutputStream wr = new DataOutputStream(conn.getOutputStream()); wr.writeBytes(cmd); wr.flush(); wr.close(); // flush and close BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = reader.readLine()) != null){ //do something } reader.close(); JSONObject stock_data = new JSONObject(line); access_token = stock_data.getString("access_token"); //access_token="c.W6o3HEpUe3a.........."; and I use the access_token in auth() function, String DataBase_URL = "https://developer-a…
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/42369304
tagged with: android
tagged with: firebase
score: 0
tagged with: java

http://stackoverflow.com/a/26953865
accepted answer of: http://stackoverflow.com/q/26953810
answers question: http://stackoverflow.com/q/26953810
type: AcceptedAnswer
score: 0
has body: Code compilation isn't too dangerous because the only program that is running is the compiler. What you should worry about is the actual running of their compiled Java program. If you haven't already, look into SecurityManager. Basically, you'll want to make your own class extending SecurityManager and then override all those methods. If the program shouldn't be able to do something, you throw a SecurityException. That's pretty much the easiest way to sandbox something in Java. Once you do that, you simply call System.setSecurityManager(mySecurityManager);
type: Answer

http://stackoverflow.com/comment/42279248
type: AnswerComment
comment on: http://stackoverflow.com/a/26857709
score: 0
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64679/discussion-between-tylerlee12-and-chaitanya).

http://stackoverflow.com/comment/42319765
score: 0
comment on: http://stackoverflow.com/q/26881944
has text: what do mean for stopped working?
type: Comment
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/26894230
tags question: http://stackoverflow.com/q/26960027
tags question: http://stackoverflow.com/q/26857085
tags question: http://stackoverflow.com/q/26949228
tag name: eclipse
tags question: http://stackoverflow.com/q/26900823
tags question: http://stackoverflow.com/q/26845885
tags question: http://stackoverflow.com/q/26876383
tags question: http://stackoverflow.com/q/26980008
tags question: http://stackoverflow.com/q/26974998
tags question: http://stackoverflow.com/q/26880269
tags question: http://stackoverflow.com/q/26868927
tags question: http://stackoverflow.com/q/26888406
tags question: http://stackoverflow.com/q/26979349
tags question: http://stackoverflow.com/q/26921046
tags question: http://stackoverflow.com/q/26861258
tags question: http://stackoverflow.com/q/26902051
tags question: http://stackoverflow.com/q/26958350
tags question: http://stackoverflow.com/q/26836461
tags question: http://stackoverflow.com/q/26868848
tags question: http://stackoverflow.com/q/26837850
tags question: http://stackoverflow.com/q/26974478
tags question: http://stackoverflow.com/q/26899528
tags question: http://stackoverflow.com/q/26961529
tags question: http://stackoverflow.com/q/26963503
tags question: http://stackoverflow.com/q/26880220
tags question: http://stackoverflow.com/q/26945246
tags question: http://stackoverflow.com/q/26942635
tags question: http://stackoverflow.com/q/26960680
tags question: http://stackoverflow.com/q/26886603
tags question: http://stackoverflow.com/q/26836426
tags question: http://stackoverflow.com/q/26843567
tags question: http://stackoverflow.com/q/26889530
tags question: http://stackoverflow.com/q/26899387
tags question: http://stackoverflow.com/q/26935722
tags question: http://stackoverflow.com/q/26937733
tags question: http://stackoverflow.com/q/26883090
tags question: http://stackoverflow.com/q/26945696
tags question: http://stackoverflow.com/q/26984234
tags question: http://stackoverflow.com/q/26974313
tags question: http://stackoverflow.com/q/26895274
tags question: http://stackoverflow.com/q/26899224
tags question: http://stackoverflow.com/q/26838219
tags question: http://stackoverflow.com/q/26870542
tags question: http://stackoverflow.com/q/26848719
tags question: http://stackoverflow.com/q/26963710
tags question: http://stackoverflow.com/q/26897911
tags question: http://stackoverflow.com/q/26948642
tags question: http://stackoverflow.com/q/26880504
tags question: http://stackoverflow.com/q/26882588
tags question: http://stackoverflow.com/q/26953803
tags question: http://stackoverflow.com/q/26915518
tags question: http://stackoverflow.com/q/26894869
tags question: http://stackoverflow.com/q/26971549
tags question: http://stackoverflow.com/q/26946284
tags question: http://stackoverflow.com/q/26969906
tags question: http://stackoverflow.com/q/26837202
tags question: http://stackoverflow.com/q/26982823
tags question: http://stackoverflow.com/q/26881828
tags question: http://stackoverflow.com/q/26966910
tags question: http://stackoverflow.com/q/26981713
tags question: http://stackoverflow.com/q/26919640
tags question: http://stackoverflow.com/q/26908168
tags question: http://stackoverflow.com/q/26954910
tags question: http://stackoverflow.com/q/26895036
tags question: http://stackoverflow.com/q/26847073
tags question: http://stackoverflow.com/q/26927425
tags question: http://stackoverflow.com/q/26949896
tags question: http://stackoverflow.com/q/26972729
tags question: http://stackoverflow.com/q/26897543
tags question: http://stackoverflow.com/q/26974558
tags question: http://stackoverflow.com/q/26875107
tags question: http://stackoverflow.com/q/26958954
tags question: http://stackoverflow.com/q/26945429
tags question: http://stackoverflow.com/q/26968414
tags question: http://stackoverflow.com/q/26836240
tags question: http://stackoverflow.com/q/26980477
tags question: http://stackoverflow.com/q/26955800
tags question: http://stackoverflow.com/q/26929694
tags question: http://stackoverflow.com/q/26921761

http://stackoverflow.com/a/26970140
has body: I've figured out the solution already. You could simply use .setRating(int) and it should be highlighted in default blue color
answers question: http://stackoverflow.com/q/26968863
score: 0
type: Answer

http://stackoverflow.com/q/26960729
has answer: http://stackoverflow.com/a/26995796
accepted answer: http://stackoverflow.com/a/26995796
has body: I'm trying to sign a Doc with POI OOXML in a maven project as mentioned here https://poi.apache.org/apidocs/org/apache/poi/poifs/crypt/dsig/SignatureInfo.html public boolean verify(InputStream inputStream) { OPCPackage pkg = OPCPackage.open(inputStream); SignatureConfig sic = new SignatureConfig(); sic.setOpcPackage(pkg); SignatureInfo si = new SignatureInfo(); si.setSignatureConfig(sic); boolean isValid = si.validate(); return isValid; } my POM file: <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 com.me docx-signer 0.0.1-SNAPSHOT jar docx-signer http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 3.8.1 test org.apache.poi poi-ooxml 3.10.1 org.bouncycastle bcprov-jdk15on 1.51 org.bouncycastle bcpkix-jdk15on 1.51 org.slf4j slf4j-api 1.7.7 org.apache.santuario xmlsec 2.0.1 I could not resolve this class org.apache.poi.poifs.crypt.dsig.SignatureInfo While it's being in the documentation !! Any advice ? Thanks in advance.
score: 0
answer count: 1
tagged with: maven-3
has title: Could no resolve org.apache.poi.poifs.crypt.dsig.SignatureInfo class?
type: AnsweredQuestion
tagged with: openxml
tagged with: apache-poi
type: Question
tagged with: java

http://stackoverflow.com/comment/42237851
comment on: http://stackoverflow.com/a/26836002
has text: I guess some people like it though... http://www.yegor256.com/2014/10/26/hacker-vs-programmer-mentality.html
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42267958
type: QuestionComment
comment on: http://stackoverflow.com/q/26852699
score: 0
has text: what is the edame value parameter you pass the insert method?
type: Comment

http://stackoverflow.com/comment/42491804
score: 0
has text: @Asaf: so, it means that it's impossible to parse "DT31988159" to long?
type: QuestionComment
comment on: http://stackoverflow.com/q/26978507
type: Comment

http://stackoverflow.com/comment/42282341
type: AnswerComment
has text: You do not call it, the system calls it when it gets into a low memory state. However, `onLowMemory()` is not that reliable that it will be called. It's just a best effort method.
comment on: http://stackoverflow.com/a/26860900
type: Comment
score: 0

http://stackoverflow.com/comment/42467201
has text: Your question is quite unclear. What is inside your String[][]? A 2d list of students? And you just want to copy all of them in a HashSet?
comment on: http://stackoverflow.com/q/26964729
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/42321036
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26882328
type: AnswerComment
has text: This is actually not solving the initial question.

http://stackoverflow.com/q/26895661
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42344972
has body: I'm developing a java based application using NetBeans. What i want to do: My project folder includes a resources folder which contains all the Images that are needed by the project for basic stuff (setting background,icons etc). Now suppose end user wants to save an new Image on the run time. File Chooser opens up. User selects a source(.jpg) file and the image gets copied. What i want is, to save this image to my resources folder rather than on LocalDisk path. I'm having no trouble copying this image to a LocalDisk path. Is there any way through which i can do this? My resource folder path is: (ProjectName)\src\resources Code I'm using to save image to Local Address: InputStream input = null; OutputStream output = null; String fileName = itemId.getText(); try { input = new FileInputStream(srcPath.getText()); //Getting Source File Absolute Path Through FileChooser output = new FileOutputStream("C:\\Users\\BUN\\Documents\\Folder\\"+fileName+".jpg"); byte[] buf = new byte[1024]; int bytesRead; while((bytesRead = input.read(buf))&gt;0) { output.write(buf,0,bytesRead); } } catch(IOException ex) { ex.printStackTrace(); } Thank's in advance!
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42344832
has comment: http://stackoverflow.com/comment/42344901
has comment: http://stackoverflow.com/comment/42344926
score: 0
has title: How to import an Image to Project resource folder
has comment: http://stackoverflow.com/comment/42344756
tagged with: netbeans
answer count: 0

http://stackoverflow.com/comment/42530373
type: QuestionComment
has text: I guess @Durandal wanted to point out, that every hash-function has collisions. I guess what you want is a function where collisions are unlikely to happen for similar inputs.
score: 0
comment on: http://stackoverflow.com/q/26928529
type: Comment

http://stackoverflow.com/comment/42513932
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26990803
has text: Or make `test` property `public`.
score: 0

http://stackoverflow.com/comment/44721065
type: Comment
type: QuestionComment
has text: Well I am using the version that is before 2.0, and I am using the openshift deploy generator from the jhipster guide.
score: 0
comment on: http://stackoverflow.com/q/26873121

http://stackoverflow.com/comment/42503884
comment on: http://stackoverflow.com/a/26985163
type: AnswerComment
type: Comment
has text: Although this works, be warned that `instanceof` should be a last resort, since it will lead to code that is hard to maintain. It is usually possible to use method overriding to produce the desired results; see @srakvin's `toString()` suggestion.
score: 1

http://stackoverflow.com/q/26968305
has answer: http://stackoverflow.com/a/26968424
tagged with: http
type: Question
tagged with: network-programming
has body: I want to write a test to test my service which uses HttpClient to send GET request service.logger.info("Testing GET request with param= " + "test"); service.logger.info(service.getSuggestions(searchTerms1)); service.logger.info("Testing GET request with param= " + "weibo"); service.logger.info(service.getSuggestions(searchTerms2)); When I am running this in my company's network, it does not work since it uses proxy. I don't want to change my existing code of my service, so I hope to find a way to change set proxy outside, and my HTTP client will send request using this proxy. Is there a way to do that? I am using eclipse. Below is how I send request to get result from network. private final String getResultFromURL(String url) throws ClientProtocolException, IOException { RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(1 * 1000).build(); HttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build(); HttpGet request = new HttpGet(url); // add request header request.addHeader("User-Agent", USER_AGENT_MOZILLIA); HttpResponse response = client.execute(request); StringBuffer result = new StringBuffer(); try(BufferedReader rd = new BufferedReader( new InputStreamReader(response.getEntity().getContent()))){ String line = ""; while ((line = rd.readLine()) != null) { result.append(line); } } finally{ request.releaseConnection(); EntityUtils.consume(response.getEntity()); } logger.debug("----result from URL:"+url +" "+result); return result.toString(); }
tagged with: proxy
score: 0
answer count: 2
tagged with: apache-httpclient-4.x
has title: Set static proxy for HttpClient
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26968416
tagged with: java

http://stackoverflow.com/q/26840911
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/57141397
has body: I'm having following Entity-Snipped @Entity public class EntityWithNaturalId extends BaseEntity { @NaturalId public String name; private EntityWithNaturalId() {} public EntityWithNaturalId(String name) { this.name = name; } } If I try to persist an entity with the same name twice I get following error (as expected): org.hibernate.exception.ConstraintViolationException: could not execute statement Eindeutiger Index oder Primärschlüssel verletzt: "_UNIQUEKEY_INDEX_6 ON PUBLIC.ENTITYWITHNATURALID(NAME) VALUES ('AA', 1)" Unique index or primary key violation: "_UNIQUEKEY_INDEX_6 ON PUBLIC.ENTITYWITHNATURALID(NAME) VALUES ('AA', 1)" What suprises me is that if I have a look at the table constraints in the database, I don't see anything. Shouldn't there be a unique constraint? Postgres 9.3.2 Hibernate 4.2.0 EDIT: this post before is missleading due to the fact that I reduced facts to simplify the situation. By doing this I made this post inconsistent!! @Vlad was right, but I realized that the problem lies somewhere else. What I missed to write is that there are several other entities which use @NaturalId. Hibernate tries to create all constrains with name _UNIQUEKEY. (Prefix is missing) Only first one is really created. All other ones throw this exception: 2014-11-10 13:18:10 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - HHH000389: Unsuccessful: alter table AnotherEntityWithNaturalId add constraint _UniqueKey unique (pid) 2014-11-10 13:18:10 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - ERROR: relation "_uniquekey" already exists It seems to me that the unique key names are not build correctly, probably a bug?
has title: Why doesn't @NaturalId create a unique constraint in the database?
favorite count: 0
tagged with: postgresql
has answer: http://stackoverflow.com/a/26841482
score: 2
upvote count: 2
tagged with: natural-key
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/26903751
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/26892729
tagged with: jms
has body: I am trying to access a jms queue configured on Websphere Application Server 8. But I am getting java.lang.NoClassDefFoundError: com.ibm.ws.naming.util.CommonHelpers Exception. Can anyone suggest a solution? Does any jar file needs to be added? I have already added - com.ibm.ws.messagingClient.jar com.ibm.ws.sib.client_ExpeditorDRE_8.0.0.jar com.ibm.ws.sib.client.thin.jms_8.0.0.jar com.ibm.xml.thinclient_8.0.0.jar in classpath. You can find the code at How to set Context.INITIAL_CONTEXT_FACTORY? NoInitialContextException? package com.jms.test; import java.util.Hashtable; import javax.jms.Queue; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; public class Demo { public static void main(String[] args) throws NamingException { System.out.println("Start....."); Hashtable environment = new Hashtable(); environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); environment.put(Context.PROVIDER_URL, "iiop://localhost:2810"); //String pUrl = System.getProperty(Context.PROVIDER_URL); //System.out.println("*******"+pUrl+"********"); InitialContext ctx = new InitialContext(environment); Queue queue = (Queue) ctx.lookup("jms/inQueue"); System.out.println("*** Queue is *** "+queue.toString()); }} Exception Stack Trace - Exception in thread "main" java.lang.NoClassDefFoundError: com.ibm.ws.naming.util.CommonHelpers at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(Unknown Source) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:230) at javax.naming.InitialContext.initializeDefaultInitCtx(InitialContext.java:313) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:343) at javax.naming.InitialContext.internalInit(InitialContext.java:281) at javax.naming.InitialContext.&lt;init&gt;(InitialContext.java:206) at com.jms.test.Demo.main(Demo.java:16) Caused by: java.lang.ClassNotFoundException: com.ibm.ws.naming.util.CommonHelpers a…
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: jakarta-ee
has title: java.lang.NoClassDefFoundError: com.ibm.ws.naming.util.CommonHelpers
tagged with: jndi
has answer: http://stackoverflow.com/a/26904610
tagged with: websphere-8
accepted answer: http://stackoverflow.com/a/26904610

http://stackoverflow.com/q/26893725
answer count: 0
tagged with: java
type: Question
tagged with: database
has body: I have this java program that reads values from a database, and uses those values in each table for creating a schedule. I do not have a server accessible, so the database will have to be moved around from computer to computer when the program is moved. It will have about 200 tables, each one with a time, number, title, and description. I have tried using Microsoft Access, but Java 8 just changed some setting so that the program cannot link the Access database, even though there used to be a simple way to do this. I know about Java DB, but to my knowledge it needs a server to host the database on, same with SQL, and I do not have one to use. My question is, which program can I use to create a client-side database that can be linked with a java program, without breaking off an arm and a leg. Thank You for any suggestions.
score: 0
has comment: http://stackoverflow.com/comment/42341295
has comment: http://stackoverflow.com/comment/42341109
has comment: http://stackoverflow.com/comment/42342018
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42341522
has comment: http://stackoverflow.com/comment/42341265
has comment: http://stackoverflow.com/comment/42342170
has title: Database linked with Java program without server
has comment: http://stackoverflow.com/comment/42341831

http://stackoverflow.com/comment/42370810
has text: I meant _object level constraints_ (http://beanvalidation.org/1.0/spec/#constraintdeclarationvalidationprocess-requirements-object).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26910098
score: 0

http://stackoverflow.com/comment/42379750
type: AnswerComment
has text: This fixes the compile error, but doesn't fix the code logic.
type: Comment
comment on: http://stackoverflow.com/a/26915517
score: 0

http://stackoverflow.com/q/26952022
tagged with: identifier
type: UnansweredQuestion
upvote count: 1
duplicate of: http://stackoverflow.com/q/10559539
answer count: 0
score: 1
tagged with: java
has body: I've googled until I'm cross-eyed, but I guess this is a pretty generic error. I keep simplifying my code to try to narrow it down. class ListMaker { public int testMe() { return 0; } } class Examples { Examples() {}; int testInt; testInt = ListMaker.testMe(); &lt;--- compiler error: &lt;identifier&gt; expected }
has comment: http://stackoverflow.com/comment/42444757
type: Question
has title: Java beginner baffled by "<identifier> expected" error
has comment: http://stackoverflow.com/comment/42444698
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42444954
has comment: http://stackoverflow.com/comment/42445066
linked to: http://stackoverflow.com/q/10559539

http://stackoverflow.com/comment/76899937
score: 0
type: Comment
has text: Should you not explain why? A block of code without explanation is not entirely useful by itself. Especially on an old answer where the original poster is not likely to respond.
comment on: http://stackoverflow.com/a/44962122
type: AnswerComment

http://stackoverflow.com/q/26984962
score: -1
tagged with: java
downvote count: 2
upvote count: 1
tagged with: methods
answer count: 1
has title: trouble with yahtzee in java
has answer: http://stackoverflow.com/a/26985159
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42503536
has body: I'm having a very hard time creating this game. If someone could please help me create or give me an idea how to check for fullhouse, smallstraight, large straight, 4 of kind &amp; 3 of kind. Scanner keyboard = new Scanner(System.in); rollDice(); for (int i = 0; i &lt; NUM_ROLLS_; i++) { if (gotYatzee()) { break; } System.out.println(diceToString()); System.out.println("Do you want to roll the dice again? Yes or No"); int a = 0; String yes = "Yes"; String userInput; userInput = keyboard.next(); if (userInput.equals(yes)) { System.out.println("ALRIGHT"); secondReroll(convert(keyboard.nextLine())); } } System.out.println("Which dice do you want to roll again: "); System.out.println(diceToString()); if (gotYatzee()) { System.out.println("You got Yatzee &amp; 50 points!"); } else { System.out.println("SORRY"); } } public static void rollDice() { for (int i = 0; i &lt; NUM_OF_DICE; i++) { dice[i] = randomValue(); } } public static int randomValue() { return (int) (Math.random() * 6 + 1); } public static String diceToString() { String dado = "Here are your dice: "; for (int element : dice) { dado = dado + element + " "; } return dado; } public static boolean gotYatzee() { for (int element : dice) { if (element != dice[0]) { return false; } } return true; } public static void secondReroll(int[] newValue) { for (int element : newValue) { dice[element - 1] = randomValue(); } } public static int[] convert(String s) { StringTokenizer st = new StringTokenizer(s); int[] a = new int[st.countTokens()]; int i = 0; while (st.hasMoreTokens()) { a[i++] = Integer.parseInt(st.nextToken()); } return a; } public static boolean Chance() { for (int element : dice) { int i = 0; if (element != dice[i]) { i++; return false; } } return true; } public static boolean smallStraight() { for (int i = 1; i &lt;= NUM_OF_DICE; i++) { boolean b = false; for (int j = 0; j &lt; NUM_OF_DICE; j++) { b = b || (dice[j] == i); } if (!b) { return false; } } return true; } } public static boolean LargeStraight (…
has comment: http://stackoverflow.com/comment/42503687
favorite count: 0
type: Question

http://stackoverflow.com/a/26898195
answers question: http://stackoverflow.com/q/26897173
score: 0
type: Answer
has body: You can also define your own listener(s) in your adapter with your post (or its id/position) for argument. For example: public interface OnPostClickListener { void onUserImageClick(Post post); void onUserNameClick(Post post); ... } private OnPostClickListener mListener; public void setOnPostClickListener(OnPostClickListener listener) { mListener = listener; } @Override public View getView(int position, View convertView, ViewGroup parent) { final Post post = getItem(position); ... holder.userImage.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { if(mListener != null) mListener.onUserImageClick(post); } }); holder.userName.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { if(mListener != null) mListener.onUserNameClick(post); } }); ... } And in your Activity: mAdapter.setOnPostClickListener(new OnPostClickListener(){ @Override public void onUserImageClick(Post post) { // Do something } @Override public void onUserNameClick(Post post) { // Do something } });

http://stackoverflow.com/comment/42511682
comment on: http://stackoverflow.com/a/26990041
has text: Hello Shazin, Thank you for your answer, as you can see I tried to encode the image using Base64Encoder, but String image = "data:image/png;base64," + Base64Encoder.encode(productBasic.getProductimage()); throws me a nullPointerException as getProductImage always returns null.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/42443504
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26951134
has text: The problem is not to use array or collections, but as out of the while loop.
score: 0

http://stackoverflow.com/comment/42315433
comment on: http://stackoverflow.com/q/26879030
has text: @MadProgrammer well that didn't solve my problem. How can I set the action to null or change it even if I have a reference? (Without creating a new ActionListener object that is ) I edited my question too
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26913482
tagged with: iteration
has body: I would like to make sure I understand for() loop in java. From java tutorials: for (initialization; termination; increment) { statement(s) } Docs says: "The increment expression is invoked after each iteration through the loop" int x = 10; for(int y=2;x!=1;x++){ System.out.print(x); x=x-y; //actual x++ operation? } //prints 10 9 8 7 6 5 4 3 2 is x incremented after System.out and x=x-y?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42376235
has answer: http://stackoverflow.com/a/26913561
type: Question
tagged with: java
score: 0
has title: for() statement instructions order
answer count: 2
tagged with: for-loop
has answer: http://stackoverflow.com/a/26913594

http://stackoverflow.com/comment/136319144
type: Comment
comment on: http://stackoverflow.com/a/26926871
type: AnswerComment
score: 0
has text: API documentation says "Feature is enabled by default."

http://stackoverflow.com/q/26889015
has answer: http://stackoverflow.com/a/26927262
upvote count: 2
linked to: http://stackoverflow.com/q/8757264
tagged with: java
tagged with: hibernate
answer count: 2
has title: Every time I think I fixed it, "Could not initialize a collection" error keeps coming back
has answer: http://stackoverflow.com/a/26891184
has comment: http://stackoverflow.com/comment/42332395
has comment: http://stackoverflow.com/comment/42332250
has comment: http://stackoverflow.com/comment/42333125
has comment: http://stackoverflow.com/comment/42332316
linked to: http://stackoverflow.com/q/15547025
has body: I have a table relationship similar to the one described in this question I tried the way they said they'd fixed it there. Got this could not initialize a collection error. I looked around and changed it to have a third entity and the two original classes having Set with OneToMany mapping to that entity as opposed to using Map and ManyToMany mapping. In case I'm just missing something stupid right in front of my face, here are my tables: create table email_distribution_templates ( id number primary key, from_address varchar2(50) not null, subject varchar2(250) not null, body varchar2(4000), send_time date, send_type varchar2(10), email_type varchar2(50), attachments_by varchar2(10), attachment_info varchar2(50), last_sent date, CONSTRAINT unique_email_subject UNIQUE (subject) ); create sequence distro_seq CACHE 50; create table email_distribution_addressees ( id number primary key, first_name varchar2(50), last_name varchar2(50), address varchar2(100) not null ); create sequence addressee_seq CACHE 50; create table addressees_for_distributions ( distro_id number not null references email_distribution_templates(id), addressee_id number not null references email_distribution_addressees(id), addressee_type varchar2(3) not null, constraint adrs_fr_dist primary key(distro_id, addressee_id) ); create sequence ad_fr_dst_seq CACHE 50; And here are their corresponding entities: @Entity @Table(name = "email_distribution_templates") @Cacheable @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) @SequenceGenerator(sequenceName = "distro_seq", name = "distro_seq", allocationSize = 1) @Configurable(autowire = Autowire.BY_TYPE) public class EmailDistributionTemplate implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "distro_seq") private long id; @OneToMany(fetch = FetchType.EAGER, mappedBy = "distro") private Set&lt;AddresseeForDistribution&gt; addresseeForDistribution = Sets.newHashSet();…
type: AnsweredQuestion
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/26891184
favorite count: 0
type: Question
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/42332486
tagged with: spring
possible better answer: http://stackoverflow.com/a/26927262

http://stackoverflow.com/q/26909521
has comment: http://stackoverflow.com/comment/51218489
has answer: http://stackoverflow.com/a/26909638
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26909832
has title: Try-catch statement inside while with nextInt, correct way to implement?
downvote count: 1
has comment: http://stackoverflow.com/comment/42368967
type: Question
has body: I'm trying to make up the most compact solution for reading an integer from a user using only nextInt() method and the exceptions it throws to exclude errors... This is the code i have for now: Scanner sn = new Scanner(System.in); boolean inputNotNull = true; while (inputNotNull) { try { int number = sn.nextInt(); System.out.printf("The number %d is power of 2: %b\n", number, isPowerOfTwo(number)); if (number == 0) { inputNotNull = false; } } catch(InputMismatchException e) { System.err.println("Wrong input! Input only integer numbers please..."); } } So, what this is supposed to do is wait for an integer from a user. If the user enters 0 end the program. My idea was to try to exclude the scenario when the user enters something else than integer with use of InputMismatchException (I know it is not the best practice to catch RuntimeException). When the exception is raised an error message is printed, and the program returns to the while loop, asking again for the input as nothing happened. Approach that I am using here has a flaw that when the user enters something that is not an integer value, program prints out the error message repeatedly, looping on forever. How to avoid this? As a side question how would you solve this problem that I am trying to solve?
accepted answer: http://stackoverflow.com/a/26909638
linked to: http://stackoverflow.com/q/3572160
answer count: 3
possible better answer: http://stackoverflow.com/a/26909640
favorite count: 0
has answer: http://stackoverflow.com/a/26909640

http://stackoverflow.com/comment/42487589
comment on: http://stackoverflow.com/q/26976370
score: 0
type: Comment
type: QuestionComment
has text: there is no such thing as if and else loop

http://stackoverflow.com/a/26960238
has comment: http://stackoverflow.com/comment/42459041
downvote count: 0
has comment: http://stackoverflow.com/comment/42459100
has comment: http://stackoverflow.com/comment/42459113
has comment: http://stackoverflow.com/comment/42458891
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/26960158
has comment: http://stackoverflow.com/comment/42459205
has comment: http://stackoverflow.com/comment/42458861
score: 3
has body: If you just want to solve your main problem to generate a sequence of 10 distinct numbers between 1 and 100, use Java 8 and don't reinvent the wheel final Collection&lt;Integer&gt; intList = IntStream.rangeClosed(1, 100) // generate an infinite list of numbers between 1 and 100 .distinct() // avoid duplicates in that list .limit(10) // take only 10 numbers from that list .boxed() // cast them to Integer .collect(Collectors.toList()); // collect them in a Collection&lt;Integer&gt; If it should still be an array, then add this line: Integer[] intArray = intList.toArray(new Integer[intList.size()]); ADDITION If you want a solution, which is not as simple as the example above, but may be more easy to grasp, think about this: 1: Just generate a list with the numbers of 1 to 100, so there is each number just once. final List&lt;Integer&gt; baseIntegers = new ArrayList&lt;&gt;(100); for (int i = 0; i &lt; 100; i++) { baseIntegers.add(i + 1); // to get 1 to 100 } The second thing you should do is, shuffling the list, so you get a random order for them. Collections.shuffle(baseIntegers); The last step is to take just the amount of elements you need, in your case 10: final int numbersToExtract = 10; final int[] finalArray = new int[numbersToExtract]; for (int i = 0; i &lt; numbersToExtract; i++) { finalArray[i] = baseIntegers.get(i); }
has comment: http://stackoverflow.com/comment/42458982

http://stackoverflow.com/comment/42382591
has text: Are you really sure ? For me it works but takes a looooong time (20s on a I3 processor, almost 2 minutes in a VM ...)
comment on: http://stackoverflow.com/a/26912685
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42414069
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26934294
type: Comment
has text: If you want a taste of what this could look like in Scala: http://lpaste.net/114290 — as you can see, it's obvious what modifies the state and where; but that's just one way to do it. But in any case, your data types and much of the logic will look much more readable and concise in Scala (vs Java).

http://stackoverflow.com/comment/42495554
score: 0
type: QuestionComment
type: Comment
has text: @Jeroen how parsing will give an exception?
comment on: http://stackoverflow.com/q/26980427

http://stackoverflow.com/q/26959140
score: -1
tagged with: integer
has answer: http://stackoverflow.com/a/26959192
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42456839
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42479918
has comment: http://stackoverflow.com/comment/42457191
has title: returning a string as an integer java
has body: I am trying to return a string of names in a list as an integer, the names are pulled from a longer list. i have managed to get the list of names needed but cannot figure out how to convert the string into an integer. see code below: public static void doStuff(List&lt;Seat&gt; uk){ for(Seat s:uk) if (s.place.contains("Edinburgh")) System.out.println(s.results); This is where i get stuck does anyone have any advise on how to solve this?
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42464676
tagged with: string
has answer: http://stackoverflow.com/a/26959160
favorite count: 0
has comment: http://stackoverflow.com/comment/42460354
has comment: http://stackoverflow.com/comment/42459293
has comment: http://stackoverflow.com/comment/42456922
has comment: http://stackoverflow.com/comment/42458245

http://stackoverflow.com/q/26959439
upvote count: 0
favorite count: 0
has title: How to use the current time in a Java Program?
score: -1
type: AnsweredQuestion
tagged with: timer
has comment: http://stackoverflow.com/comment/42458867
tagged with: time
has answer: http://stackoverflow.com/a/26959911
downvote count: 1
type: Question
has body: Say, for example, I want to run the following program double x = 15.6 System.out.println(x); But I wanted to repeat the program until a certain time has elapsed, such as the following: do{ double x = 15.6 System.out.println(x); }while (current time is earlier than 12.00pm) Even though the example is completely hypothetical, how would I make that do while loop so that the program would keep running over and over again until a certain time, say 3pm, or9.30pm. If this is not possible, is there any way I can simulate this, by running the program every so many seconds, until that time has been reached?
has answer: http://stackoverflow.com/a/26959678
tagged with: job-scheduling
has comment: http://stackoverflow.com/comment/42457857
linked to: http://stackoverflow.com/q/4044726
tagged with: java
possible better answer: http://stackoverflow.com/a/26959678
linked to: http://stackoverflow.com/q/503877
answer count: 2
tagged with: scheduling
accepted answer: http://stackoverflow.com/a/26959911

http://stackoverflow.com/q/26971805
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42479383
tagged with: jdbc
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/26971850
type: Question
linked to: http://stackoverflow.com/q/218384
accepted answer: http://stackoverflow.com/a/26971832
has body: I am getting null pointer exception again and again while getting value from database table.....why its giving me null pointer exception? Here is my code : private HashSet getPlayerList() { HashSet hs = new HashSet(); String soccername = ""; try { conn = ConnectionProvider.getConnection(); rs = null; pstmt = null; String sql = "Select * from Players where deleted = false"; if (conn != null) { pstmt = conn.prepareStatement(sql); rs = pstmt.executeQuery(); while (rs.next()) { soccername = rs.getString("soccername").trim();// this line giving exception if (soccername == null || soccername.isEmpty()) { soccername = rs.getString("name").trim(); } hs.add(soccername); } } } catch (NamingException ex) { System.out.println(ex); } catch (SQLException ex) { System.out.println(ex); } finally { try { pstmt.close(); rs.close(); conn.close(); } catch (SQLException ex) { System.out.println(ex); } } return hs; }
has answer: http://stackoverflow.com/a/26971832
answer count: 2
has title: How to deal with null value in table column in java?
downvote count: 0
has answer: http://stackoverflow.com/a/26971850
favorite count: 0

http://stackoverflow.com/comment/42355167
type: Comment
comment on: http://stackoverflow.com/a/26898570
has text: It seemed that your explanation made so much sense. Unfortunately I have the same results even after changing the name of my action method to `execute()`. By the way, I have a diagnostic message on my server console `Nov 13, 2014 10:08:49 AM net.sf.json.JSONObject _fromBean INFO: Property 'container' of class action.nonrest.WaterUsageAction has no read method. SKIPPED `. Might this help?
score: 0
type: AnswerComment

http://stackoverflow.com/q/26865092
upvote count: 1
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26865899
score: 0
answer count: 1
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
has body: I was having some problem with the AsyncTask in Android. So when the map on single tap, it will execute the method by passing an Event object as parameter in AsyncTask class to get the address based on coordinates X and Y: mMapView.setOnSingleTapListener(new OnSingleTapListener() { public void onSingleTap(float x, float y) { final Point point = mMapView.toMapPoint(x, y); eventModel.setEventX(String.valueOf(point.getX())); eventModel.setEventY(String.valueOf(point.getY())); new MyAsyncTask(new MyAsyncTask.OnRoutineFinished() { public void onFinish() { CreateEvent.createEventDialog(context, point.getX(), point.getY(), eventAddress); //this will be called after the task finishes } }).execute(eventModel); } }); new MyAsyncTask().execute(); } MyAsyncTask class public static class MyAsyncTask extends AsyncTask&lt;Event, Integer, Double&gt; { public interface OnRoutineFinished{ //interface void onFinish(); } private OnRoutineFinished mCallbacks; public MyAsyncTask(OnRoutineFinished callback){ //constructor with interface mCallbacks = callback; } public MyAsyncTask(){} //empty constructor to maintain compatibility @Override protected Double doInBackground(Event... params) { try { eventAddress = eventCtrl.getStreetAddressFromGeometry(eventModel.getEventX(), eventModel.getEventY()); eventCtrl.retrieveEventJSON(); if (params.length == 1) { eventCtrl.createEvent(params[0]); } } catch (JSONException e) { e.printStackTrace(); } return null; } protected void onPostExecute(Double result) { if(mCallbacks !=null) mCallbacks.onFinish(); //call interface on finish } protected void onProgressUpdate(Integer... progress) { } } After user single tap on map, a dialogue box will pop out to ask for user input: public static Event createEventDialog(final Context context, final double x, final double y, final String eventAddress) { AlertDialog.Builder AddDialog = new AlertDialog.Builder(context); AddDialog.setTitle("Add Event"); LayoutInflater li = (LayoutInflater) context .getSystemService(Con…
tagged with: android
has title: Multiple request in AsyncTask Android
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/26871147
has comment: http://stackoverflow.com/comment/42301517
favorite count: 0
has title: find the lowest age and print out the corresponding name in array from a file?
has answer: http://stackoverflow.com/a/26871420
possible better answer: http://stackoverflow.com/a/26871420
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26875164
tagged with: java
downvote count: 1
type: Question
answer count: 2
upvote count: 0
has body: I need help with the program that reads in names and ages from a file called Stuff.txt. I was able to Print both arrays, but I also need to find the lowest age and print out the corresponding name.My code is not working and I have no idea why? No loop or switch is necessary. My "stuff. txt" contains the following input so far: Sam 21 Ram 22 Hero 23 Here is what I have worked on so far: import java.io.*; import java.util.*; public class nameAge { public static void main(String[] args) throws FileNotFoundException { ArrayList&lt;String&gt; names = new ArrayList&lt;String&gt;(); ArrayList&lt;Integer&gt; ages = new ArrayList&lt;Integer&gt;(); Scanner inFile = new Scanner(new File("stuff.txt")); int i = 0; while (inFile.hasNextLine()) { String line = inFile.nextLine(); Scanner lineScanner = new Scanner(line); while(lineScanner.hasNext()){ names.add(lineScanner.next()); ages.add(lineScanner.nextInt()); } System.out.println(names); System.out.println(ages); } int idx = -1; int d= 100000; for( i = 0; i &lt; 3; i++) if(ages &lt; d) { d = ages[i]; idx = i; } System.out.println("Lowest age "+ ages[idx] + "Corresponding Name" + name[idx] ); } }
score: -1
accepted answer: http://stackoverflow.com/a/26875164

http://stackoverflow.com/comment/42244068
has text: Can you please share the code which invokes `processLoginForm()` method?
comment on: http://stackoverflow.com/a/26839491
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/26853398
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26853179
answers question: http://stackoverflow.com/q/26853179
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/42269945
has body: No. The ~ is expanded by the shell. In Java File.exists() is a method, you can use File.separatorChar and you can get a user's home folder with System property "user.home" like String outputFile = System.getProperty("user.home") + File.separatorChar + "picImg.jpg"; File outFile = new File(outputFile); if (outFile.exists()) Edit Also, as @StephenP notes below, you might also use File(File parent, String child) to construct the File File outFile = new File(System.getProperty("user.home"), "picImg.jpg"); if (outFile.exists())
downvote count: 0
score: 4

http://stackoverflow.com/q/26874795
has body: If my server has a single endpoint: Endpoint endpoint = Endpoint.publish("http://localhost:6789/webservice/library", new LibraryImpl()); The client can connect to it through LibraryImplService service = new LibraryImplService(); LibraryInterface library = service.getLibraryImplPort(); If I have multiple endpoints: Endpoint endpoint1 = Endpoint.publish("http://localhost:6789/webservice/library", new LibraryImpl()); Endpoint endpoint2 = Endpoint.publish("http://localhost:6799/webservice/library", new LibraryImpl()); Endpoint endpoint3 = Endpoint.publish("http://localhost:6809/webservice/library", new LibraryImpl()); How can I get my client connect to the proper URL? Instead of LibraryInterface library = service.getLibraryImplPort(); Could I simply use the known port number? For instance if I want to connect to the URL published by endpoint1, would this work? LibraryInterface library = 6789;
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26913379
tagged with: web-services
tagged with: java
type: Question
score: 0
answer count: 1
tagged with: wsdl
has title: WSDL multiple endpoints
tagged with: soap

http://stackoverflow.com/a/26926686
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26926609
downvote count: 0
has body: The bit pattern for -9 is not what you think it is. It's 11111111 11111111 11111111 11110111 Therefore, shifting it by one (not keeping or keeping the sign bit) : 01111111 11111111 11111111 11111011 // 2147483643 11111111 11111111 11111111 11111011 // -5
type: Answer
score: 3
answers question: http://stackoverflow.com/q/26926609

http://stackoverflow.com/comment/42267577
comment on: http://stackoverflow.com/q/26852400
score: 0
type: Comment
type: QuestionComment
has text: well there is your problem you are using Phonegap and not native java

http://stackoverflow.com/a/26876337
has comment: http://stackoverflow.com/comment/42310485
type: Answer
has body: Your method needs a return type - it should be public int makeDeposit(int amount) This is really part of the language and you should look it up rather than asking here...
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42310201
answers question: http://stackoverflow.com/q/26876303
downvote count: 0
has comment: http://stackoverflow.com/comment/42310202

http://stackoverflow.com/q/26963503
favorite count: 0
has answer: http://stackoverflow.com/a/26963685
has answer: http://stackoverflow.com/a/59839126
has title: Javadoc never showing in eclipse
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/59839126
type: Question
has body: Whenever I try to access the Javadoc for any class in Eclipse by hovering over a reference to it, it either says An exception occurred while getting the Javadoc or This element has no attached source and the Javadoc could not be found in the attached Javadoc. I've read through several solutions on StackOverflow and have tried them all including: Installing JDK and adding it as a library in my project. Verifying the source of Javadoc in rt.jar is the correct URL. When I click Validate on it it even says the location is likely valid. The weird thing is, if I click on View Javadoc in Browser it opens directly to the correct Javadoc.
has comment: http://stackoverflow.com/comment/42465083
score: 1
tagged with: java
tagged with: javadoc
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42465127
answer count: 2
upvote count: 1
accepted answer: http://stackoverflow.com/a/26963685

http://stackoverflow.com/comment/42443298
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26950912
has text: `Your features is empty.` Not really and filling that array is not necessary for this example. (repost due to evil typo)
type: AnswerComment

http://stackoverflow.com/q/26935310
type: Question
has body: I'm having trouble creating an encrypted string using AES/CBC/PKCS5Padding with a 128-bit key. I have code to decrypt an encrypted string. I have an example encrypted string from another system that decrypts successfully, but when I try to create my own encrypted string it is not padded properly for some reason. When I decrypt my encrypted string it only shows the characters after the 16 byte. All of the examples I find either assume the encryption happens first then decryption happens right after that with variables set during encryption or they are randomly generating a key, but in my case i want to use a known key. I am really stuck so any help would be greatly appreciated, thank you very much for your time and efforts! Example: Original Text: 01234567891234565 Encrypted: zmb16qyYrdoW6akBdcJv7DXCzlw0qU7A2ea5q4YQWUo= Key length: 16 Decrypted: 5 (this is the last digit in the Original Text String) Sample Code: package com.company.encrypt.tests; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class TestEncryptDecrypt { private static final String characterEncoding = "UTF-8"; private static final String cipherTransformation = "AES/CBC/PKCS5Padding"; private static final String aesEncryptionAlgorithm = "AES"; public static void main(String[] args) throws Exception { String key1 = "1234567812345678"; String text = "01234567891234565"; System.out.println("Original Text: " + text); String encrypted = encrypt(text, key1); System.out.println("Encrypted: " + encrypted); String decrypted = decrypt(encrypted, key1); System.out.println("Decrypted: " + decrypted); } public static String decrypt(String encryptedText, String…
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26935546
tagged with: aes
has comment: http://stackoverflow.com/comment/42415723
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42417007
tagged with: encryption
upvote count: 1
has comment: http://stackoverflow.com/comment/42416489
score: 1
tagged with: java
has title: AES-128 Encrypted String not properly padded

http://stackoverflow.com/comment/42267457
type: Comment
has text: Thank you so much! I really appreciate you taking the time to help me out! :D
comment on: http://stackoverflow.com/a/26852264
type: AnswerComment
score: 0

http://stackoverflow.com/a/26908602
answers question: http://stackoverflow.com/q/26908536
type: Answer
accepted answer of: http://stackoverflow.com/q/26908536
has comment: http://stackoverflow.com/comment/42369763
score: 0
has body: Yes. In Fragment you have getActivity(). From there you can use getIntent(). Edit so: First mistake - context = this; should be context = getActivity(); Second mistake - getIntent() should be getActivity().getIntent(); EDIT2: so you have a third mistake :D You need to return a View : return eventDetail; And also, you are not using eventModel anywhere.
has comment: http://stackoverflow.com/comment/42367875
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42367963
has comment: http://stackoverflow.com/comment/42367708
has comment: http://stackoverflow.com/comment/42367572

http://stackoverflow.com/q/26885510
has body: Hi I want to fetch data from database and display into JTable. How can I achieve this? Here is my table query for table: select id,name,father from employee Here is my code: public static void main( String[] str ) { String[] colName = new String[] { "Product Name" ,"Price" }; Object[][] products = new Object[][] { { "Galleta" ,"$80" }, { "Malta" ,"$40" }, { "Nestea" ,"$120" } }; JTable table = new JTable( products, colName ); JFrame frame = new JFrame( "Simple Table Example" ); // create scroll pane for wrapping the table and add // it to the frame frame.add( new JScrollPane( table ) ); frame.pack(); frame.setVisible( true ); }
tagged with: jtable
score: 0
has comment: http://stackoverflow.com/comment/42325925
answer count: 1
tagged with: resultset
has answer: http://stackoverflow.com/a/26885857
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26885857
tagged with: java
tagged with: mysql
tagged with: swing
type: Question
has title: How to retrieve data from database into JTable?

http://stackoverflow.com/comment/42338329
score: 0
type: Comment
type: QuestionComment
has text: @YvesDaoust They are redundant when the parent is `NULL`. There are encodings which use this fact.
comment on: http://stackoverflow.com/q/26891747

http://stackoverflow.com/q/26890661
tagged with: java
has title: acitivity_main.xml error: java.util.Locale.toLanguageTag()
has comment: http://stackoverflow.com/comment/42335438
type: Question
score: 0
has body: In the activity_main.xml page when i am trying to click on the imageview button and trying to bring it on the phone screen. it doesnt happen. moreover the phone screen has disappeared. I get the following error : java.util.Locale.toLanguageTag()Ljava/lang/String;
has comment: http://stackoverflow.com/comment/42335202
has comment: http://stackoverflow.com/comment/42337849
type: UnansweredQuestion
tagged with: android
tagged with: android-activity
answer count: 0
has comment: http://stackoverflow.com/comment/42336569

http://stackoverflow.com/comment/42433993
score: 0
type: Comment
type: QuestionComment
has text: Thinking about how to solve the problem is absolutely wrong.I think you should go through how multithreading works.The problem doesnt even require multithreading
comment on: http://stackoverflow.com/q/26945773

http://stackoverflow.com/a/26866453
score: 0
has comment: http://stackoverflow.com/comment/42319434
type: Answer
has body: Would you mind to try adding nillable="true". Like: &lt;element form="unqualified" name="Ext" type="tns:ExtAuth" nillable="true" minOccurs="0"/&gt;
answers question: http://stackoverflow.com/q/26866203

http://stackoverflow.com/comment/43330308
type: QuestionComment
comment on: http://stackoverflow.com/q/26958073
score: 1
has text: This looks like it was drawn in Visual Paradigm, but inheritance was marked as dependency, and implementation was marked as inheritance.. o_o
type: Comment

http://stackoverflow.com/q/26842959
has body: I have this piece of code which inserts records into the accounts table: String accNumber = jTextField5.getText(); String accName = jTextField4.getText(); String accAddress1 = jTextField3.getText(); String accAddress2 = jTextField2.getText(); String accCity = jTextField6.getText(); String accCounty = jTextField7.getText(); String accPostCode = jTextField9.getText(); String accContact = jTextField8.getText(); String query = "Insert into accounts (AccNo, name, address, address2, address3, City, County, PostCode, contact) values (?, ?, ?, ?, ?, ?, ?, ?, ?)"; try{ connect.pst = connect.con.prepareStatement(query); connect.pst.setString(1, accNumber); connect.pst.setString(2, accName); connect.pst.setString(3, accAddress1); connect.pst.setString(4, accAddress2); connect.pst.setString(5, null); connect.pst.setString(6, accCity); connect.pst.setString(7,accCounty); connect.pst.setString(8, accPostCode); connect.pst.setString(9, accContact); connect.pst.execute(); JOptionPane.showMessageDialog(null, "Saved"); }catch(Exception e){ JOptionPane.showMessageDialog(null, e); } This works just fine and inserts records into the accounts table. Next I have this piece of code which is meant to update the orderstable table which contains 6 fields; Order Number, AccNo, Incvoice Number, Description, Amount, VAT. The Order Number field has been set to auto increment The code: String accNumber = jTextField29.getText(); String invNo = jTextField20.getText(); String description = jTextField21.getText(); String vat = jTextField22.getText(); String amount = jTextField23.getText(); String query = "Insert into orderstable (Order Number, AccNo, Invoice Number, Description, Amount, VAT) values (?, ?, ?, ?, ?, ?)"; try{ connect.pst = connect.con.prepareStatement(query); connect.pst.setString(1, "3"); connect.pst.setString(2, accNumber); connect.pst.setString(3, invNo); connect.pst.setString(4, description); connect.pst.setString(5, amount); connect.pst.setString(6, vat); connect.pst.execute(); JOp…
tagged with: java
has answer: http://stackoverflow.com/a/26843006
tagged with: syntax-error
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26843180
type: Question
has answer: http://stackoverflow.com/a/26843180
has title: MySQL Query Through Java Syntax Error
score: 0
answer count: 2
tagged with: mysql
has comment: http://stackoverflow.com/comment/42249406
has comment: http://stackoverflow.com/comment/42249606
accepted answer: http://stackoverflow.com/a/26843006

http://stackoverflow.com/a/26882035
downvote count: 0
answers question: http://stackoverflow.com/q/26881727
accepted answer of: http://stackoverflow.com/q/26881727
type: Answer
has body: I think first map should contain name as key and city as value instead of list of city. With this assumption below code will work Map&lt;String, ArrayList&lt;String&gt;&gt; nameGameListMap= new HashMap&lt;String, ArrayList&lt;String&gt;&gt;(); Iterator&lt;String&gt; it = name.keySet().iterator(); while(it.hasNext()) { String name = it.next(); String city = name.get(name); if(games.containsKey(city)) { nameGameListMap.put(name, games.get(city)); } }
upvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42524769
comment on: http://stackoverflow.com/q/26973754
type: QuestionComment
has text: I still don't know what it means to store a WebSphere shared library path in Java code, but I've added an answer involving WebSphere variables that hopefully helps.
score: 0
type: Comment

http://stackoverflow.com/comment/42459515
has text: I might just be understanding this poorly, but if I set it to something like serif it'll change the font to serif. It doesn't work if I set it to appleII or PrintChar21, though.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26960476
score: 0

http://stackoverflow.com/comment/42358385
comment on: http://stackoverflow.com/a/26903402
type: AnswerComment
has text: I suggest you delete this answer then, as it *implies* that `getList()` will be called multiple times.
type: Comment
score: 0

http://stackoverflow.com/q/26873105
type: Question
has comment: http://stackoverflow.com/comment/42304621
has body: I have two LinkedList and need to compare both and put into the ArrayList "nuevo1" the items in the ArrayList "viejo1" that not exist in the "nuevo1". Example: viejo1 = {a1,a2,a3} ; nuevo1 = {b1,b2,b3}; Output = nuevo1 = {b1,b2,b3,a1,a2,a3}; I use this but unfortunately doesn't work: import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.LinkedList; public class Test{ LinkedList &lt;String&gt; nuevo1 = new LinkedList &lt;&gt; (); LinkedList &lt;String&gt; viejo1 = new LinkedList &lt;&gt; (); public void copiarNuevo(){ File nuevo = new File("/home/hellraiser/NetBeansProjects/new.html"); try{ FileReader frNuevo = new FileReader(nuevo); BufferedReader brNuevo = new BufferedReader(frNuevo); String lineaNuevo; while ((lineaNuevo = brNuevo.readLine()) != null) { nuevo1.add(lineaNuevo); System.out.println(nuevo1); }brNuevo.close(); }catch(IOException e){System.out.println("Error -- "+e.toString());} } public void copiarViejo(){ File viejo = new File("/home/hellraiser/NetBeansProjects/old.html"); try{ FileReader frViejo = new FileReader(viejo); BufferedReader brViejo = new BufferedReader(frViejo); String lineaViejo; while ((lineaViejo = brViejo.readLine()) != null) { viejo1.add(lineaViejo); }brViejo.close(); }catch(IOException e){System.out.println("Error -- "+e.toString());} } public void compararArrays(){ for(int i=0;i&lt;viejo1.size()-1;i++){ for(int j=0;j&lt;nuevo1.size()-1;j++){ if(viejo1.get(i).equals(nuevo1.get(j))){ nuevo1.addLast(viejo1.get(i)); System.out.println(viejo1.get(i)); } } } } public static void main(String[] args) { Test test = new Test(); test.copiarNuevo(); test.copiarViejo();`enter code here` test.compararArrays(); } }
has comment: http://stackoverflow.com/comment/42304860
has answer: http://stackoverflow.com/a/26873446
has comment: http://stackoverflow.com/comment/42304624
has comment: http://stackoverflow.com/comment/42305532
score: 0
has comment: http://stackoverflow.com/comment/42304988
has comment: http://stackoverflow.com/comment/42304723
has comment: http://stackoverflow.com/comment/42304756
has comment: http://stackoverflow.com/comment/42304587
has answer: http://stackoverflow.com/a/26873715
has answer: http://stackoverflow.com/a/26873474
type: UnansweredQuestion
answer count: 4
has comment: http://stackoverflow.com/comment/42305070
has comment: http://stackoverflow.com/comment/42304846
tagged with: java
has answer: http://stackoverflow.com/a/26873723
has title: How I can to compare two strings and store the different items in Java?
has comment: http://stackoverflow.com/comment/42304379

http://stackoverflow.com/q/26966303
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42469735
type: Question
tagged with: object
tagged with: clone
linked to: http://stackoverflow.com/q/5802118
has answer: http://stackoverflow.com/a/26966368
has body: when i am creating new object of Particular class using new keyword it occupies some memory in heap For example i have class Xyz and i am creating object of Xyz using new keyword and it occupies some memory in heap Xyz xyz = new Xyz(); now assume that xyz have memory location 12@FFD same object create using clone method Xyz xyzClone =(Xyz) super.clone() my question is if xyzClone occupies different memory in heap than xyz than why we need clone method we can achieve same behavior using new keyword ??? and if xyzClone occupies no extra memory than it may be behave like Singleton Please clear my confusion why we need clone method ???
score: 0
answer count: 3
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42469768
has answer: http://stackoverflow.com/a/26966321
has comment: http://stackoverflow.com/comment/42469776
has answer: http://stackoverflow.com/a/26966350
linked to: http://stackoverflow.com/q/3707612
tagged with: instance
has title: Clone method behavior at memory level - java
tagged with: java
linked to: http://stackoverflow.com/q/17203493

http://stackoverflow.com/comment/42362162
type: AnswerComment
type: Comment
has text: I wish I could do that. I tried it, actually I am using a custom theme in my app, the theme also has a customized action bar, if I finish the activity and call another intent, then the transition is showing up a black action bar for a split second which will be a very bad user experience.
comment on: http://stackoverflow.com/a/26905180
score: 0

http://stackoverflow.com/comment/42497753
has text: Entry into List is not controlled by me i get the List as an input
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26981799
score: 0

http://stackoverflow.com/a/26911282
has body: WebSocketSession is the implementation of Session. It overrides hashCode and equals and so can be expected to be hashed safely in programs using more than 4GB of memory. That is, the session is the key. You can do something like this: class YourClass { private Set&lt;Session&gt; managedSessions = new HashSet&lt;Session&gt;(); // or use a Map&lt;Session,Data&gt; if you want to store associated data @OnWebSocketConnect public void onOpen(Session session) throws IOException { if (managedSessions.contains(session)) { // working with preexisting session } else { managedSessions.add(session); } } @OnWebSocketClose public void onClose(Session session, int statusCode, String reason) { managedSessions.remove(session); } }
type: Answer
answers question: http://stackoverflow.com/q/26910094
has comment: http://stackoverflow.com/comment/42398600
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42393577
has comment: http://stackoverflow.com/comment/42397880
downvote count: 0

http://stackoverflow.com/comment/42249702
score: 1
has text: I had to exclude the eco-inflector dependency, now it does work. Thank you for pointing me into the right direction.
type: AnswerComment
comment on: http://stackoverflow.com/a/26842190
type: Comment

http://stackoverflow.com/q/26969630
tagged with: spring-amqp
has comment: http://stackoverflow.com/comment/70946412
downvote count: 0
has comment: http://stackoverflow.com/comment/42478627
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
has comment: http://stackoverflow.com/comment/42485406
tagged with: rabbitmq
has comment: http://stackoverflow.com/comment/70928193
has title: springamqp retry template and channel error
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/71001504
has body: Recently we've encountered situation when retry mechanism doesn't handle "low-level" errors. Due to our applicative bug, the message we were trying to send was bigger than frame_max size of rabbitmq (default configuration). The problem is that same message causes consumer to be restarted over and over again, and retry mechanism (with 3 max attempts) is not working since it's probably at higher layer (retry template at spring level of consumer) than protocol (withing rabbitmq connection thread). Is there a way to count low-level failures too and stop at some point to try to handle such message (i.e. max retries)? Am I missing something here? Retry template is simple 3 max retries with some delay in between. I'm looking for a "robust" way to handle such failures. thanks in advance Retry configuration: @Bean public RetryOperationsInterceptor workMessagesRetryInterceptor() { return RetryInterceptorBuilder.stateless().retryOperations(retryTemplate(properties.getRetryMaxAttempts())) .recoverer(workerMessageRecoverer()) .build(); } private RetryTemplate retryTemplate(int maxRetries) { RetryTemplate retryTemplate = new RetryTemplate(); ExponentialBackOffPolicy backOffPolicy = new ExponentialBackOffPolicy(); backOffPolicy.setInitialInterval(properties.getRetryInitialInterval()); backOffPolicy.setMultiplier(properties.getRetryMultiplier()); backOffPolicy.setMaxInterval(properties.getRetryMaxInterval()); retryTemplate.setBackOffPolicy(backOffPolicy); SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(); retryPolicy.setMaxAttempts(maxRetries); retryTemplate.setRetryPolicy(retryPolicy); retryTemplate.registerListener(new LogOnRetryListener()); return retryTemplate; } @Bean public SimpleMessageListenerContainer messageListenerContainer() { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setRabbitAdmin(amqpAdmin()); container.setConnectionFactory(connectionFactory()); container.setQueueNames(properties.getQueueName()); container.setCon…

http://stackoverflow.com/comment/42321950
has text: @Karkool Remembering of course to respect the copyright and licensing of the original... ;-)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26865815

http://stackoverflow.com/q/26948302
downvote count: 0
has answer: http://stackoverflow.com/a/59318959
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42438650
has comment: http://stackoverflow.com/comment/93747918
has comment: http://stackoverflow.com/comment/42438606
upvote count: 11
has title: IndexOutOfBoundsException for setSpan - outside my application code
has comment: http://stackoverflow.com/comment/42439726
has answer: http://stackoverflow.com/a/31132760
linked to: http://stackoverflow.com/q/25880638
score: 11
type: Question
has comment: http://stackoverflow.com/comment/42438470
has comment: http://stackoverflow.com/comment/42439739
tagged with: java
has comment: http://stackoverflow.com/comment/42438551
has comment: http://stackoverflow.com/comment/50246821
has body: I recently published an update to my Android app and have been getting a ton of crash reports, with the following stack. I'm at a loss since there's absolutely no code of mine in the stack, so I'm not sure how to tackle this problem. Has anyone ever seen this error? Anything I can do to address this or debug it? java.lang.IndexOutOfBoundsException: setSpan (0 ... 11) ends beyond length 0 at android.text.SpannableStringBuilder.checkRange(SpannableStringBuilder.java:1016) at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:592) at android.text.SpannableStringBuilder.setSpan(SpannableStringBuilder.java:588) at android.widget.TextView.setSpan_internal(TextView.java:8610) at android.widget.Editor$SuggestionsPopupWindow.onItemClick(Editor.java:2902) at android.widget.AdapterView.performItemClick(AdapterView.java:298) at android.widget.AbsListView.performItemClick(AbsListView.java:1128) at android.widget.AbsListView$PerformClick.run(AbsListView.java:2812) at android.widget.AbsListView$1.run(AbsListView.java:3571) at android.os.Handler.handleCallback(Handler.java:725) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:153) at android.app.ActivityThread.main(ActivityThread.java:5299) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at dalvik.system.NativeStart.main(NativeStart.java) Edit: From the stack, it looks like it's going through a ListView -> itemClick -> then trying to do something with a TextView. I do have multiple clickable listViews with textViews in them... Is there a property I can set on the textViews to stop this from happening?
answer count: 2
has comment: http://stackoverflow.com/comment/50237945
has comment: http://stackoverflow.com/comment/61152478
has comment: http://stackoverflow.com/comment/53622224

http://stackoverflow.com/comment/42454858
type: Comment
comment on: http://stackoverflow.com/q/26957819
type: QuestionComment
has text: @Jesper - i followed your advice and fixed the url according to this answer: http://stackoverflow.com/questions/1457716/what-is-the-mysql-jdbc-driver-connection-string . But now after clean / run it's stuck on `Compiling 4 Scala sources and 2 Java sources` for the past 8m . Is it supposed to do this?
score: 0

http://stackoverflow.com/a/26912351
answers question: http://stackoverflow.com/q/26911603
has comment: http://stackoverflow.com/comment/42374923
has comment: http://stackoverflow.com/comment/128882262
accepted answer of: http://stackoverflow.com/q/26911603
score: 5
upvote count: 5
has body: Try this : public static class User { public User(int userId, int roleId) { this.userId = userId; this.roleId = roleId; } private int userId; private int roleId; public int getUserId() { return userId; } public int getRoleId() { return roleId; } public void setUserId(int userId) { this.userId = userId; } public void setRoleId(int roleId) { this.roleId = roleId; } } Test : Map&lt;String, Object&gt; responseObj = new HashMap&lt;String, Object&gt;(); List&lt;User&gt; userList = new ArrayList&lt;User&gt;(); userList.add(new User(1, 1)); userList.add(new User(2, 2)); responseObj.put("canApprove", true); //1 responseObj.put("approvers", userList); System.out.println(new JSONObject(responseObj)); Prints : {"approvers":[{"userId":1,"roleId":1},{"userId":2,"roleId":2}],"canApprove":true} (formatted)
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/26891160
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26890908
has body: Your first problem is the lack of protocol in the Uri. Try this: UriBuilder baseUri = new UriBuilder("http://localhost:8080/AnarchyChatServer/AnarchyChatServlet"); By the way... To debug these issues in the future, use: catch (Exception ex) { &lt;- breakpoint here } And examine ex. Or turn on breaking on thrown CLR exceptions in Visual Studio and debug the code (or just don't swallow the exception). Then you would see this: Ignoring exceptions when debugging code is not a good idea in general...
answers question: http://stackoverflow.com/q/26890908
downvote count: 0
type: AcceptedAnswer
score: 4
type: Answer

http://stackoverflow.com/comment/64818316
type: Comment
comment on: http://stackoverflow.com/a/26877549
has text: @NeilLunn please show implementation of `match` and `unwind` methods.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27207897
upvote count: 1
score: 1
has body: Not having used Axis 1.4, but after a quick glance at the docs. You can add a Handler to your code. You should be able even do this without having to recompile it, it that's an issue. A Handler wraps the underlying web service, it's called before the service is invoked, and after it returns. It's sorta like a Servlet Filter, but for Web Services. The Handler has full access to the SOAP body before it gets sent forward for processing. So you can use this as an opportunity to remove elements that you don't like. Dig a bit and you'll find you eventually get a DOM element that represents your SOAP body, so you can play primitive DOM games to add/delete nodes, etc. and set that back all within the Handler. Your service will never see the new nodes in the edit SOAP body. All that said, you may well be able to even do this using a Servlet Filter as well.
answers question: http://stackoverflow.com/q/26907856
has comment: http://stackoverflow.com/comment/42897729
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42248252
type: QuestionComment
comment on: http://stackoverflow.com/q/26840737
has text: @JamesKanze Added a cast, it [still differs](http://ideone.com/XnWFot).
score: 0
type: Comment

http://stackoverflow.com/q/26848399
linked to: http://stackoverflow.com/q/12838575
tagged with: android-layout
has comment: http://stackoverflow.com/comment/42259567
score: -1
answer count: 2
upvote count: 0
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/42259541
has answer: http://stackoverflow.com/a/26848507
tagged with: android
has answer: http://stackoverflow.com/a/26849519
type: UnansweredQuestion
has title: Add icon next to each item in a list
tagged with: java
downvote count: 1
type: Question
has body: I have a list item of strings, and would like to assiate each item in the NavigationDrawer with an icon. Below is the list item is called: OptionMenu = new String[] { "Discover activities", "Matches", "City selection", "Preferences", "Contact Dooba" }; mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mDrawerRelativeLayout = (RelativeLayout) findViewById(R.id.left_drawer); mDrawerList = (ListView) findViewById(R.id.list_view_drawer); mDrawerList.setAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, mOptionMenu)); mDrawerList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Fragment fragment = null; switch (position) { case 0: fragment = new FirstFragment(); break; case 1: fragment = new SecondFragment(); break; case 2: fragment = new ThirdFragment(); break; } FragmentManager fragmentManager = getSupportFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.content_frame, fragment).commit(); mDrawerList.setItemChecked(position, true); mTitleSection = mOptionMenu[position]; getSupportActionBar().setTitle(mTitleSection); mDrawerLayout.closeDrawer(mDrawerRelativeLayout); } }); mDrawerList.setItemChecked(0, true); mTitleSection = getTitle(); mTitleApp = getTitle(); mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.logo8, R.string.drawer_open, R.string.drawer_close) { public void onDrawerClosed(View view) { getSupportActionBar().setTitle(mTitleSection); ActivityCompat.invalidateOptionsMenu(MainActivity.this); } public void onDrawerOpened(View drawerView) { getSupportActionBar().setTitle(mTitleSection); ActivityCompat.invalidateOptionsMenu(MainActivity.this); } }; mDrawerLayout.setDrawerListener(mDrawerToggle); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayUseLogoEnabled(true); } @Override public boolea…

http://stackoverflow.com/a/26892624
has comment: http://stackoverflow.com/comment/42340169
answers question: http://stackoverflow.com/q/26892229
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: Try below code: public static void main(String[] args) { int line = 1; int number = 5; while (number&gt;=0){ for(int cnt = 0;cnt &lt; line; cnt++,number--){ System.out.print(number +" "); } line++; System.out.println(); } In this piece of code variable line holds current line number and variable number is any integer you would like to pass on e.g: 5. Currently number variable is hard coded however you can pass and read it from command line argument. Now, while loop basically check for variable number. While loop condition returns true until number becomes 0 so basically journey starts from original value till 0. For loop basically check for line number and values to prints in one occurrence. Also it decrease number value by 1 (number--) in every execution. Once it is comes out of for loop it increase line number by 1 (line++)and cursor move to next line using sysout statement.

http://stackoverflow.com/a/26926124
downvote count: 0
score: 1
has body: Ok I found it grid.getView().setSortingEnabled(false);. This will disable the sorting when clicking on the header, but keep the menu items in place.
accepted answer of: http://stackoverflow.com/q/26869742
answers question: http://stackoverflow.com/q/26869742
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26957386
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42453897
accepted answer: http://stackoverflow.com/a/26957493
has comment: http://stackoverflow.com/comment/42453885
has body: I have following function. public static void insertQuery(String tableName,HashMap ColumnValueArr) { if(tableName!="" &amp;&amp; ColumnValueArr.size() &gt; 0){ Set set = ColumnValueArr.entrySet(); Iterator i = set.iterator(); while(i.hasNext()) { Map.Entry me = (Map.Entry)i.next(); System.out.print(me.getKey() + ": "); System.out.println(me.getValue()); } } } I am getting error in following line. Map.Entry me = (Map.Entry)i.next(); But as per my knowledge syntax is right. so what can be the problem and what are the alternative solutions? Thanks in advance for your precious time.
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42453955
has title: Map.entry not working when hashmap is in function argument
has answer: http://stackoverflow.com/a/26957493
score: -1

http://stackoverflow.com/a/26926792
accepted answer of: http://stackoverflow.com/q/26926645
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26926645
has comment: http://stackoverflow.com/comment/42399711
has comment: http://stackoverflow.com/comment/42399702
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42399798
has comment: http://stackoverflow.com/comment/42399703
type: Answer
has comment: http://stackoverflow.com/comment/42410566
has comment: http://stackoverflow.com/comment/42399921
has body: If you use Java 1.7 or 1.8, you can do this: while((letter=reader.read()).equals(" ")){ } return letter;

http://stackoverflow.com/comment/42254813
comment on: http://stackoverflow.com/a/26843688
type: AnswerComment
has text: As far as I know Java GAE by default only sends 10 concurrent requests to your instance anyway, so 12 concurrent db connections should be fine.
type: Comment
score: 2

http://stackoverflow.com/q/26833023
has body: I have the following regex pattern that I am splitting the String on. I don't understand how this is matched and the split happens. I do have basic understanding of regex and how it works. public class URLmatching { private static final Pattern SPLIT_PATTERN = Pattern.compile("(?&lt;!(^|[A-Z0-9]))(?=[A-Z])|(?&lt;!^)(?=[A-Z][a-z])"); public void print() throws URISyntaxException{ System.out.println(this.getClass().getSimpleName()); final String[] string = SPLIT_PATTERN.split(getClass().getSimpleName()); System.out.println(Arrays.toString(string)); } public static void main(String[] args) throws URISyntaxException{ URLmatching u = new URLmatching(); u.print(); } } Output: URLmatching [UR, Lmatching]
has answer: http://stackoverflow.com/a/26833127
accepted answer: http://stackoverflow.com/a/26833127
upvote count: 1
answer count: 1
favorite count: 0
has title: unable to understand how this regex operates on the input string?
tagged with: regex
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/26944981
has body: I am learning sorting now, and didn't understand something. My sort is working with classes Integer, Double... etc, but not with types int, short, long, double etc. I used public static &lt;T extends Comparable&lt;? super T&gt;&gt; void sexySort(T[] a) And public static &lt;T extends Number&gt; void sexySort(T[] a). P.S. I have tried with reflect, but still not working public static &lt;T&gt; int checkClass(T t){ String type = t.getClass().getCanonicalName(); if(type.equals("java.lang.Integer")){ return 0; } else if(type.equals("java.lang.Double")){ return 1; } return -1; //etc. }
has title: Can I use simple types in template sorting
tagged with: java
type: Question
tagged with: sorting
has answer: http://stackoverflow.com/a/26945017
has answer: http://stackoverflow.com/a/26945036
score: 0
answer count: 2
tagged with: types
possible better answer: http://stackoverflow.com/a/26945017
accepted answer: http://stackoverflow.com/a/26945036
type: AnsweredQuestion

http://stackoverflow.com/comment/42283616
type: Comment
has text: I'm not really a Spring expert (I believe you are using Spring for building this), but you cannot use `@QueryParam`. It is from the JAX-RS framework, Spring utilizes `@RequestParam` which is the equivalent.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26860341

http://stackoverflow.com/comment/42413121
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26886702
has text: JBoss has it's own [Modular Service Container](https://docs.jboss.org/author/display/MSC/Home) but I didn't think you want to use this. AFAIK it's internal API and not even exported to the deployments.

http://stackoverflow.com/a/26922476
type: AcceptedAnswer
has body: You've broken the paint chain... @Override public void paintComponent(Graphics g) { g.drawImage(imageDisplayed, 100, 120, 900, 600, this); } The first thing you should be calling is super.paintComponent(g) @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.drawImage(imageDisplayed, 100, 120, 900, 600, this); } The Graphics context is shared resource, meaning that the Graphics context you get has also been used to paint the other components that have also been painted. One of the jobs of paintComponent is to clear the Graphics context ready for the component to be painted (fill the background) See Painting in AWT and Swing and Performing Custom Painting for more details You should, also, avoid using null layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify. See Why is it frowned upon to use a null layout in SWING? for more details... Before you go all defensive over getting your screen laid out just nicely, you shouldn't be doing it this way. You controls should be laid out on separate containers (using appropriate layout managers) and you "drawing surface" should be it's own component. See Laying Out Components Within a Container for more details... If you're still not convicned, take a look at Why setting setPreferredSize() on JFrame is bad? and java expandable JDialog for examples of differences between Mac and Windows
type: Answer
accepted answer of: http://stackoverflow.com/q/26922459
has comment: http://stackoverflow.com/comment/42397553
answers question: http://stackoverflow.com/q/26922459
score: 0

http://stackoverflow.com/q/26990875
tagged with: string
possible better answer: http://stackoverflow.com/a/26990958
has answer: http://stackoverflow.com/a/26990958
type: Question
type: AnsweredQuestion
has body: I have 2 strings as shown below: String paramNum = "99999256"; String opCode = "99999"; On the String paramNum I want to extract that part of the string which appears after the string value contained in opCode So with the above example: the result should be "99999256" - "99999" = "256". Parse paramNum (99999256) and reach to a position of after 99999 and then do a substring till end of the string. But I am not sure on how to reach to that position? Note this is only a symbolic representation of what I want to do with these strings and they do mean a subtraction on 2 int.
has answer: http://stackoverflow.com/a/26990897
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26991283
has answer: http://stackoverflow.com/a/26991325
upvote count: 1
accepted answer: http://stackoverflow.com/a/26990897
tagged with: java
has title: Java Get substring of a string
answer count: 4
downvote count: 0

http://stackoverflow.com/comment/98197928
score: 0
type: Comment
type: AnswerComment
has text: Please make your answer useful even without a link.
comment on: http://stackoverflow.com/a/55761404

http://stackoverflow.com/comment/42399918
has text: Thanks for the answer. Is there any documentation or example code of custom events so that I can try to make some for GlassFish myself?
comment on: http://stackoverflow.com/a/26905552
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26864970
has comment: http://stackoverflow.com/comment/42289368
type: Answer
has body: Just for good measure. return String.format(String.format("%%s %%.%df %%.%df", sign, sign), prefix, this.x, this.y);
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26864685
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26864685
type: AcceptedAnswer

http://stackoverflow.com/comment/42383232
comment on: http://stackoverflow.com/a/26916883
type: Comment
has text: First of all thank you for your answer. So the problem is that the cable i am using doesnt switch rx and tx and neither does the adapter right ?
score: 0
type: AnswerComment

http://stackoverflow.com/a/26910075
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26909968
has body: To display an two dimensional array in a simple fashion you could use this method: public class Integer2dArrays { public static String toString(int[][] array){ StringBuilder sb = new StringBuilder(); for(int i=0;i&lt;array.length;i++) { for(int j=0;j&lt;array[i].length;j++) { sb.append(array[i][j]).append(", "); } sb.append("\n"); } return sb.toString(); } } This will produce output the following way: int[][] test1 = {{1,2,3,4},{-5,-6,-7,-18},{10,9,8,7}}; would be: 1, 2, 3, 4, -5, -6, -7, -18, 10, 9, 8, 7, If you want a different form of output please specify what format you expect.
answers question: http://stackoverflow.com/q/26909968
type: Answer
score: 2

http://stackoverflow.com/a/26942376
type: Answer
answers question: http://stackoverflow.com/q/26942375
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
has body: private Handler repeatUpdateHandler = new Handler(); public int mValue; //increment private boolean mAutoIncrement = false; //for fast foward in real time private boolean mAutoDecrement = false; // for rewind in real time private class RptUpdater implements Runnable { public void run() { if( mAutoIncrement ){ mValue += 30; //change this value to control how much to forward mediaPlayer.seekTo(getCurrentPosition()+ mValue); repeatUpdateHandler.postDelayed( new RptUpdater(), 50 ); } else if( mAutoDecrement ){ mValue -= 30; //change this value to control how much to rewind seekTo(getCurrentPosition()- mValue); repeatUpdateHandler.postDelayed( new RptUpdater(), 50 ); } } } btnPrev.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { v.setPressed(true); mAutoDecrement = true; repeatUpdateHandler.post( new RptUpdater() ); return false; } else if(event.getAction() == MotionEvent.ACTION_UP) { v.setPressed(false); if( (event.getAction()==MotionEvent.ACTION_UP || event.getAction()==MotionEvent.ACTION_CANCEL) &amp;&amp; mAutoDecrement ){ mAutoDecrement = false; } return false; } return false; } }); btnNext.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { if(event.getAction() == MotionEvent.ACTION_DOWN) { v.setPressed(true); mAutoIncrement = true; repeatUpdateHandler.post( new RptUpdater() ); return false; } else if(event.getAction() == MotionEvent.ACTION_UP) { v.setPressed(false); if( (event.getAction()==MotionEvent.ACTION_UP || event.getAction()==MotionEvent.ACTION_CANCEL) &amp;&amp; mAutoIncrement ){ mAutoIncrement = false; } return false; } return false; } });
accepted answer of: http://stackoverflow.com/q/26942375

http://stackoverflow.com/a/26932686
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42421086
answers question: http://stackoverflow.com/q/26928735
has comment: http://stackoverflow.com/comment/42414650
accepted answer of: http://stackoverflow.com/q/26928735
score: 4
upvote count: 4
has body: You can create a custom ApplicationContextInitializer which adds decryption or whatever to the PropertySources of your choice. We do something similair in one of the application I currently develop. After loading some custom properties from files and databases we wrap all the available PropertySources in a EncryptablePropertySource because several properties are encrypted (We use the Jasypt library for that).

http://stackoverflow.com/comment/42361047
score: 0
type: QuestionComment
has text: 1) For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example). 2) Java GUIs have to work on different OS', screen size, screen resolution etc. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556). 3) Provide ASCII art, or a simple drawing, of the intended layout of the GUI.
type: Comment
comment on: http://stackoverflow.com/q/26905027

android-5.0-lollipop
tags question: http://stackoverflow.com/q/26905971
tags question: http://stackoverflow.com/q/26986932
tag name: android-5.0-lollipop
type: Tag
tags question: http://stackoverflow.com/q/26856487
tags question: http://stackoverflow.com/q/26933888

http://stackoverflow.com/comment/42302756
type: QuestionComment
comment on: http://stackoverflow.com/q/26872241
has text: you print the result before the thread have completed their work. put the print after the joins.
score: 1
type: Comment

http://stackoverflow.com/comment/42321021
type: Comment
has text: Valid import can't recognize them
type: AnswerComment
comment on: http://stackoverflow.com/a/26882343
score: 0

http://stackoverflow.com/comment/42543105
comment on: http://stackoverflow.com/a/26968947
score: 0
type: AnswerComment
type: Comment
has text: sorry sir. i had tried your code, but nothing happen to the apps. no error, no stop unexpectedly. what should i do?

http://stackoverflow.com/comment/42354806
type: Comment
type: QuestionComment
has text: The user always inputs 4 alphabets?
score: 0
comment on: http://stackoverflow.com/q/26901217

http://stackoverflow.com/comment/51794916
type: AnswerComment
comment on: http://stackoverflow.com/a/27976464
score: 0
type: Comment
has text: this works for setters/getters indeed; but it breaks immutability of course. Not sure I'm ok with that

http://stackoverflow.com/comment/42300497
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26870809
type: Comment
has text: @ruakh no, I would provide a comment with a link to other algorithm sorts and let OP do the research about it and move on. I don't find a specific programming problem but a code that works and OP looks for improvement, which is totally on topic there, and may or not be may on topic here.

http://stackoverflow.com/comment/42549232
has text: I was not able to reproduce this, i have set up a web project with maven nature enabled tried this code: List<String> myMappingFiles = new ArrayList<String>(1); myMappingFiles.add("dozer-mapping.xml"); DozerBeanMapper mapper = new DozerBeanMapper(); mapper.setMappingFiles(myMappingFiles); B obj=new B(); obj.setbName("Test"); A destObject = mapper.map(obj, A.class); System.out.println("B="+destObject.getaName()); It worked. Please post more details on how to reproduce this.
comment on: http://stackoverflow.com/q/26988420
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26952565
has answer: http://stackoverflow.com/a/66823888
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26953100
linked to: http://stackoverflow.com/q/65934021
favorite count: 0
tagged with: ascii-art
has title: Print out an ASCII line of boxes
type: Question
possible better answer: http://stackoverflow.com/a/26953364
accepted answer: http://stackoverflow.com/a/26953100
has answer: http://stackoverflow.com/a/26953364
score: 0
tagged with: java
answer count: 3
upvote count: 1
downvote count: 1
has body: I need to write a program to output an ASCII art pattern. The size of the pattern should change dynamically based on class constants. It should look like this: Number of boxes: 4 Width of boxes: 6 Height of boxes: 3 +------+------+------+------+ | | | | | | | | | | | | | | | +------+------+------+------+ public class testing { public static void main(String[] args) { for (int height = 1; height &lt;= 2; height++) { System.out.println(""); for (int box = 1; box &lt;= 4; box++) { System.out.print("+"); // System.out.print("|"); for (int width = 1; width &lt;= 6; width++) { System.out.print("_"); } } } } }

http://stackoverflow.com/q/26957945
has answer: http://stackoverflow.com/a/26957982
has answer: http://stackoverflow.com/a/26957955
tagged with: hex
type: Question
has body: I have the following function to convert byte array to Hex in integer format. private static int byteArray2Int(final byte[] hash) { Formatter formatter = new Formatter(); for (byte b : hash) { formatter.format("%02x", b); } String str = formatter.toString(); int hex = Integer.parseInt(str, 16); //number format exception return hex; } -- And I'm getting below error. I understand the formatter value is already in hex but I want to store in integer format. How do I go about it, please? Exception in thread "main" java.lang.NumberFormatException: For input string: "202e4724bb138c1c60470adb623ac932" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
answer count: 2
has comment: http://stackoverflow.com/comment/42454864
accepted answer: http://stackoverflow.com/a/26957982
score: 0
tagged with: java
has title: byte array to Hex (in int format)
tagged with: arrays
tagged with: type-conversion
tagged with: numberformatexception
possible better answer: http://stackoverflow.com/a/26957955
type: AnsweredQuestion

http://stackoverflow.com/comment/42428011
has text: I'd post that comment in the question section so that the OP can see it
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26942175
type: AnswerComment

http://stackoverflow.com/comment/42276245
type: QuestionComment
comment on: http://stackoverflow.com/q/26857191
has text: @ColonelThirtyTwo All code I'm compiling will be utilizing the Scanner class for input. For this application I need to assume I can't change the code to change to stdin /java parameters
score: 0
type: Comment

http://stackoverflow.com/q/26916392
answer count: 1
tagged with: sockets
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42381708
has body: I have the following problem: I am running a server, which establishes a TCP connection with all the clients who connect in a separate Thread spawned by ExecutorService. I have an exit command, which should terminate the server including all the threads spawned by ExecutorService. In each particular Thread related to a client I have a while-loop, where I am waiting for client's input in the condition using the InputStream of the associated socket. I also have a global boolean variable, which indicates if the server is online. As soon as it turns to false, I break the loop and terminate the thread. It looks basically like this: // userInput - String // in - BufferedReader associated with the input stream of the client's socket while ((userInput = in.readLine()) != null &amp;&amp; serverIsOnline) { //do some stuff } However, the problem is that in.readLine() is a blocking operation and therefore the whole server won't be terminated unless all the clients type in something. ExecutorService.shutDownNow() also would not work, as the interrupt is ineffective in this case, because the thread is blocked by another operation. I also want to avoid System.exit(). Any efficient solutions?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42382375
tagged with: java
tagged with: thread-safety
type: Question
tagged with: threadpool
has comment: http://stackoverflow.com/comment/42381380
has comment: http://stackoverflow.com/comment/42382327
linked to: http://stackoverflow.com/q/671049
score: 0
has title: How to terminate Thread spawned from ExecutorService
has answer: http://stackoverflow.com/a/26916665
accepted answer: http://stackoverflow.com/a/26916665

http://stackoverflow.com/a/26946870
answers question: http://stackoverflow.com/q/26946747
has body: The short answer is: no, Java does not provide ArrayList of ints by default. ArrayList can only contain Object subclasses and primitives don't inherit Object. However, you could write your own implementation of List that operates on ints or - preferably - use something like TIntArrayList.
score: 0
type: Answer

io
tags question: http://stackoverflow.com/q/26858239
tags question: http://stackoverflow.com/q/26866664
tags question: http://stackoverflow.com/q/26865845
tags question: http://stackoverflow.com/q/26923835
tags question: http://stackoverflow.com/q/26856790
tag name: io
tags question: http://stackoverflow.com/q/26857711
tags question: http://stackoverflow.com/q/26906578
tags question: http://stackoverflow.com/q/26990618
tags question: http://stackoverflow.com/q/26832777
tags question: http://stackoverflow.com/q/26865474
tags question: http://stackoverflow.com/q/26958643
tags question: http://stackoverflow.com/q/26972763
type: Tag
tags question: http://stackoverflow.com/q/26960497
tags question: http://stackoverflow.com/q/26880584
tags question: http://stackoverflow.com/q/26840048
tags question: http://stackoverflow.com/q/26878566
tags question: http://stackoverflow.com/q/26869077
tags question: http://stackoverflow.com/q/26882525

http://stackoverflow.com/a/26888803
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26888666
has body: Firstly to implement and interface you have to use implements not extends. Secondly when using generics you can use extends. In the interface you have defined a method that would give you Iterator&lt;Interface2&gt; getIterator(); but in the implementation you are doing Iterator&lt;Interface3&gt; getIterator(); Which won't work what you could do is use generics like this(Verified doesn't give compile error): interface Interface1 { Iterator&lt;? extends Interface2&gt; getIterator(); } interface Interface2 { } interface Interface3 extends Interface2 { } class Class1 implements Interface1 { public Iterator&lt;Interface3&gt; getIterator(){ return null; } }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42291388
has text: Try posting some more code and the complete stacktrace which came with the exception. I haven't used ghost4, but it looks like it is looking for some Windows (win32) methods
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26865978
type: Comment

http://stackoverflow.com/q/26881013
tagged with: tcp
tagged with: java
tagged with: middleware
type: Question
has comment: http://stackoverflow.com/comment/42416342
has comment: http://stackoverflow.com/comment/42420925
linked to: http://stackoverflow.com/q/2787679
has comment: http://stackoverflow.com/comment/42420916
tagged with: http://stackoverflow.com/tag/c
has title: Control C application from Java web application
has comment: http://stackoverflow.com/comment/42418544
answer count: 2
has answer: http://stackoverflow.com/a/26936799
possible better answer: http://stackoverflow.com/a/26939983
has comment: http://stackoverflow.com/comment/42442608
downvote count: 0
has answer: http://stackoverflow.com/a/26939983
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42416553
score: 2
accepted answer: http://stackoverflow.com/a/26936799
has body: I have C applications that will run on multiple machines at different sites. Now I want to control and monitor these C applications. For that I am thinking about Java Web Application using Servlet/JSP. I am thinking that C applications will connect to Java Web application over TCP. In my web application, I am thinking to implement manager which communicates with C applications over TCP. I will start manager when web application starts as separate thread. And manager will communicate to servlet requests via Context and Session. So whenever user do something on browser, I want to use functionalities of my manager at server, with ServetContext an Session as interface. So this is what I am thinking. So, I want to know if there is better approach, or I am doing anything wrong? Can anyone please suggest me better solution? EDIT Current workflow: whenever I need to start / stop C application, I have to SSH remote machine puTTY terminal, type long commands, and start / stop it. Whenever there is some issue, I have to scroll long long log files. There couple of other things like live status of what application is doing/processing all things at every second, that I can't log always in log file. So I find these workflow difficult. And things like live status I can't monitor. Now I want to have web application interface to it. I can modify my C application and implement web application from scratch. New Workflow to implement: I want to start / stop C application from web page. I want to view logs and live status reports / live graphs on web page (monitoring what C application is doing). I want to monitor machine status also on web page. The web interface I thinking to design in Java using JSP/servlets. So, I will modify my C application so it can communicate with with web application. Question: Just need guidelines / best practices for making new workflow. EDIT 2 Sorry for confusion between controller or manager. Both are same thing. My thoughts: System will consist of C applic…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42421085
has comment: http://stackoverflow.com/comment/42415562

http://stackoverflow.com/comment/42362922
has text: Hey, You were right. For some reason fileList is null. I will go and hava a go debugging it, and see what i can find. It is strange that it is only happening on the newer android version though. Thanks for your help, Corey :)
comment on: http://stackoverflow.com/q/26905971
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42244644
has text: And that's it? No more details?
score: 0
comment on: http://stackoverflow.com/q/26838517
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42318873
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26869487
score: 0
has text: Yes, I text something in the imputText, and when I validate the field is empty or with the default value. I cannot retrieve what I texted into the field.

http://stackoverflow.com/a/26991268
has body: Consider using DateTimeFormat: http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/client/DateTimeFormat.html
has comment: http://stackoverflow.com/comment/42551332
type: Answer
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26991163
has comment: http://stackoverflow.com/comment/42547281

http://stackoverflow.com/comment/42277847
comment on: http://stackoverflow.com/a/26840585
type: AnswerComment
has text: My understanding is that you have no control over the RFID machine itself (the client). If it does not close the connection itself, then you need to figure out what "entire stream" means to you. If you know that each RFID card will have a 28-byte id, then you just read 28 bytes and disconnect, otherwise as long as the card is within its range, it will keep your socket busy and no other card will be able to connect.
type: Comment
score: 0

http://stackoverflow.com/q/26944600
possible better answer: http://stackoverflow.com/a/26946378
downvote count: 0
has answer: http://stackoverflow.com/a/26969199
tagged with: spring-security
favorite count: 0
has body: I follow spring security 3.2 doc to write a sample app. http.authorizeRequests().anyRequest().authenticated() is this mean any request is deny who is not login? But i access any url it's accessable. Is something config i has missing? @Configuration public class SpringWebMVCApplicationInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { @Override protected Class&lt;?&gt;[] getRootConfigClasses() { return new Class[] { SecurityConfig.class }; } @Override protected Class&lt;?&gt;[] getServletConfigClasses() { return new Class[] { WebConfig.class }; } @Override protected String[] getServletMappings() { return new String[] { "/" }; } } springmvc config @Configuration @EnableWebMvc @ComponentScan("org.jxs.mm.controller") public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/assets/**").addResourceLocations("/assets/"); registry.addResourceHandler("/favicon.ico").addResourceLocations("/favicon.ico"); } } spring security config @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().authenticated(); } }
accepted answer: http://stackoverflow.com/a/26969199
upvote count: 1
tagged with: spring-mvc
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/26946378
tagged with: java
has title: spring security 3.2 java configuration
type: Question
answer count: 2

http://stackoverflow.com/a/26884583
downvote count: 0
score: 1
type: Answer
has body: JLabel is a subclass of JContainer. JContainer offers a public method named setFont(), so you can call it from any place in your program, where you have a reference to the label object (the Lives' constructor is a valid place though). The possbility to change a super class' attribute depends on its visibilty (for example protected) and available accessor methods (for example getName() and setName() ). If an attribute/accessor was declared public or protected, you can change it directly from inside the subclass. In case of default visibilty, the subclass needs to be in the same package as the super class to manipulate the respective attribute.
upvote count: 1
answers question: http://stackoverflow.com/q/26884452
accepted answer of: http://stackoverflow.com/q/26884452
type: AcceptedAnswer

http://stackoverflow.com/q/26953889
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26954049
has comment: http://stackoverflow.com/comment/42447929
has comment: http://stackoverflow.com/comment/42448039
score: 1
tagged with: java
tagged with: set
has answer: http://stackoverflow.com/a/26954041
type: Question
has comment: http://stackoverflow.com/comment/42447998
answer count: 2
downvote count: 0
upvote count: 1
tagged with: string
favorite count: 0
has title: Set<String> getSet(String s)
has body: I am suppose to be returning a set from a Hashmap that I have created and should be located in the hashmap, but for whatever reason it is not currently working. Here is my method: public Set&lt;String&gt; getSet(String s){ // returns the Set&lt;String&gt; that is associated with the String s String stand = standardize(s); if(check(stand)){ System.out.println(map.get(stand)); } return null; } We also had a list ,but me converted it into a map. Standardize changes a string into alphabetical order which makes a string out of it. This string is used as a key. I am trying to print out that set, but for whatever reason it isn't working. What am I doing wrong? P.S. this code is in Java.

http://stackoverflow.com/q/26838242
accepted answer: http://stackoverflow.com/a/26838374
has comment: http://stackoverflow.com/comment/105015642
downvote count: 1
type: AnsweredQuestion
tagged with: java-stream
upvote count: 3
tagged with: java
has body: I am just starting to learn about the Streams and parallel in Java and I was wondering why a normal for loop takes less time than IntStream paralleled at adding items to an array. package parallel; import java.util.stream.IntStream; public class Parallel { public static void main(String[] args) { final int[] intArray = new int[100000]; long startTime = System.currentTimeMillis(); IntStream.range(0, 100000).parallel().forEach(i -&gt; intArray[i]=i); long endTime = System.currentTimeMillis(); System.out.println("Parallel time: " + (endTime-startTime)); final int[] intArray2 = new int[100000]; try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } startTime = System.currentTimeMillis(); for(int i = 0; i &lt; 100000; i++){ intArray2[i] = i; } endTime = System.currentTimeMillis(); System.out.println("Non parallel time: " + (endTime-startTime)); } } Getting results like this. Parallel time: 110 Non parallel time: 7
has comment: http://stackoverflow.com/comment/42241409
type: Question
tagged with: benchmarking
score: 2
has comment: http://stackoverflow.com/comment/42241619
answer count: 1
favorite count: 0
has title: Why does IntStream.range(0, 100000).parallel().foreach take longer than normal for loop
has answer: http://stackoverflow.com/a/26838374

http://stackoverflow.com/comment/42339269
type: QuestionComment
has text: What does the *server* do? Do it send back with a trailing newline? Because otherwise `readlLine` will wait for a newline (or connection closed, obviously).
comment on: http://stackoverflow.com/q/26892717
type: Comment
score: 1

http://stackoverflow.com/comment/42350951
type: QuestionComment
has text: _what I'm thinking is, detach objects before serve to the client_ As if you had a choice ;-)
comment on: http://stackoverflow.com/q/26892426
score: 0
type: Comment

http://stackoverflow.com/q/26914668
upvote count: 2
answer count: 5
has body: Sometimes you know because of the logic behind the conditions within your if, else if that your last condition check could be omitted and be written as an else instead. This way you do one less check, however it's less clear to read. What would be good coding? Would it even be more efficient because there is one less check or does the compiler optimize for these cases? if(x&lt;0){ //statements }else if(x==0){ //statements }else if(x&gt;0){ //statements } Or with else if(x&lt;0){ //statements }else if(x==0){ //statements }else{ //statements }
has answer: http://stackoverflow.com/a/26914981
score: 2
type: AnsweredQuestion
tagged with: if-statement
has comment: http://stackoverflow.com/comment/42378450
tagged with: java
accepted answer: http://stackoverflow.com/a/26914925
has answer: http://stackoverflow.com/a/26915170
has comment: http://stackoverflow.com/comment/42378542
type: Question
has comment: http://stackoverflow.com/comment/42378403
downvote count: 0
has title: Multiple else if conditions, end with an other "else if" or "else" when logic dictates the last "else"-part dictates only one possibility?
possible better answer: http://stackoverflow.com/a/26914773
has answer: http://stackoverflow.com/a/26914925
has answer: http://stackoverflow.com/a/26914890
favorite count: 0
has answer: http://stackoverflow.com/a/26914773
has comment: http://stackoverflow.com/comment/42384040
has comment: http://stackoverflow.com/comment/42378323

http://stackoverflow.com/q/26872781
has body: I'm new to this. After testing several websites with my crawler I came across the following: Price: £500 Note the class:Hidden rather than type="Hidden". How can I retrieve the price using any library but my preference is Jsoup. Here is an example snippet of code: Document doc = Jsoup.connect("http://www.example.org") .timeout(3000).get(); Elements tags = doc.select("div.originalCurrencyInformation > Label.original-price"); for(Element tag: tags){ System.out.println(tag); } Update I have tried Label.Hidden original-price and Label.Hidden.original-price but the value returns null, that's what I'm getting
score: 1
tagged with: java
tagged with: jsoup
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42303817
has answer: http://stackoverflow.com/a/26872887
accepted answer: http://stackoverflow.com/a/26872887
has title: Web crawling class hidden fields
tagged with: hidden-field
downvote count: 0
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/42485422
comment on: http://stackoverflow.com/a/26974353
type: AnswerComment
score: 0
type: Comment
has text: Are you buggy that why only 3 rows being seen ??? thats because when you declare `addRows("buchung", "Created", "10.10.10")'` 5 times , you are not adding the rows 5 times but instead you add datas AS it 5 columns (try to understand my words correctly ), and because you only create 3 columns by "Name","Art der Bearbeitung", "Datum" , so the rest 2 datas (for 2 columns) are ignored

http://stackoverflow.com/a/26954948
upvote count: 22
type: AcceptedAnswer
downvote count: 0
score: 22
has body: You need to redirect to stdout before you can pipe like that. Those messages go to stderr by default, rather than stdout; that means that grep won't see the messages, and they'll just get printed to the console. If this is Linux, try java -version 2&gt;&amp;1 | grep whatever and it should work. This will take all output to stderr from the java execution, and redirect it so that it goes to the same place as stdout; your grep invocation will then be able to see it.
type: Answer
accepted answer of: http://stackoverflow.com/q/26954934
answers question: http://stackoverflow.com/q/26954934

http://stackoverflow.com/comment/42351244
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26893449
has text: For this time being, it is not the issue ostensively as you may right highly. Would you take a minute of yours to take a look at this? I opened another question. Thank you in advance again.. http://stackoverflow.com/questions/26899182/getting-sslhandshakeexception-on-android-different

http://stackoverflow.com/comment/42409571
score: 2
has text: That's because auto boxing has a 1 to 1 relationship from its `Object` to its primitive type.
comment on: http://stackoverflow.com/q/26932336
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26976910
type: Question
has answer: http://stackoverflow.com/a/26978075
accepted answer: http://stackoverflow.com/a/26978075
tagged with: intellij-idea
has title: Java Swing getRootPane() returns null
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42490384
favorite count: 0
upvote count: 2
tagged with: swing
linked to: http://stackoverflow.com/q/26972637
has body: I am trying to set a button as the default button using a simple code as: mainPanel.getRootPane().setDefaultButton(sendButton); But getRootPane() returns null. I am using IntelliJ Idea Form designer and my code is just basically that line in the class constructor, just after main: public static void main(String[] args) { JFrame frame = new JFrame("TestSwing"); frame.setContentPane(new TestSwing().mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(700, 700)); frame.pack(); frame.setVisible(true); } public TestSwing() { mainPanel.getRootPane().setDefaultButton(sendButton); } IntelliJ adds some hidden code, but I can't see how this code could be changing things. My objective is just to set a default button in the form, so Enter will always activate this button. PS: I am new to Swing, but not to Java. EDIT: All the hidden code as requested: package com.testswing; import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; public class TestSwing { private JPanel mainPanel; private JTextArea messageTextArea; private JTextPane chatTextPane; private JCheckBox autoCheckbox; private JButton newChatButton; private JButton sendButton; private JTextField textField1; private JTextField textField2; public static void main(String[] args) { JFrame frame = new JFrame("TestSwing"); frame.setContentPane(new TestSwing().mainPanel); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setMinimumSize(new Dimension(700, 700)); frame.pack(); frame.setVisible(true); } public TestSwing() { mainPanel.getRootPane().setDefaultButton(sendButton); } { // GUI initializer generated by IntelliJ IDEA GUI Designer // &gt;&gt;&gt; IMPORTANT!! &lt;&lt;&lt; // DO NOT EDIT OR ADD ANY CODE HERE! $$$setupUI$$$(); } /** * Method generated by IntelliJ IDEA GUI Designer * &gt;&gt;&gt; IMPORTANT!! &lt;&lt;&lt; * DO NOT edit this me…
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42489572
has comment: http://stackoverflow.com/comment/42488955

http://stackoverflow.com/q/26964860
has body: I have problem with NetworkOnMainThreadException on Android. I building a java app using Google API, . I work on java code as Google libs developers.google.com/api-client-library/java/apis/drive/v2 This is my code String code = data.getStringExtra("code"); GoogleTokenResponse response; try { response = drive_flow.newTokenRequest(code).setRedirectUri(DRIVE_REDIRECT_URI).execute(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(httpTransport) .setJsonFactory(jsonFactory) .setClientSecrets(DRIVE_CLIENT_ID, DRIVE_CLIENT_SECRET) .build() .setFromTokenResponse(response); //Create a new authorized API client drive_service = new Drive.Builder(httpTransport, jsonFactory, credential).build(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } //catch (NetworkOnMainThreadException e){ //} (When i catch NetworkOnMainThreadException drive_service will be null) My app run on AVD Platform 2.3.3 very good, but on 4.1.1 (on genymotion) it not work. This is logcat: 11-17 02:53:37.190: E/AndroidRuntime(1408): FATAL EXCEPTION: main 11-17 02:53:37.190: E/AndroidRuntime(1408): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=999, result=999, data=Intent { (has extras) }} to activity {com.uit.testcloud3/com.uit.testcloud3.MainActivity}: android.os.NetworkOnMainThreadException 11-17 02:53:37.190: E/AndroidRuntime(1408): at android.app.ActivityThread.deliverResults(ActivityThread.java:3141) 11-17 02:53:37.190: E/AndroidRuntime(1408): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3184) 11-17 02:53:37.190: E/AndroidRuntime(1408): at android.app.ActivityThread.access$1100(ActivityThread.java:130) 11-17 02:53:37.190: E/AndroidRuntime(1408): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1243) 11-17 02:53:37.190: E/AndroidRuntime(1408): at android.os.Handler.dispatchMessage(Handler.java:99) 11-17 02:53:37.190: E/AndroidRuntime(1408): at android.os.Looper.loop(Loo…
tagged with: networkonmainthread
has answer: http://stackoverflow.com/a/26965212
linked to: http://stackoverflow.com/q/6343166
favorite count: 0
tagged with: google-drive-api
type: UnansweredQuestion
tagged with: android
duplicate of: http://stackoverflow.com/q/6343166
score: -3
has answer: http://stackoverflow.com/a/26965475
tagged with: java
downvote count: 3
has title: Android, NetworkOnMainThreadException google drive
type: Question
answer count: 2
upvote count: 0

jboss
tags question: http://stackoverflow.com/q/26980715
tags question: http://stackoverflow.com/q/26904346
tags question: http://stackoverflow.com/q/26901832
tags question: http://stackoverflow.com/q/26860256
tags question: http://stackoverflow.com/q/26832663
tags question: http://stackoverflow.com/q/26840639
tags question: http://stackoverflow.com/q/26929483
tags question: http://stackoverflow.com/q/26906852
tag name: jboss
tags question: http://stackoverflow.com/q/26882254
tags question: http://stackoverflow.com/q/26882365
tags question: http://stackoverflow.com/q/26859092
tags question: http://stackoverflow.com/q/26972869
type: Tag
tags question: http://stackoverflow.com/q/26944382
tags question: http://stackoverflow.com/q/26881828
tags question: http://stackoverflow.com/q/26866827
tags question: http://stackoverflow.com/q/26935341
tags question: http://stackoverflow.com/q/26908618
tags question: http://stackoverflow.com/q/26867648
tags question: http://stackoverflow.com/q/26878979
tags question: http://stackoverflow.com/q/26930395
tags question: http://stackoverflow.com/q/26911844
tags question: http://stackoverflow.com/q/26969941

http://stackoverflow.com/q/26960320
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26960411
tagged with: inheritance
has answer: http://stackoverflow.com/a/26960406
upvote count: 2
answer count: 3
has body: I've asked this question before but never got a solution what to do. I am trying to add a subtype to a list defined as follows. This should be 100% legal, the subtype extends the main type. private List&lt;? extends TopBean&gt; beans; public List&lt;? extends TopBean&gt; getBeans() { return beans; } I am trying to do this: this.getBeans().add(new SecondaryBean()); SecondaryBean extends TopBean (not directly but at some level). This is driving me nuts - the error is The method add(capture#2-of ? extends TopBean) in the type List&lt;capture#2-of ? extends TopBean&gt; is not applicable for the arguments (SecondaryBean) If I cast it to TopBean, same error, just diffent wording The method add(capture#2-of ? extends TopBean) in the type List&lt;capture#2-of ? extends TopBean&gt; is not applicable for the arguments (TopBean) I must add a child SecondaryBean into the List of generic TopBeans. What to do here?
favorite count: 0
has title: Adding subclass to list - The method add(capture#2-of ? extends TopBean)...not applicable for the arguments (TopBean)
has answer: http://stackoverflow.com/a/26979270
score: 2
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26958241
tagged with: java
has answer: http://stackoverflow.com/a/26958255
accepted answer: http://stackoverflow.com/a/26958255
score: -1
type: Question
tagged with: if-statement
upvote count: 0
has body: This is going to be quite hard to explain, but bear with me: Say, for example, I have an if statement that does the following, would it be possible to use the variable x2 outside of this if statement: int x = 3 if(x&gt;2.5) { String x2 = "X =" + Double.toString(x); } //How do I use the x2 outside the if function? System.out.println(x2); Every time I try to do it, the Eclipse underlines it and says the variable has not been defined, which I gather is because x2 might not be created if x&lt;=2.5, so nothing would be outputted. The reason I ask this is because I am trying to make a program that emails me a set of variables if (condition is true). But instead of putting the code for emailing the data to me inside of the if statement (I have about 20), and get 20 different emails if the condition is true, I want to be able to put the email code outside of this, so that all 20 variables will be sent in ONE email, if the condition is true for all of them. I hope that makes sense; if you have any questions just drop a comment.
has answer: http://stackoverflow.com/a/26958366
has answer: http://stackoverflow.com/a/26958260
answer count: 3
has title: How to recall variables made in if() functions in Java
favorite count: 0
tagged with: double
downvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26958260

http://stackoverflow.com/q/26909176
tagged with: jlist
has comment: http://stackoverflow.com/comment/94192403
has title: Scrolling & Selecting of JList in undecorated frame doesn't work properly
has comment: http://stackoverflow.com/comment/42368898
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42368420
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42398595
downvote count: 0
favorite count: 0
has body: I have this strange behavior, look at the following code (or try it out yourself): public class JListProblem { public static void main (String[] args) { JFrame frame = new JFrame("JList Problem"); frame.setSize( 300, 500); JScrollPane sp = new JScrollPane(); DefaultListModel dlm = new DefaultListModel(); for ( int i = 0; i &lt; 10000; i++ ) { dlm.addElement( i); } JList list = new JList(dlm ); sp.setViewportView( list ); frame.add( sp ); frame.setUndecorated( true ); frame.setBackground( new Color( 0.0f, 0.0f, 0.0f, 0.0f ) ); frame.setVisible( true ); } } Here's my problem: When you try to scroll, it does not scroll "smoothly" (sorry, I don't know the correct word for this). Try selecting an entry after scrolling: After you clicked, another entry is selected. How can I correct this behavior? When you decrease the amount of entries (change the value of maximum i to 1000 for example), everything is working fine.
has comment: http://stackoverflow.com/comment/42368828
tagged with: jframe
type: UnansweredQuestion

http://stackoverflow.com/a/26907782
has comment: http://stackoverflow.com/comment/42366205
has body: Problem with size of array String[] newNatures. Try this: public static void addProjectNature(IProject project, String natureID, boolean addFirst) { try { IProjectDescription description = project.getDescription(); if (description.hasNature(natureID)) { return; } String[] natures = description.getNatureIds(); String[] newNatures = new String[natures.length + 1]; if (addFirst) { System.arraycopy(natures, 0, newNatures, 1, natures.length); newNatures[0] = natureID; } else { System.arraycopy(natures, 0, newNatures, 0, natures.length); newNatures[natures.length] = natureID; } IStatus status = project.getWorkspace().validateNatureSet(newNatures); if (status.getCode() == IStatus.OK) { description.setNatureIds(newNatures); project.setDescription(description, null); } else { //Error message } } catch (CoreException e) { e.printStackTrace(); } }
answers question: http://stackoverflow.com/q/26906463
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42366795

http://stackoverflow.com/comment/42237476
score: 0
type: AnswerComment
type: Comment
has text: good point (had a bad feeling when using `int` for `totalNumber` but ignored it :) I guess this is an overall concern for every approach when turning an array of int into one single number
comment on: http://stackoverflow.com/a/26835782

http://stackoverflow.com/q/26964857
score: 0
tagged with: google-maps-markers
answer count: 1
has body: In the code below, I am getting NullPointerException. I understand that it means that one of the things that I am using on line 228 is null instead of the valid address. But I do not see why. Is there anything that I missed? public class MainActivity extends ActionBarActivity { LatLng xmyLL2; private Marker marker2; protected void onCreate(Bundle savedInstanceState) { marker2 = googleMap.addMarker(new MarkerOptions(). position(xmyLL2).title("ver2")); } private class MyLocationListener implements LocationListener { public void onLocationChanged(Location location) { double xd2 = Double.parseDouble(xstr[2]); double xd3 = Double.parseDouble(xstr[3]); xmyLL2 = new LatLng( xd2, xd3 ); marker2.setPosition(xmyLL2); // this is line228 } } On line 228: marker2.setPosition(xmyLL2); I get the exception, and this is the stack trace: MainActivity$MyLocationListener.onLocationChanged(Location) line: 228 LocationManager$ListenerTransport._handleMessage(Message) line: 279 LocationManager$ListenerTransport.access$000(LocationManager$ListenerTransport, Message) line: 208
has title: NullPointerException at Marker.setPosition()
tagged with: nullpointerexception
tagged with: android
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42467444
has comment: http://stackoverflow.com/comment/42467439
has comment: http://stackoverflow.com/comment/42467517
type: Question
has comment: http://stackoverflow.com/comment/42468088
has comment: http://stackoverflow.com/comment/42467412
has answer: http://stackoverflow.com/a/26965015
accepted answer: http://stackoverflow.com/a/26965015

identifier
tag name: identifier
tags question: http://stackoverflow.com/q/26952022
type: Tag
tags question: http://stackoverflow.com/q/26857341
tags question: http://stackoverflow.com/q/26938449
tags question: http://stackoverflow.com/q/26935339
tags question: http://stackoverflow.com/q/26870093

http://stackoverflow.com/comment/42293215
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26859580
score: 1
has text: Can it be handled through java by pausing the execution of the daemon which is loading RDD into cache?

http://stackoverflow.com/comment/42262281
has text: Thank you! That really helped, I can't believe I forget to do this earlier. But, I have another question - If the solution weren't so simple, what would have made my code above work?
score: 0
comment on: http://stackoverflow.com/q/26848998
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26896505
tagged with: java
has comment: http://stackoverflow.com/comment/42346914
type: Question
tagged with: bluej
tagged with: arrays
answer count: 1
score: 0
has title: BlueJ how to get data from an array so that it can be compared with user input
linked to: http://stackoverflow.com/q/223918
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26899783
has body: I'm currently messing around with BlueJ and trying to get objects to interact with each other and stuff. I have created an account and accountlist class. The accountlist allows you to add account objects which it then puts into an arraylist. Removing these accounts from the array by index was easy enough with a for loop to get the position of each account, but now it should remove the Account with the account number specified as a parameter and I can't work out how to get the accountnumber from the array to compare it with the users input. AccountList Class /** * Creates an AccountList that will store customers accounts * * @author Ryan Conway * @version 12/11/2014 */ import java.util.*; public class AccountList { private ArrayList &lt; Account &gt; accounts; /** * Create an AccountList that will contain accounts. */ public AccountList() { accounts = new ArrayList &lt; Account &gt;(); } /** * Add a account to this AccountList. */ public void addAccount(Account newAccount) { accounts.add(newAccount); } /** * Return the number of accounts stored in this AccountList. */ public int getNumberOfAccounts() { return accounts.size(); } /** * prints out the number of accounts to the terminal. * for each loop used to get each account. */ public void getAllAccounts() { for(Account account : accounts) { account.printAccountDetails(); } System.out.println("Number of accounts: " + getNumberOfAccounts()); } /** * Print out details of a account * @param accountEntry The entry in the list */ public void getAccount(int accountEntry) { if(accountEntry &lt; 0) { System.out.println("Negative entry :" + accountEntry); } else if(accountEntry &lt; getNumberOfAccounts()) { Account account = accounts.get(accountEntry); account.printAccountDetails(); } else { System.out.println("No such entry :" + accountEntry); } } /** * removes a account from the list * @param accountEntry The entry in the list */ public void removeAccount(int accountEntry) { if(accountEntry &lt; 0) { System.out.println("Neg…
tagged with: object
has comment: http://stackoverflow.com/comment/42346465

http://stackoverflow.com/comment/42416826
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26931737
has text: If the Category get to deleted, then this solution does not work correclty. for example if category id's like this: **1,2,4**

http://stackoverflow.com/q/26920748
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42416951
has title: GridView setOnItemClickListener don't work
upvote count: 0
has comment: http://stackoverflow.com/comment/42389800
accepted answer: http://stackoverflow.com/a/26936536
has comment: http://stackoverflow.com/comment/42390796
tagged with: android
favorite count: 0
has body: Am trying to get my setOnItemClickListener working, but I can not get it to work. I am newbie android developer. LocationGalleryActivity.java: import java.util.ArrayList; import java.util.Vector; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.GridView; import android.widget.Toast; public class LocationGalleryActivity extends ActionBarActivity { private GridView gridView; private GridViewAdapter customGridAdapter; private Vector<PhotoModel> vphotos; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_location_gallery); //Conectamos a la base de datos LocationsSQLite dbloc = new LocationsSQLite(this, "DBLocations.db", null, 1); //Obtenemos el vector de imagenes vphotos = dbloc.getPhotos(); gridView = (GridView) findViewById(R.id.gridView); customGridAdapter = new GridViewAdapter(this, R.layout.row_grid_image, getData()); gridView.setAdapter(customGridAdapter); gridView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View v, int position, long id) { Log.i("GridView", "Se ha pulsado"); /*Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse( "content://media/internal/images/media")); startActivity(intent); */ Toast.makeText(getApplicationContext(), position + "#Selected", Toast.LENGTH_SHORT).show(); } }); } /** * Obtenemos las imagenes para mostrar en el GridLayout * * @return Array de ImageItems (Imagene y su nombre) */ private ArrayList<ImageItem> getData() { final ArrayList<ImageItem> imageItems = new ArrayList<ImageItem>(); // Vamos obteniendo las imagenes del array for (int i = 0; i < vphotos.size(); i++) { Photo…
tagged with: gridview
downvote count: 1
has answer: http://stackoverflow.com/a/26936536
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26921543
score: -1
has answer: http://stackoverflow.com/a/26921543

http://stackoverflow.com/q/26908557
has body: In my application there are two models with @onetomany realationship. I have defined Room and Seat entities. My first problem is that seats collection always returns null. @Entity public class Room implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long Id; private String name; @OneToMany(mappedBy = "room") Set&lt;Seat&gt; seats = new HashSet(); protected Room() { } public void addSeat(Seat seat) { seat.setAssociatedRoom(this); seats.add(seat); } public Room(String name) { this.name = name; } public String getName() { return this.name; } public String getSeatsToString() { String out = "seats:"; if(seats != null) for (Seat seat : seats) out += seat.getName()+ " "; return out; } } @Entity public class Seat implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; private String name; @ManyToOne @JoinColumn(name = "roomId") private Room room; protected Seat() { } public Seat(String name) { this.name = name; } public String getName() { return this.name; } public void setAssociatedRoom(Room room) { this.room = room; } } This is the code used in database operations. I also need help with implementing search queries like "getSeatsByRoom(String room)". @Component public class SeatServiceImpl implements SeatService { @PersistenceContext private EntityManager em; @Transactional public void persist(Seat seat) { em.persist(seat); } public List&lt;Seat getAllSeats() { TypedQuery&lt;Seat&gt; query = em.createQuery( "SELECT c FROM Seat c", Seat.class); return query.getResultList(); } public List&lt;Seat getSeatsByRoom(String room) { TypedQuery&lt;Seat&gt; query = em.createQuery( "SELECT s FROM Seat s, Room r where s.name = :room and (s.roomId= c.Id)", Seat.class); query.setParameter("room", room); return query.getResultList(); } } Persisting objects: List&lt;Room&gt; rooms = new ArrayList&lt;Room&gt;(); Room roomA = new Room("roomA"); Seat a1 = new Seat("a1"); Seat a2 = new Seat("a2"); SeatService.persist(a1); Sea…
has answer: http://stackoverflow.com/a/26909800
type: UnansweredQuestion
tagged with: orm
has answer: http://stackoverflow.com/a/26908836
tagged with: java
tagged with: persistence.xml
type: Question
score: 0
answer count: 2
has title: Saving and retrieving records in two related tabls wiht JPA
tagged with: jpa

http://stackoverflow.com/a/26907901
has body: If we consider that the first part of the String is the number of milliseconds since the epoch, and the second part is a timezone indication (in that case, IST, Indian Standard Time), you can get a readable date like this : final String jsonDate = "1390361405210+0530"; final Date date = new Date(Long.parseLong(jsonDate.substring(0, jsonDate.length() - 5))); final DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.FULL, Locale.US); format.setTimeZone(TimeZone.getTimeZone("GMT" + jsonDate.substring(jsonDate.length() - 5))); System.out.println(format.format(date)); Output: January 22, 2014 9:00:05 AM GMT+05:30
answers question: http://stackoverflow.com/q/26907298
score: 0
type: Answer

http://stackoverflow.com/comment/42483135
type: QuestionComment
type: Comment
has text: Edited the post and added an MCVE.
comment on: http://stackoverflow.com/q/26970449
score: 0

http://stackoverflow.com/q/26989608
upvote count: 13
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/34639434
tagged with: java
type: Question
has body: public class MyApplication extends ResourceConfig { public MyApplication() { /* // Register resources and providers using package-scanning. packages("com.keylesson.service"); // Register my custom provider - not needed if it's in my.package. register(TestFilter.class); register(TestFilter2.class);*/ } } Above code after un-commenting is able to execute both filter classes but the sequenceing is TestFilter2 and then TestFilter. This Resourceconfig method is something I do not like much and I want to use old style web.xml for Jersey2.3. The jersey 1.x init-params for filters are not working in jersey2.3. Can anyone help me with sample web.xml for jersey2.3 that guarantees the execution of filters? and also in the sequence testfilter and then testfilter2?
tagged with: jersey
linked to: http://stackoverflow.com/q/35914944
has title: Jersey 2.3 Setting Priority for ContainerRequestFilter
has answer: http://stackoverflow.com/a/26991667
accepted answer: http://stackoverflow.com/a/26991667
answer count: 1
downvote count: 0
tagged with: jersey-2.0
tagged with: jax-rs
favorite count: 0
tagged with: web.xml
score: 13

http://stackoverflow.com/comment/42444646
type: AnswerComment
has text: @AP4MH debug it? Or do you expect me to write the whole app for you? :)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26951668

http://stackoverflow.com/comment/42458294
type: Comment
type: QuestionComment
has text: I did try with single quote... it didn't work. I still get an error. And I did, but nothing yet. I am not sure why it's not working. And what it means the error is near "load"
score: 0
comment on: http://stackoverflow.com/q/26953789

http://stackoverflow.com/a/26880385
answers question: http://stackoverflow.com/q/26880269
has comment: http://stackoverflow.com/comment/42317651
has comment: http://stackoverflow.com/comment/42317567
has comment: http://stackoverflow.com/comment/42337162
has body: select your project -> properties(Alt+Enter) ->Java Build Path -> Order and Export-> make sure android 4.1.1 or your target os Checkbok is selected. if not then select click okay clean and rebuild the project. hope you will get your solution.
score: 0
type: Answer

http://stackoverflow.com/comment/42325407
comment on: http://stackoverflow.com/a/26881461
type: AnswerComment
has text: If it isn't a spring-mvc project then why on earth are you using the `@RequestBody` and `@ResopnseBody` annotations? Those are part of Spring MVC... If the class isn't available your dependencies are wrong.
score: 0
type: Comment

http://stackoverflow.com/comment/42494556
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26978865
has text: @user1050755 cool, you could post your result as answer and accept it so that the question is no longer open. Btw, if your source xml provides `utf-16` as encoding then you might want to reflect that in your output using the `f.setEncoding("UTF-16");`, the `Format` defaults to `utf-8` as you have noticed.

http://stackoverflow.com/comment/42301507
has text: long answer short "someObjects1[4].getClass().newInstance();", note that this requires that the SubclassObject has a constructor with no arguments
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26871494
score: 0

http://stackoverflow.com/comment/42378906
score: 1
type: Comment
type: QuestionComment
has text: @ChrisK How is it not thread-safe at all? What do you define as thread-safe?
comment on: http://stackoverflow.com/q/26914888

http://stackoverflow.com/comment/42474717
comment on: http://stackoverflow.com/a/26968689
type: AnswerComment
score: 0
type: Comment
has text: @Fildor right, this is basically an XY problem: "how can I hammer nails with this screw driver tool?" However exploiting the right language construct (tool) to achieve "elegant" code needs some trying. Here one may assume the OP has code with inner classes and now wants to clean that up. Unfortunately using inheritance.

http://stackoverflow.com/q/26921206
downvote count: 1
tagged with: webdriver
type: Question
has body: I'm having a real hard time interacting with this element. I've used FirePath, Selenium IDE, and manual construction of an XPATH to no avail. I'm trying to interact with "Group Accident". I can get Selenium to detect "Accident" by using driver.findElement(By.xpath("//div[@id='manage_area']/ul/li/div")).click(); I want to be able to open the menu and select "Add or View Plan/Options" from Group Accident. https://i.sstatic.net/zAinK.jpg Please help! Thanks. Here's my code: @Test public void testAddEEBenefitsinCOLO() throws Exception { driver.get(baseUrl + "/bcs/stored.asp"); driver.findElement(By.id("TBUserName")).clear(); driver.findElement(By.id("TBUserName")).sendKeys("test"); driver.findElement(By.name("TBPassword")).clear(); driver.findElement(By.name("TBPassword")).sendKeys("pw1"); driver.findElement(By.name("Login")).click(); Thread.sleep(2000); driver.findElement(By.name("TBPARAM")).click(); driver.findElement(By.name("TBPARAM")).clear(); driver.findElement(By.name("TBPARAM")).sendKeys("colo1973"); driver.findElement(By.name("TBPARAM")).sendKeys(Keys.ENTER); driver.findElement(By.id("QRY")).click(); driver.findElement(By.id("QRY")).clear(); driver.findElement(By.id("QRY")).sendKeys("Melvin"); driver.findElement(By.name("B1")).click(); Thread.sleep(5000); driver.findElement(By.xpath("//div[@id='manage_area']/ul/li/div[2]")).click(); Thread.sleep(1000); Error message: org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//div[@id='manage_area']/ul/li/div[2]"} Command duration or timeout: 30.01 seconds HTML: Accident Add: Initial Population Decline Benefit: (Prompt Effective) Add or View Plan/Options Decline Benefit To Top Group Accident Add: Initial Population Decline Benefit: (Prompt Effective) Add or View Plan/Options Decline Benefit
has answer: http://stackoverflow.com/a/26921964
score: 0
has title: Selenium WebDriver: Java: NoSuchElementException: Unable to locate element: {"method":"xpath","selector":"//div[@id='manage_area']/ul/li/div[2]"}
answer count: 2
has answer: http://stackoverflow.com/a/26922558
has comment: http://stackoverflow.com/comment/42391115
favorite count: 0
has comment: http://stackoverflow.com/comment/42390694
type: UnansweredQuestion
tagged with: selenium-webdriver
tagged with: xpath
tagged with: java
tagged with: selenium
upvote count: 1

http://stackoverflow.com/q/26863973
has comment: http://stackoverflow.com/comment/42287630
has answer: http://stackoverflow.com/a/26865062
tagged with: java
accepted answer: http://stackoverflow.com/a/26864075
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26864065
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26864065
has comment: http://stackoverflow.com/comment/42287777
tagged with: inheritance
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/42287928
has comment: http://stackoverflow.com/comment/42287690
favorite count: 0
has comment: http://stackoverflow.com/comment/42294359
has comment: http://stackoverflow.com/comment/42288809
has body: I am new in Java. I got a question in inheritance. I tried to write some kinds of sorting class. They got same data structure and same methods too. So I tried to use inheritance. I wrote this base class. public class Sort { private int[] lst; public Sort(int[] lst) { this.lst = lst; } public void sort() { return; } public String toString() { String aa = ""; for (int innt : this.lst) { aa = aa + innt + "" + " "; } return aa; } } and this public class Select extends Sort{ private int[] lst; public Select(int[] lst) { super(lst); } public void sort() { for (int i = 0; i &lt; this.lst.length; i++) { int small = lst[i]; int small_ind = i; for (int j = i + 1; j &lt; this.lst.length; j++) { if (lst[j] &lt; small) { small = lst[j]; small_ind = j; } } int temp = lst[i]; lst[i] = small; lst[small_ind] = temp; } } } but when I run this public class Test { public static void main(String[] args) { int[] a = {5, 6, 7, 5, 7, 3, 2, 1, 4, 8}; Sort sl = new Select(a); sl.sort(); System.out.println(sl.toString()); } } It does not work. Exception in thread "main" java.lang.NullPointerException It only work when I move the toString method to Select class, and remove "extends Sort". Would you mind helping me? Thanks.
has answer: http://stackoverflow.com/a/26864075
has title: java inheritance Exception in thread "main" java.lang.NullPointerException
score: -1
has comment: http://stackoverflow.com/comment/42289775
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18138526

http://stackoverflow.com/comment/42248286
has text: my guts feeling is telling me something else is throwing exception somewhere else in you program. isEmpty() method should not throw NullPointException. unless ur list is empty to begin with.
comment on: http://stackoverflow.com/q/26841806
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42368458
type: Comment
has text: Nice! Just a little remark: `elements` in this code is slightly different to the result of `String.split` in that it may have an empty string element at the end. The code doesn't ignore trailing separators. But IMHO this is good.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26908824

http://stackoverflow.com/comment/110487924
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/59360814
type: Comment
has text: but how we can manage them new PixelFormat(), attribs

http://stackoverflow.com/q/26985356
favorite count: 0
has answer: http://stackoverflow.com/a/26987915
accepted answer: http://stackoverflow.com/a/26987915
tagged with: android
type: AnsweredQuestion
downvote count: 0
has title: Navigation Drawer Menu method that gets called everytime it's opened?
has comment: http://stackoverflow.com/comment/42504701
has body: I'm attempting to refresh my current logged in user using the Parse.com framework, and update a label everytime the Navigation Drawer menu is opened. Unfortunately I cannot figure out which method is called every time it's opened to do so. I've tried doing this in the NavigationDrawerAdapter: @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater mInflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); if (listofItems.get(position) instanceof NavigationDrawerListItem) { convertView = mInflater.inflate( R.layout.navigation_drawer_list_item, null); return convertView; } else if (listofItems.get(position) instanceof NavigationDrawerUserInformation) { convertView = mInflater.inflate( R.layout.navigation_drawer_list_object, null); final TextView userName = (TextView) convertView .findViewById(R.id.txtvDrawerFirstItemText1); ParseUser.getCurrentUser().fetchInBackground( new GetCallback&lt;ParseUser&gt;() { @Override public void done(ParseUser user, ParseException e) { // TODO Auto-generated method stub if (e == null) { if (ParseAnonymousUtils.isLinked(user)) { userName.setText("Welcome Guest"); } else { userName.setText("Welcome, " + user.getUsername() + "!"); } } } }); return convertView; } return null; } But the label is never updated with new information unless I navigate away from the current fragment by clicking another in the menu and open the menu again. Each item in the list is just a new fragment which all opens up in the same Activity.
tagged with: navigation-drawer
type: Question
tagged with: android-fragments
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42504208
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42335727
score: 0
type: Comment
type: QuestionComment
has text: @JonSkeet got ya ! Thanks Jon.
comment on: http://stackoverflow.com/q/26890603

http://stackoverflow.com/comment/42507579
type: Comment
has text: I was reusing a solution found in here http://stackoverflow.com/questions/8479924/trying-to-query-database-using-preparedstatement-resultset-is-coming-back-close I thought the reason he closed the connection within the finally block was so that the connection will close after it was done being used. I have however removed that finally block and that useStmt.executeUpdate(); line of code which, you are right, makes no sense. Instead of using that finally block I created a new method that closes the connection when called. I will update my question with my changes which fixed the issue.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26987163

http://stackoverflow.com/comment/42348695
has text: @markspace how is `double` better? it will lose precision even faster than long
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26897748

http://stackoverflow.com/comment/51526353
type: AnswerComment
score: 0
has text: Is that necessary when using the inMemory option?
type: Comment
comment on: http://stackoverflow.com/a/31487843

http://stackoverflow.com/comment/42516822
score: 0
type: AnswerComment
type: Comment
has text: Thanks for your input. I am using AXIS2 webservices will this be possible for these webservices.
comment on: http://stackoverflow.com/a/26989644

http://stackoverflow.com/comment/42392655
type: QuestionComment
has text: @AndrewThompson: we answered at the same time. I made my answer a "community wiki" because it seems too trivial to get points for it.
comment on: http://stackoverflow.com/q/26922554
score: 0
type: Comment

http://stackoverflow.com/q/26921372
score: -1
has title: Setting the counter to 0, then adding counters with methods are keeping it 0
answer count: 2
upvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: count
has body: I have a guessing program, and Im trying to add a counter. In the bolded parts I have a counter. When you get a guess wrong, it adds 1 to the counter. But when it prints it, it just prints as 0 no matter what. public static void firstGame(String Answer, String userGuess, int counter) { userInput = new Scanner(System.in); boolean playgame = true; while(playgame == true) { Answer = "Sam"; lnPrint(" "); lnPrint("Take a guess at my name! It starts with an S..."); sPrint(":"); userGuess = userInput.next(); if(userGuess.equalsIgnoreCase(Answer)) { lnPrint("You got it! Its " + Answer); lnPrint(" "); break; } else if(userGuess != Answer) { lnPrint("Good guess, keep trying!"); counter++; } } } That is my game method with the counter. public static void main(String[] args) { Scanner userInput = new Scanner(System.in); int Start, counter = 0; String Answer, userGuess, middleAnswer, middleUserGuess; Answer = null; userGuess = null; middleAnswer = null; middleUserGuess = null; Start = 0; while(Start !=2) { lnPrint("(1) Start Game"); lnPrint("(2) Exit"); sPrint(":"); Start = userInput.nextInt(); if(Start == 1) { firstGame(userGuess, Answer, counter); lnPrint("Now, how about my middle name?"); nlnPrint(counter); middleGame(middleAnswer, middleUserGuess); } This is the code that prints it
has answer: http://stackoverflow.com/a/26921526
tagged with: zero
tagged with: methods
has answer: http://stackoverflow.com/a/26921763
downvote count: 1
linked to: http://stackoverflow.com/q/3326112
type: Question
tagged with: java
tagged with: counter

http://stackoverflow.com/comment/42363837
comment on: http://stackoverflow.com/a/26890482
type: AnswerComment
type: Comment
has text: A new problem should be a new Question.
score: 0

http://stackoverflow.com/q/26956000
tagged with: java
has answer: http://stackoverflow.com/a/26956048
type: Question
tagged with: android-layout
tagged with: intellij-idea
has title: Error while loading custom Android View: Resources$NotFoundException: Resource ID #0x7f060007 type #0x12 is not valid
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
has body: I have this XML file called player_small.xml in the res/layout folder of my project: &lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/player_small" android:layout_width="match_parent" android:layout_height="match_parent" android:rowCount="3" android:columnCount="4"&gt; &lt;ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/player_small_play" android:layout_gravity="center" android:layout_row="0" android:layout_rowSpan="2" android:layout_column="0" android:src="@drawable/play"/&gt; &lt;ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/next" android:id="@+id/player_small_next" android:layout_gravity="center" android:layout_row="0" android:layout_rowSpan="2" android:layout_column="1"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Title" android:textStyle="bold" android:textSize="@dimen/defaultFontSize" android:id="@+id/player_small_title" android:layout_gravity="center_vertical|left|right" android:layout_row="0" android:layout_column="3"/&gt; &lt;Space android:layout_width="30px" android:layout_height="10px" android:layout_row="2" android:layout_column="2"/&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Artist" android:textSize="@dimen/defaultFontSize" android:id="@+id/player_small_artist" android:layout_gravity="center_vertical|left|right" android:layout_row="1" android:layout_column="3"/&gt; &lt;/GridLayout&gt; Then, I have defined a custom view called SmallPlayerView containing all 3 constructors from the superclass FrameLayout all calling this method: protected void initSmallPlayerView () { View view = inflate(getContext(), R.id.player_small, null); addView(view); } InteliJ IDEA can display the class correct when using it from another XML-Layout-file, but when I launch it on my phone or the emulator it c…
accepted answer: http://stackoverflow.com/a/26956048
type: AnsweredQuestion

http://stackoverflow.com/comment/42513065
type: QuestionComment
score: 0
has text: Serialize the array ..
comment on: http://stackoverflow.com/q/26990649
type: Comment

http://stackoverflow.com/comment/42251758
type: Comment
has text: yes. and it's name attribute MUST be `user.id` (not `user`), optionally you can add the user AFTER bindingFromRequest, anyway you need to show what you have now there)
comment on: http://stackoverflow.com/a/26843200
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43238362
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26888819
type: AnswerComment
has text: idk, i don't gave you a -1

http://stackoverflow.com/a/26874290
score: 0
has comment: http://stackoverflow.com/comment/42306627
type: Answer
has body: Did you take a closer look into the style XML? Cause you only wrote about the layout XML.. There they can also refer to to the drawable.. It's just a hint.. I'm also interested solving this issue.. But logically, somehow, somewhere they need to refer..
answers question: http://stackoverflow.com/q/26874165

http://stackoverflow.com/comment/46836489
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26913957
score: 0
has text: Maybe this will help: http://stackoverflow.com/questions/29095967/splitting-list-into-sublists-along-elements/29096777#29096777

http://stackoverflow.com/q/26972966
answer count: 1
has comment: http://stackoverflow.com/comment/42481805
has title: export java application with csv file
has comment: http://stackoverflow.com/comment/42481319
has comment: http://stackoverflow.com/comment/42481247
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2671796
has answer: http://stackoverflow.com/a/26973203
has body: I have one java application in which I have used two excel files (.csv files) as a input.I want to make runnable jar of that java application.But after exporting that java project as a runnable jar when I run that jar it does not contain the two input csv files. Can any one help me how to export java application with csv files. Below is the line of code I have used to access the csv file String csvFile = "./input/silkair.Schedule1 (1).csv"; //InputStream inputStream = getClass().getResourceAsStream(csvFile); BufferedReader br = null; // br = new BufferedReader(new InputStreamReader(inputStream)); br = new BufferedReader(new FileReader(csvFile));
has comment: http://stackoverflow.com/comment/42482195
tagged with: java
has comment: http://stackoverflow.com/comment/42481368
type: Question
has comment: http://stackoverflow.com/comment/42481311
tagged with: executable-jar
score: 0
tagged with: http://stackoverflow.com/tag/csv

http://stackoverflow.com/a/26976065
answers question: http://stackoverflow.com/q/26975977
score: 0
type: Answer
has body: answer == "yes" You are checking if two objects are the same. You should use the equals method answer.equals("yes") || answer.equals("y")

http://stackoverflow.com/q/26938210
upvote count: 29
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3984076
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26938900
downvote count: 0
has comment: http://stackoverflow.com/comment/42421493
has answer: http://stackoverflow.com/a/34923574
has body: I have a basic question about how ExecutorService works in Java. It is quite hard to see the difference between simply creating Threads to perform some tasks in parallel and assigning each tasks to the ThreadPool. The ExecutorService also looks very simple and efficient to use, so I was wondering why we don't use it all the time. Is it just a matter of one way executing its job faster than the other ? Here's two very simple examples to show the difference between the two ways : Using executor service: Hello World (task) static class HelloTask implements Runnable { String msg; public HelloTask(String msg) { this.msg = msg; } public void run() { long id = Thread.currentThread().getId(); System.out.println(msg + " from thread:" + id); } } Using executor service: Hello World (creating executor, submitting) static class HelloTask { public static void main(String[] args) { int ntasks = 1000; ExecutorService exs = Executors.newFixedThreadPool(4); for (int i=0; i&lt;ntasks; i++) { HelloTask t = new HelloTask("Hello from task " + i); exs.submit(t); } exs.shutdown(); } } the following shows a similar example but extending the Callable interface, could you tell me the difference between the two and in which cases one should use a specific one instead of the other ? Using executor service: Counter (task) static class HelloTaskRet implements Callable&lt;Long&gt; { String msg; public HelloTaskRet(String msg) { this.msg = msg; } public Long call() { long tid = Thread.currentThread().getId(); System.out.println(msg + " from thread:" + tid); return tid; } } Using executor service: (creating, submitting) static class HelloTaskRet { public static void main(String[] args) { int ntasks = 1000; ExecutorService exs = Executors.newFixedThreadPool(4); Future&lt;Long&gt;[] futures = (Future&lt;Long&gt;[]) new Future[ntasks]; for (int i=0; i&lt;ntasks; i++) { HelloTaskRet t = new HelloTaskRet("Hello from task " + i); futures[i] = exs.submit(t); } exs.shutdown(); } }
linked to: http://stackoverflow.com/q/21156599
possible better answer: http://stackoverflow.com/a/34923574
tagged with: executorservice
favorite count: 0
has title: ExecutorService vs Casual Thread Spawner
accepted answer: http://stackoverflow.com/a/26938900
tagged with: multithreading
score: 29

http://stackoverflow.com/comment/42336897
has text: which line has the nullpointer exception? that is relevant info. instead of System.out.println(e) , use e.printStackTrace() to get the full stacktrace.oops only now noticed the top 4 lines contain npe, not the onlcick
comment on: http://stackoverflow.com/q/26890151
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26896523
tagged with: java
type: Question
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/42346436
has title: Can't send basic email with javamail
answer count: 1
score: 0
has body: I'm trying to send the most basic e-mail using javamail. I basically copy pasted the code given here but still get an exception: http://www.tutorialspoint.com/java/java_sending_email.htm I've searched for similar errors but can't find an answer. Code: package main.java; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class Email { /* * This class sends an email to a specified email address */ private final String recipient = "foo@baz.com"; private final String sender = "baz@foo.com"; private Properties properties = null; private Session session = null; public Email() { properties = System.getProperties(); properties.setProperty("mail.smtp.host", "localhost"); session = Session.getDefaultInstance(properties); } public void send() { try{ // Create a default MimeMessage object. MimeMessage message = new MimeMessage(session); // Set From: header field of the header. message.setFrom(new InternetAddress(sender)); // Set To: header field of the header. message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient)); // Set Subject: header field message.setSubject("This is the Subject Line!"); // Now set the actual message message.setText("This is actual message"); // Send message Transport.send(message); System.out.println("Sent message successfully...."); }catch (MessagingException mex) { mex.printStackTrace(); } } } I also added the following dependencies in Maven: com.sun.mail javax.mail 1.5.1 javax.activation activation 1.1.1 I get the following exception: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: localhost, 25; timeout -1; nested exception is: java.net.ConnectException: Connection refused: connect ... Caused by: java.net.ConnectException: Connection refused: connect
has answer: http://stackoverflow.com/a/26896639
tagged with: email
tagged with: maven
tagged with: localhost
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26896639

http://stackoverflow.com/comment/42249395
has text: @kleopatra sounds simple, the only thing id need to keep the free threads from using the same target would be to add the finished ones to the end. Might give it a shot! If anyone cares to point out why that would be inefficient, is welcome to do so, but I think this might be the perfect solution for a project of my scale.
comment on: http://stackoverflow.com/a/26839495
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42274036
score: 0
type: QuestionComment
type: Comment
has text: If you are using Java DSL (http://camel.apache.org/java-dsl.html), you can programmatically to start route. Simple way is read properties and write if else statement in the route.
comment on: http://stackoverflow.com/q/26842909

http://stackoverflow.com/a/26984811
accepted answer of: http://stackoverflow.com/q/26984591
answers question: http://stackoverflow.com/q/26984591
type: AcceptedAnswer
score: 0
type: Answer
has body: If it works on emulator but not in your device, there must be some discrepancy with the device's data. Make sure you're not comparing against a blank string or some other non-EditText related issue.
has comment: http://stackoverflow.com/comment/42546098

http://stackoverflow.com/comment/42270608
score: 0
type: Comment
has text: @yts My lecture said it was a temporary value because it doesn't effect the main method. this was the example he gave us. Ill look up pass by value
type: QuestionComment
comment on: http://stackoverflow.com/q/26853901

http://stackoverflow.com/q/26895582
type: Question
tagged with: http://stackoverflow.com/tag/html
has body: I have an HTML file: &lt;div&gt; DIV1 &lt;div&gt; DIV2 &lt;div&gt; DIV3 &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; I want to parse that HTML. However I don't want to get whole parsed HTML as a string: DIV1 DIV2 DIV3 I would like to get values element by element but none of them duplicated. I mean I don't want that: When you get first div's value it is: DIV1 DIV2 DIV3 Seconds div's value: DIV2 DIV3 Third div's value: DIV3 The result that I don't want is: DIV1 DIV2 DIV3 DIV2 DIV3 DIV3 I want that result: DIV1 DIV2 DIV2 I will apply some procedure to them and I don't want duplicated values as well. I want to use a Java parser to solve my problem. I've considered to use Jsoup but you get entire HTML parsed when you use it.
tagged with: parsing
has answer: http://stackoverflow.com/a/26895963
score: 0
answer count: 1
tagged with: java
type: UnansweredQuestion
has title: Parsing HTML Element By Element at Java

http://stackoverflow.com/q/26946212
score: 0
tagged with: http://stackoverflow.com/tag/csv
type: UnansweredQuestion
type: Question
tagged with: java
has body: I am reading csv file method as under - public ArrayList&lt;String&gt; fileRead(File f) throws IOException { FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); ArrayList&lt;String&gt; CSVData = new ArrayList&lt;String&gt;(); String text; try { while ((text = br.readLine()) != null) { CSVData.add(text); log.debug(text); } log.info(f + ": Read successfully"); br.close(); fr.close(); } catch (IOException e) { log.error("Error in reading file " + e.getMessage()); } return CSVData; } but I want to read file till defined column number e.g. till 20th column, but if in between I will found empty cell for some column then as above code it will exit on (text = br.readLine()) != null , so finally my question is how to read CSV file till particular columns either its empty cell or whatever it should read till those column and break point for moving next line should be that column example 20th column , Thank in advance for help and support
has comment: http://stackoverflow.com/comment/42435107
has answer: http://stackoverflow.com/a/26947204
answer count: 1
has title: reading CSV file till particular column numbers

http://stackoverflow.com/comment/42247095
has text: In pseudo code when it says: "for i=1 to num-1", it means the loop should be "for(int i = 1; i < num; ++i)".
comment on: http://stackoverflow.com/q/26841523
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26903362
has body: If I understand your question, then I believe the easiest approach is to use a StringBuilder and dynamically build your output String. Iterate each array in your multidimensional array, and test each value (using else so that each test doesn't logically exclude the previous tests) like int[][] result = { { 1, 179 }, { 205, 231 }, { 256 } }; StringBuilder sb = new StringBuilder("["); for (int i = 0; i &lt; result.length; i++) { int[] arr = result[i]; if (i != 0) { sb.append(", "); } sb.append("["); for (int j = 0; j &lt; arr.length; j++) { if (j != 0) { sb.append(", "); } if (arr[j] &gt;= 179 &amp;&amp; arr[j] &lt;= 204) { sb.append("\\"); } else if (arr[j] &gt;= 205 &amp;&amp; arr[j] &lt;= 230) { sb.append("."); } else if (arr[j] &gt;= 231 &amp;&amp; arr[j] &lt;= 255) { sb.append(" "); } else { sb.append(arr[j]); } } sb.append("]"); } sb.append("]"); System.out.println(sb.toString()); Output is [[1, \], [., ], [256]]
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26903237
has comment: http://stackoverflow.com/comment/42358655
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42499478
type: AnswerComment
has text: I tried that and always I was getting Date object in HKT instead of EST.
comment on: http://stackoverflow.com/a/26981842
type: Comment
score: 0

http://stackoverflow.com/comment/42417392
type: AnswerComment
comment on: http://stackoverflow.com/a/26919195
score: 0
type: Comment
has text: It seems that "file.txt" is not enough but also the path has to be mentioned starting from the Repo's root folder (for example if the file is located at <repo>/src/file.txt, the path is "src/file.txt." After that, adding commit.getCommitTime() did the trick. Thank you for your answer!

shape-rendering
tags question: http://stackoverflow.com/q/26926671
type: Tag
tag name: shape-rendering

http://stackoverflow.com/q/26874173
has body: I have created a constructor that takes in a .txt file name and print the data in it as an ArrayList. public class rrr { private String filename; public rrr(String afilename){ afilename=filename; } public void readdtata() throws IOException { FileReader p1=new FileReader(filename); BufferedReader p2=new BufferedReader(p1); ArrayList&lt;String&gt; data=new ArrayList&lt;String&gt;(); String line; while((line=p2.readLine()) != null){ data.add(line); } p2.close(); for(int i=0;i&lt;data.size();i++){ System.out.println(data.get(i)); } } } when trying to test it I get these errors Exception in thread "main" java.lang.NullPointerException at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:116) at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:79) at java.io.FileReader.&lt;init&gt;(FileReader.java:41) at rrr.readdtata(rrr.java:14) at testin.main(testin.java:17) does anyone have an Idea about how to solve this problem please.
tagged with: arraylist
tagged with: nullpointerexception
tagged with: text-files
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42306265
has title: NullPointerException When Reading Text File
has answer: http://stackoverflow.com/a/26874231
type: Question
tagged with: null
tagged with: java
has comment: http://stackoverflow.com/comment/42306222
score: 0
accepted answer: http://stackoverflow.com/a/26874231
answer count: 1

http://stackoverflow.com/q/26886261
tagged with: java
tagged with: memory
type: Question
has comment: http://stackoverflow.com/comment/42327195
has body: Is it possible to do it programmatically? Here is what I've tried: import java.util.ArrayList; import java.util.List; public class TestMemory { public static void main(String[] args) { int kb = 1024; //Getting the runtime reference from system Runtime runtime = Runtime.getRuntime(); //Print used memory System.out.println("Used Memory:" + (runtime.totalMemory() - runtime.freeMemory()) / kb); //Print free memory System.out.println("Free Memory:" + runtime.freeMemory() / kb); //Print total available memory System.out.println("Total Memory:" + runtime.totalMemory() / kb); //Print Maximum available memory System.out.println("Max Memory:" + runtime.maxMemory() / kb); List&lt;String&gt; list = new ArrayList&lt;&gt;(); for (int i = 0; i &lt; 10000; i++) { for (int j = 0; j &lt; 1000; j++) { list.add("abcdefghij" + i + j); } if (i % 1000 == 0) { try { Thread.sleep(500); System.out.println("Free Memory:" + runtime.freeMemory() / kb + " Kb"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } } and the output: Used Memory:289 Free Memory:15582 Total Memory:15872 Max Memory:126720 Free Memory:15405 Kb Free Memory:22820 Kb (long pause, longer than 500ms and then exception) Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOfRange(Arrays.java:2694) at java.lang.String.&lt;init&gt;(String.java:203) at java.lang.StringBuilder.toString(StringBuilder.java:405) at TestMemory.main(TestMemory.java:32) It doesn't say to much to me. I expect "Free Memory" value to decrease before the crash. How to write a cycle checking the available memory and informing me about the amount of memory before this exception?
accepted answer: http://stackoverflow.com/a/26887966
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26886357
upvote count: 2
possible better answer: http://stackoverflow.com/a/26887070
has answer: http://stackoverflow.com/a/26887070
has title: How to predict java.lang.OutOfMemory exception?
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26887966

http://stackoverflow.com/q/26973899
has answer: http://stackoverflow.com/a/28063980
tagged with: solr
has answer: http://stackoverflow.com/a/34119306
type: Question
has body: I am following the tutorial to set-up Solr (http://lucene.apache.org/solr/quickstart.html) using Windows 7, Java version 1.8 and Solr version 4.10.2. Java is installed at C:\root\java and Solr is installed at c:\root\solr-4.10.2. I have added 2 Environment Variables as User variables: CLASSPATH = C:\ROOT\solr-4.10.2\dist\solr-core-4.10.2.jar JAVA_HOME = c:\root\java I then run the following code in my command prompt: cd c:\root\solr-4.10.2\bin &amp; solr start -e cloud -noprompt The output is pasted below. The Solr server for collection1 seems to be working fine, although the gettingstarted core was not added. But, why are there errors for ZkCLI and SolrCLI? Am I doing something wrong? Welcome to the SolrCloud example Starting up Solr nodes for your example SolrCloud cluster. Starting node1 on port 8983 using command: solr -cloud -p 8983 -d node1 Waiting for 0 seconds, press a key to continue ... Starting node2 on port 7574 using command: solr -cloud -p 7574 -d node2 -z localhost:9983 Waiting for 0 seconds, press a key to continue ... Now let's create a new collection for indexing documents in your 2-node cluster. Deploying default Solr configuration files to embedded ZooKeeper Error: Could not find or load main class org.apache.solr.cloud.ZkCLI Creating new collection gettingstarted with 2 shards and replication factor 2 us ing Collections API command: "http://localhost:8983/solr/admin/collections?action=CREATE&amp;name=gettingstarted&amp; replicationFactor=2&amp;numShards=2&amp;collection.configName=default&amp;maxShardsPerNode=3 &amp;wt=json&amp;indent=2" For more information about the Collections API, please see: https://cwiki.apache .org/confluence/display/solr/Collections+API Error: Could not find or load main class org.apache.solr.util.SolrCLI SolrCloud example is running, please visit http://localhost:8983/solr" c:\ROOT\solr-4.10.2\bin&gt;java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b18) Java HotSpot(TM) 64-Bit Server…
answer count: 8
has answer: http://stackoverflow.com/a/26981449
possible better answer: http://stackoverflow.com/a/46133618
tagged with: java
has answer: http://stackoverflow.com/a/46133618
score: 4
tagged with: lucene
has title: Solr Setup - Error: Could not find or load main class org.apache.solr.cloud.ZkCLI
has answer: http://stackoverflow.com/a/27453343
upvote count: 4
tagged with: apache-zookeeper
has answer: http://stackoverflow.com/a/56808728
downvote count: 0
has answer: http://stackoverflow.com/a/27936920
favorite count: 0
tagged with: windows
has answer: http://stackoverflow.com/a/31077536
accepted answer: http://stackoverflow.com/a/27453343
type: AnsweredQuestion

http://stackoverflow.com/q/26840134
downvote count: 0
has title: Why doesn't profiler see one of time-consuming methods?
has answer: http://stackoverflow.com/a/26876366
tagged with: profiling
linked to: http://stackoverflow.com/q/504103
favorite count: 0
tagged with: visualvm
tagged with: multidimensional-array
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has body: I am trying to profile two implementation ideas of multidimensional array classes. In the code below, application creates thee huge multidimensional array of three classes: Array1, Array2 and conventional. Application first creates arrays, which is not measured. Then it fills each array and read each of them by order. Time measurement occurs both programmatically and by profiler. Unfortunately, section timings are not coincide. For example, the methods or class Array2 which consumes nearly half time, are not listed in profiler at all. Why? main code: package tests; public class Runner01 { private static final int[] dims = {400, 100, 20, 300}; static private double[] data; static private Array1 array1; static private Array2 array2; static private double[][][][] array3; public static interface MyRunnable { public void run(int ii, int i, int j, int k, int l); } public static long test(MyRunnable runnable) { long start = System.nanoTime(); int ii = 0; for (int i = 0; i &lt; dims[0]; ++i) { for (int j = 0; j &lt; dims[1]; ++j) { for (int k = 0; k &lt; dims[2]; ++k) { for (int l = 0; l &lt; dims[3]; ++l) { runnable.run(ii, i, j, k, l); ii++; } } } } long end = System.nanoTime(); System.out.println("Done in " + (double) (end - start) / 1000000000 + " seconds"); return end - start; } public static void main(String[] args) { int ii; long start, end, elapsed; start = System.nanoTime(); System.out.println("Filling..."); int size = 1; for (int i = 0; i &lt; dims.length; ++i) { size *= dims[i]; } data = new double[size]; for (int i = 0; i &lt; data.length; ++i) { data[i] = Math.random(); } array1 = new Array1(dims); array2 = new Array2(dims); array3 = new double[dims[0]][dims[1]][dims[2]][dims[3]]; System.out.println("Done."); System.out.println("Writing array1..."); test(new MyRunnable() { @Override public void run(int ii, int i, int j, int k, int l) { array1.set(data[ii], i, j, k, l); } }); System.out.println("Writing array2..."); test(new MyRunnable() { @Override public void …
type: Question
answer count: 1

http://stackoverflow.com/comment/42500446
comment on: http://stackoverflow.com/a/26937797
type: AnswerComment
has text: BigInteger seems excessive since a 32 bit integer is fine for this.
score: 0
type: Comment

http://stackoverflow.com/a/26947158
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26935593
type: AcceptedAnswer
downvote count: 0
has body: It is up to you to return an implementation of a CacheLoader from the method in your class MyCacheLoaderFactory. The first parameter is the cache for which the loader is to be returned - as documented in the Javadoc for CacheLoaderFactory.createCacheLoader it is not yet initialized and so should not be used, however its configuration can be queried. This parameter is useful when you use a single factory to provide CacheLoaders to different caches. The second parameter is the properties that were defined in the XML configuration, same as you do with the cacheDecoratorFactory.
answers question: http://stackoverflow.com/q/26935593
type: Answer
score: 1

http://stackoverflow.com/a/26974684
has comment: http://stackoverflow.com/comment/42484556
has comment: http://stackoverflow.com/comment/42484472
answers question: http://stackoverflow.com/q/26974448
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42484517
has body: As I understood your question, you could create a method that take a list of indexes as parameters. For generic arrays, you'll need to use Array.newInstance and cast the resulting array to T[] (thanks and kudos for @Radiodef for pointing this out) //for lists static &lt;T&gt; List&lt;T&gt; buildList(List&lt;T&gt; original, int... indexes){ List&lt;T&gt; finalList = new ArrayList&lt;&gt;(); for(int index : indexes){ finalList.add(original.get(index)); } return finalList; } //for arrays static &lt;T&gt; T[] buildArray (T[] original, int... indexes){ @SuppressWarnings("unchecked") T[] finalArray = (T[])Array.newInstance(original.getClass().getComponentType(), indexes.length); for(int i = 0; i &lt; indexes.length; i++){ finalArray[i] = original[indexes[i]]; } return finalArray; } Few notes : For primitive arrays (like int[] or double[]), you'll have to overload the methods, that's why I suggest you to use a List with generics instead. Indexes for arrays in Java are 0 based (starts from 0 to length-1) Don't forget to add additional checks for the method (valid index, original list or index not null) If you use a LinkedList instead of an ArrayList, be aware that #get(int index) is an O(n) operation instead of O(1) Example of usage : public static void main(String[] args) { Integer[] xArray = {-1, 10, 24, 7}; List&lt;Integer&gt; xList = Arrays.asList(-1, 10, 24, 7); System.out.println(Arrays.toString(buildArray(xArray, 0, 2))); System.out.println(buildList(xList, 0, 1, 3)); } Which outputs: [-1, 24] [-1, 10, 7]
has comment: http://stackoverflow.com/comment/42484594
downvote count: 0
has comment: http://stackoverflow.com/comment/42484615

http://stackoverflow.com/comment/42412369
type: Comment
type: QuestionComment
has text: I assume the main issue is with @ApiResponses?
comment on: http://stackoverflow.com/q/26933627
score: 0

http://stackoverflow.com/a/26876258
type: Answer
score: 2
upvote count: 2
has body: Firstly, if you want to avoid building a tree for the source document in memory, then you're going to have to run this with XSLT 3.0 streaming - which means you need a Saxon-EE license. (However, it's quite feasible to process a 100Mb file the traditional way, with a tree in memory). Secondly, if you want the output of xsl:result-document to be captured as in-memory streams rather than being written to filestore, then in Saxon the way to achieve this is to write and register an OutputURIResolver. This will be called once for each result document, and can specify a destination (such as a StreamResult or SAXResult) to receive the document.
answers question: http://stackoverflow.com/q/26868253
downvote count: 0

http://stackoverflow.com/q/26949329
has title: How to reverse Greek letters with BufferedReader in Java?
has comment: http://stackoverflow.com/comment/42452554
type: Question
has answer: http://stackoverflow.com/a/26950503
has answer: http://stackoverflow.com/a/26949775
accepted answer: http://stackoverflow.com/a/26949775
possible better answer: http://stackoverflow.com/a/26950503
score: 0
has answer: http://stackoverflow.com/a/26950608
answer count: 3
has comment: http://stackoverflow.com/comment/42440723
has body: I am new to Java and I have this Reverse code. My question is how can I use BufferedReader in order to when I write greek letters (like ξηφαιπασς) it will also return reversed greek letters. At the moment all I get is some squares. First time I write a question here so please forgive me for any mistake. import java.io.*; // for I/O //////////////////////////////////////////////////////////////// class StackX { private int maxSize; private char[] stackArray; private int top; //------------------------------------------------------------- public StackX(int max) // constructor { maxSize = max; stackArray = new char[maxSize]; top = -1; } //------------------------------------------------------------- public char pop() // take item from top of stack { return stackArray[top--]; } //-------------------------------------------------------------&gt; public boolean isEmpty() // true if stack is empty { return (top == -1); } //------------------------------------------------------------- } // end class StackX //////////////////////////////////////////////////////////////// class Reverser { private String input; // input string private String output; // output string &gt; public Reverser(String in) // constructor { input = in; } //-------------------------------------------------------------&gt; public String doRev() // reverse the string { int stackSize = input.length(); // get max stack size StackX theStack = new StackX(stackSize); // make stack for(int j=0; j&lt;input.length(); j++) { char ch = input.charAt(j); // get a char from input theStack.push(ch); // push it } output = ""; while( !theStack.isEmpty() ) { char ch = theStack.pop(); // pop a char, output = output + ch; // append to output } return output; } // end doRev() //-------------------------------------------------------------&gt; } // end class Reverser //////////////////////////////////////////////////////////////// class ReverseApp { public static void main(String[] args) throws IOException { String input, outp…
tagged with: letter
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42393953
has text: First of all, share ur driver too. Next show what's the current output and the expected one.
comment on: http://stackoverflow.com/q/26915707
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26943723
has body: I think you need some kind of synchronization to be sure that your receiver is ready to receive message. For example, you can use CountDownLatch In you Sender you should await() and Receiver should call countDown() on latch object. Try this out to be sure that your Receiver is ready to receive message when the message is sent. If this won't help then show your Sender and Receiver code.
answers question: http://stackoverflow.com/q/26942402
score: 0
type: Answer

http://stackoverflow.com/comment/42506892
has text: For some reason PrinterState&PrinterStateReasons doesn't supports, printService.getSupportedAttributeCategories() didn't return them
comment on: http://stackoverflow.com/a/26986677
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26884379
score: 0
has body: Basically in one fragment, I have 3 toggle buttons, therefore I decided that my interface should implement OnCheckedChange. These buttons are : date button, time button and now button. The work flow would be the following: date is pressed, date image is changed to being active, check if time is pressed, check mark is active time is pressed, date image is changed to being active, check if date is pressed, check mark is active now is pressed, date and time won't be active but check mark will. What I've done is the following: public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { switch (buttonView.getId()) { case R.id.select_date_button: { DialogFragment datePicker = new DatePickerFragment(); datePicker.setTargetFragment(CheckinNow.this, 100); datePicker.show(getActivity().getSupportFragmentManager(), "datePicker"); date_image.setBackgroundResource(R.drawable.btn_calendar_active); break; } case R.id.select_time_button: { DialogFragment timePicker = new TimePickerFragment(); timePicker.setTargetFragment(CheckinNow.this, 100); timePicker.show(getActivity().getSupportFragmentManager(), "timePicker"); time_image.setBackgroundResource(R.drawable.btn_time_active); } case R.id.now_button: { now_button.setBackgroundResource(R.drawable.btn_now_with_text_active); checkin_button_done.setBackgroundResource(R.drawable.btn_checkmark_active); time_image.setBackgroundResource(R.drawable.btn_time); date_image.setBackgroundResource(R.drawable.btn_calendar); } default: break; } My question is how can I check when date is pressed and time as well or the other way around? I can, of course, set an OnCheckedChanged for each button individually, but I'd prefer this solution if possible.
answer count: 1
tagged with: events
tagged with: oncheckedchanged
tagged with: android
has answer: http://stackoverflow.com/a/26884517
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42324316
tagged with: java
type: Question
has title: Implementing OnCheckedChanged in Java
accepted answer: http://stackoverflow.com/a/26884517

http://stackoverflow.com/a/27632704
answers question: http://stackoverflow.com/q/26973954
score: 0
type: Answer
has body: I seem to have found the cause of the issues. There are bugs with services provided by ProjectForge. When ever those services are called it ends up throwing error.

http://stackoverflow.com/a/26915465
answers question: http://stackoverflow.com/q/26915167
has body: Try this : int result = maxValue( userMatrix( input, lengthRow(input), lengthColumn(input) ) ); You have to call the methods you have defined.
type: Answer
score: 0

http://stackoverflow.com/a/26949647
has comment: http://stackoverflow.com/comment/42440751
type: Answer
score: 2
downvote count: 0
has body: when you say execute this URL, it means making a HTTP call to this URL I assume, looking at the URL looks like you want to make a GET request, you can use commons-httpclient for this purpose
has comment: http://stackoverflow.com/comment/42440728
upvote count: 2
answers question: http://stackoverflow.com/q/26949618
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26949618

http://stackoverflow.com/comment/42237356
has text: See also [Making a robust, resizable Swing Chess GUI](http://stackoverflow.com/q/21142686/418556).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26834373
score: 0

http://stackoverflow.com/a/26860203
answers question: http://stackoverflow.com/q/26860173
accepted answer of: http://stackoverflow.com/q/26860173
downvote count: 0
has comment: http://stackoverflow.com/comment/42281395
type: AcceptedAnswer
has body: If multiple threads are modifying the same instance of a StringBuilder, the result can be unexpected - i.e. some of the modifications may be lost. That's why you should use StringBuffer in such situations. If, however, each thread StringBuilder instance can be modified by only one thread, it is better to use StringBuilder, since it would be more efficient (thread safety comes with a performance cost).
type: Answer
score: 19
upvote count: 19

http://stackoverflow.com/comment/42240934
comment on: http://stackoverflow.com/q/26837740
has text: @St.Antario do you know what `BufferedWriter` does?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26869641
linked to: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/42298135
has comment: http://stackoverflow.com/comment/42298256
has comment: http://stackoverflow.com/comment/42298195
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42298745
answer count: 0
tagged with: java
has title: Junit - spring autowired fields are not injected
type: Question
duplicate of: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/42298288
has body: I have the following test class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/spring/application-context.xml" }) public class TestSanity { @Test public void testSanity() { new AnotherTestClass().simpleTest(); } } Problem is AnotherTestClass autowire fields are all null (the spring context didnt load). here is AnotherTestClass : @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "file:src/main/webapp/WEB-INF/spring/application-context.xml" }) public class AnotherTestClass { @Autowired private PlayerService playerService; @Autowired private IPlayerSessionService playerSessionService; @Autowired private PlayerRepository playerRepository; @Test public void simpleTest() { ... } @Test public void complexAndLongTest() { ... } Thing is both tests in AnotherTestClass runs perfectly when i test. How can i make the autowire fields to get injected? Thanks
score: 0
tagged with: junit
has comment: http://stackoverflow.com/comment/42298347
has comment: http://stackoverflow.com/comment/42298380

http://stackoverflow.com/a/26982662
answers question: http://stackoverflow.com/q/26975806
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42609048
has body: You need to define a global generator in an orm.xml file: <?xml version="1.0" encoding="UTF-8"?> <sequence-generator name="global_seq_gen" allocation-size="1" initial-value="1" /> And then simply reference this generator in your Entity mappings: @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "global_seq_gen") private Long id;
has comment: http://stackoverflow.com/comment/42609297
has comment: http://stackoverflow.com/comment/42609139

http://stackoverflow.com/q/26968721
score: 6
upvote count: 6
answer count: 0
has title: Manage Connection Pooling in multi tenant app using Hibernate
tagged with: java
tagged with: hibernate
has body: I am trying to setup a multi-tenant application with a separate schema approach. I am using JPA with Hibernate 4 implementation. Like said @ben75 in this very usefull thread, there many way to manage the connection (shared or own connection for each tenant). I have developped a first solution based on a separate schema but with a shared connection pool like in this thread. This works fine, but I think that if each tenant could have his own connection it would be better because a tenant could not decrease performance of others. This approach seems to be similar to the separate database approach but I don't know how I can create a connection (using C3P0 or something else ?). In hibernate documentation they use the class ConnectionProviderUtils, but I really don't know what is done in this class. MultiTenantConnectionProviderImpl public class MultiTenantConnectionProviderImpl extends AbstractMultiTenantConnectionProvider { private C3P0ConnectionProvider connectionProvider = null; @Override protected ConnectionProvider getAnyConnectionProvider() { // my main question is here } @Override protected ConnectionProvider selectConnectionProvider(String tenantIdentifier) { // and here - how create a new connection ? } Regarding the answer of @Ben75, he said that I have to get the default hibernate and c3po config properties from a file and alter the schema. Or maybe the user/password too, if there is a different user by tenant. Do you know how I can doing this ? Is there some class for reading persistence.xml and create a connection ? I have found examples on separate database approach that use a JNDI service for getting the good datasource, but on my application I haven't (not full Java EE). Edit There is an implementation that seems working on Oracle (in this example the user/password is the same as the tenantId): public class MultiTenantConnectionProviderImpl extends AbstractMultiTenantConnectionProvider implements ServiceRegistryAwareService { private Map&lt;String, C3P0Co…
type: Question
linked to: http://stackoverflow.com/q/19348477
linked to: http://stackoverflow.com/q/21223894
downvote count: 0
has comment: http://stackoverflow.com/comment/100307438
tagged with: c3p0
favorite count: 0
tagged with: multi-tenant
type: UnansweredQuestion

http://stackoverflow.com/comment/42314713
comment on: http://stackoverflow.com/a/26878823
has text: Agreed -- I just looked that up -- the current spec is at http://www.pkware.com/documents/casestudies/APPNOTE.TXT, one version later than what you linked, but that section is identical in both.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/27480173
type: Answer
downvote count: 0
has body: To fix this problem . first you must add cardview from the Close the main project. Remove the android-support-v7-appcompat . Restart the Eclipse. Add the android-support-v7-appcompat . Build the project. Then open the main project and build all the three projects. The error still remains. Restart eclipse. That's it. That works for me.
score: 1
answers question: http://stackoverflow.com/q/26833517
upvote count: 1

http://stackoverflow.com/q/26832862
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42232382
has comment: http://stackoverflow.com/comment/42232258
upvote count: 1
answer count: 1
tagged with: java
has body: Can anyone point me in the direction of logic I should be thinking of when attempting to test if a poker hand of 5 cards has two pairs? So far what I had before was pairing up each possible pairs of two of the five cards and returning true if two or more of these pairs have equal values. The problem I am having is that if there is three of a single card the method still returns true even if there are not two pairs.
downvote count: 0
has answer: http://stackoverflow.com/a/26833021
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42232172
type: Question
has comment: http://stackoverflow.com/comment/42232408
has title: Testing for two pairs in Poker Program

http://stackoverflow.com/a/26897971
has body: The issue is with this line g2d.setColor(new Color(redint, greenint, blueint, 255)); The type of redint, greenint and blueint in your code is of type long. But the constructor for Color takes in either int or long. You can refer to the documentation here So the fix to your problem: change these types from long to int and do appropriate casting.
score: 2
accepted answer of: http://stackoverflow.com/q/26897368
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26897368
upvote count: 2
type: Answer

http://stackoverflow.com/comment/42282446
type: QuestionComment
comment on: http://stackoverflow.com/q/26860837
has text: possible duplicate of [How to give environmental variable path for file appender in configuration file in log4j](http://stackoverflow.com/questions/13066042/how-to-give-environmental-variable-path-for-file-appender-in-configuration-file)
score: 0
type: Comment

http://stackoverflow.com/q/26860505
has comment: http://stackoverflow.com/comment/42511917
has body: I am writing a Java applet to implement BT streaming and some kind of errors occurs. Following is the Java error details: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.runOnEDTAndWait(Unknown Source) at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.instantiateApplet(Unknown Source) at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.reflect.InvocationTargetException at com.sun.deploy.uitoolkit.impl.awt.OldPluginAWTUtil.invokeAndWait(Unknown Source) ... 5 more Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.home" "read") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at sun.plugin2.applet.AWTAppletSecurityManager.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPropertyAccess(Unknown Source) at java.lang.System.getProperty(Unknown Source) at com.bu6ido.bitpower.common.CommonUtils.getSettingsPath(CommonUtils.java:31) at MainFrame.TestFrame.loadSettings(TestFrame.java:326) at MainFrame.TestFrame.&lt;init&gt;(TestFrame.java:173) 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…
has comment: http://stackoverflow.com/comment/42741519
has comment: http://stackoverflow.com/comment/42429943
has comment: http://stackoverflow.com/comment/42310191
type: UnansweredQuestion
tagged with: security
has comment: http://stackoverflow.com/comment/42510997
has comment: http://stackoverflow.com/comment/42741099
has comment: http://stackoverflow.com/comment/42752129
tagged with: policyfiles
answer count: 0
tagged with: applet
has comment: http://stackoverflow.com/comment/42744110
has comment: http://stackoverflow.com/comment/42744618
has title: java.util.PropertyPermission when a applet error occurs
type: Question
has comment: http://stackoverflow.com/comment/42752006
has comment: http://stackoverflow.com/comment/42310110
has comment: http://stackoverflow.com/comment/42429995
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42429918

http://stackoverflow.com/comment/42296001
score: 0
type: Comment
type: QuestionComment
has text: Two observations: 1) You probably want to change some lines in your constructor to look more like `this.count = count;`, if you're adopting the very normal idiom of initialising a field to one of the constructor arguments.
comment on: http://stackoverflow.com/q/26868153

http://stackoverflow.com/q/26878965
type: AnsweredQuestion
tagged with: user-interface
tagged with: layout-manager
type: Question
has answer: http://stackoverflow.com/a/26879029
score: 0
tagged with: swing
has title: How to get 2 JPanels within 1 JPanel, resizable, with fixed proportion?
answer count: 1
accepted answer: http://stackoverflow.com/a/26879029
tagged with: java
has comment: http://stackoverflow.com/comment/42314803
has body: Let's say a JFrame contains just 1 JPanel. This JPanel is divided into 2 JPanels occupying accordingly 0.75 and 0.25 of the JFrame height. I want all of this to be resizable along with the window size. I have no idea how to do this in Java. I'm a newbie to Java. I've read a bit about layouts, but all I can see is how to set preferred size in constructor (ceasing to resize when this number is reached) or some fixed sizes obtained through setting borders.

http://stackoverflow.com/a/26949295
has body: make array of it: String[] arr = new String[]{"clubs","spades","hearts","diamonds"} then use loop: for(int i=0;i&lt;arr.length;i++){} example: public class HouseOfCards { private static final String[] arr = new String[]{"Clubs","Spades","Hearts","Diamonds"}; public static void main(String[] args) { for(int i=0;i&lt;arr.length;i++) { System.out.println("Ace of "+arr[i]); for (int singles = 2; singles &lt;= 9; singles++) { System.out.println(singles + " of "+arr[i]); }//end of for loop() System.out.println("Jack of "+arr[i]); System.out.println("Queen of "+arr[i]); System.out.println("King of "+arr[i]); System.out.println("Ace of "+arr[i]); }//end of if() }//end of method main() }//end of class HouseOfCards
score: 0
has comment: http://stackoverflow.com/comment/42440298
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26949251
accepted answer of: http://stackoverflow.com/q/26949251
type: Answer

http://stackoverflow.com/q/26876037
tagged with: android
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42320388
tagged with: r.java-file
has title: "Cannot resolve symbol "R" - all XML android:ids are correct
has answer: http://stackoverflow.com/a/26876111
has comment: http://stackoverflow.com/comment/42309719
type: UnansweredQuestion
has body: I edited a small amount of my xml code (tried to add an android:src"@drawable/" but it didn't seem to like it so I deleted it after) and my java code (added Troop1P1.setVisibility(View.VISIBLE); to the end of an OnClickListener, and again deleted afterwards [I had already used findViewByID for Troop1P1]). However, my whole code has now stopped working, with every "R" in (R.id.) being highlighted, with the text "Cannot resolve symbol "R"" when hovered over. In addition, when I run the code I get the following error: error: Error: No resource found that matches the given name (at 'layout_above' with value '@id/btnTroop1P2'). However, I've checked and I'm fairly sure I've correctly id'd btnTroop1P2 using android:id="@+id/btnTroop1P2", so I can't find any problems there. I'd really appreciate any help, I just want to be able to run my project again!
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26876139
type: Question
has comment: http://stackoverflow.com/comment/42312042
answer count: 2

http://stackoverflow.com/a/26964233
answers question: http://stackoverflow.com/q/26964226
score: 0
type: Answer
has body: it is available via command line arguments to main() method public static void main (String ar[]){ //1000 will be at ar[0] } It will be available as String you might want to check Integer.parseInt() and String#trim() methods

http://stackoverflow.com/comment/42299001
score: 1
has text: also, in your locateLargets function you use "b" rather then array? `if (b[row][column] > maxValue)`
comment on: http://stackoverflow.com/q/26870093
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26959236
has comment: http://stackoverflow.com/comment/42458192
score: 0
has comment: http://stackoverflow.com/comment/42457930
type: Answer
answers question: http://stackoverflow.com/q/26958954
has comment: http://stackoverflow.com/comment/42458779
has comment: http://stackoverflow.com/comment/42459489
has comment: http://stackoverflow.com/comment/42458042
has comment: http://stackoverflow.com/comment/42459430
has comment: http://stackoverflow.com/comment/42457613
has comment: http://stackoverflow.com/comment/42459152
has body: Move "manifest" part under ... tag: <attribute name = "Main-Class" value = "SimpleChat.SimpleChatServer"/> <attribute name = "Class-Path" value = "."/> And it would be better to use Maven instead of old-fashion Ant. Maven becomes an industry standard several years ago.
has comment: http://stackoverflow.com/comment/42457423

http://stackoverflow.com/comment/88110169
has text: [This](https://github.com/ricemery/FileChooserFx) might help
comment on: http://stackoverflow.com/q/26865869
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26882203
tagged with: java
has answer: http://stackoverflow.com/a/26882272
accepted answer: http://stackoverflow.com/a/26882272
score: 0
answer count: 2
tagged with: google-maps
has title: Multiple Hashmaps into one. Java
tagged with: arraylist
tagged with: android
type: AnsweredQuestion
has body: I have the following code that works but how can I do it shorter if there is any way. I will explain it in depth. I have these three declared as global: private Map&lt;Marker, String&gt; pictureinfo = new HashMap&lt;Marker, String&gt;(); private Map&lt;Marker, String&gt; latitudeinfo = new HashMap&lt;Marker, String&gt;(); private Map&lt;Marker, String&gt; longitudeinfo = new HashMap&lt;Marker, String&gt;(); I have a method called markers() that has a pretty big code, but somewhere in the code, I have: pictureinfo.put(marker, poza); latitudeinfo.put(marker, latitude + ""); longitudeinfo.put(marker, longitude + ""); poza, latitude and longitude are taken from a database, but that is irrelevant. And further in the code, I have a custom infowindow for multiple markers where I have: String picture = pictureinfo.get(marker); latcoord.setText(latitudeinfo.get(marker)); lngcoord.setText(longitudeinfo.get(marker)); How can I shorten these lines? The code works but I am sure there is another way, shorter and optimal. I don't have much experience wish HashMaps and ArrayLists so any guidance will be appreciated, I want to learn, thank you.
type: Question
possible better answer: http://stackoverflow.com/a/26882805
tagged with: hashmap
has answer: http://stackoverflow.com/a/26882805

http://stackoverflow.com/a/26917972
type: Answer
has comment: http://stackoverflow.com/comment/42394521
score: 4
upvote count: 4
downvote count: 0
has body: Background on thread states According to the Thread.State.RUNNABLE documentation: Thread state for a runnable thread. A thread in the runnable state is executing in the Java virtual machine but it may be waiting for other resources from the operating system such as processor. Most of the time, the JavaFX application thread is waiting on operating system level callbacks, so it shows up as RUNNABLE in a profiler even though it is usually waiting. It is because the wait is occurring in native code rather than a sleep style call in the JVM. You can see from this Java thread state UML diagram that there are different methods required for Java threads to enter different states. In Swing, one of these methods is used to get the EDT into a waiting state, but similar methods are not used in JavaFX. How JavaFX works The architecture of the JavaFX system is based upon a timed pulse, which by default will fire 60 times a second. To get a smooth animated display without image tearing, (I think) the system can enable a vsync timer so that the pulses are synchronized with the display. A standard JVM does not know about an OS specific vsync timer, so the JavaFX system uses native code to cause the JavaFX application thread to wait on the OS supplied vsync timer. It's not an issue Whether its 100% runnable state may cause performance leaks? No, I do not think the state will cause performance leaks. One thing to be aware of is that the JavaFX application thread is geared for UI updates, so things that run on it will only run at most 60 times per second by default. So if you use something like a PauseTransition and set the duration of the pause to Duration.millis(10), the pause won't actually be 10 milliseconds, but a 60th of second (approx 16 milliseconds). If you have things which are extremely fine grained time sensitive you are probably better to use something like a ScheduledThreadPoolExecutor or some high resolution OS native timer, but for most people this is not a real conside…
answers question: http://stackoverflow.com/q/26910159

http://stackoverflow.com/q/26856483
possible better answer: http://stackoverflow.com/a/26856527
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42275006
has comment: http://stackoverflow.com/comment/42275008
tagged with: java
accepted answer: http://stackoverflow.com/a/26856529
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42275018
has comment: http://stackoverflow.com/comment/42275051
has answer: http://stackoverflow.com/a/26856529
has answer: http://stackoverflow.com/a/26856527
has title: PrintWriter in Java, Can't find file error
score: 0
tagged with: macos
has body: I need to use PrintWriter in Java to read a document saved on the computer and print it into an array. We must use a skeleton and develop our code from that. I think I understand the concept, except the compiler keeps telling me the file does not exist. I think the problem may be that I have an iMac and it does not have c drive, at least not labeled that way. What am I doing wrong? I included the code in my code so far... import java.io.PrintWriter; import java.io.File; import java.util.*; import java.text.*; public class pWriter{ public static void main(String[]args) throws Exception{ Scanner stdln = new Scanner(new File("c://FileName.txt)); String[] line = new String[238]; while (stdln.hasNextLine()){ int i = 0; line[i] = stdln.nextLine(); i++; } } }
has comment: http://stackoverflow.com/comment/42274996
tagged with: printwriter
has comment: http://stackoverflow.com/comment/42275052

monitoring
tags question: http://stackoverflow.com/q/26914243
type: Tag
tag name: monitoring

http://stackoverflow.com/comment/42423775
comment on: http://stackoverflow.com/a/26939711
type: AnswerComment
score: 0
type: Comment
has text: @CharanSingh if the 2nd method is just for outputting the table, you don't need declare the return type at all. that is, you need a `void` method.

http://stackoverflow.com/a/26835289
has comment: http://stackoverflow.com/comment/42236518
has body: Infinite loops mostly happen if you try to read a closed scanner. I would also suggest you keep a refence of it as an object variable or at least in your main function: Scanner reader = new Scanner(System.in); Game test = new Game(); test.loadBombs(test.bombBoard); test.loadArray(test.board); test.loadNumber(test.bombBoard); test.displayBoard(test.board); test.displayBoard(test.bombBoard); Hope it helps.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26834907

http://stackoverflow.com/comment/42348739
has text: What do you mean by "manual" ? If you're using SQL, you can fetch a list from DB. Just create a query like `SELECT * FROM Thread WHERE Thread.id IN (?)`
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26897643
score: 0

http://stackoverflow.com/q/26875111
has answer: http://stackoverflow.com/a/26875365
has comment: http://stackoverflow.com/comment/42308676
tagged with: arraylist
has answer: http://stackoverflow.com/a/26875233
score: 0
answer count: 3
has title: Newbie struggling removing objects from arraylist
has comment: http://stackoverflow.com/comment/42308034
has comment: http://stackoverflow.com/comment/42308011
has answer: http://stackoverflow.com/a/26875446
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42308086
has comment: http://stackoverflow.com/comment/42308179
has comment: http://stackoverflow.com/comment/42308294
has body: I need to remove an element based upon its variables within its own class instance. I have a class called Account, and an ArrayList called AccountList. As far as I know, there are two ways to remove an element from an array: by index and by using the Object 0 method. Unfortunately, neither of these will work for me; I need to remove an object if it has a variable value of "accountNumber" (from the Account class) equals to the parameter value for AccountNumber entered by a user. My tutor wants a boolean method with a String parameter named Account Number. My approachwould be to use the Account class's getAccNumber() getter method, and remove it if it's equal to the parameter. public boolean removeAccount(String AccountNumber) { if (AccountNumber.equals(Account.getAccNumber())) { accounts.remove(AccountNumber); return true; } else { return false; } } However, this doesn't work. As an aside, I've had to make the getAccNumber() method static to allow access by the ArrayList class. This has messed up the instances of Account; if I create a new instance of it, the new AccountNumber value overwrites the previous. Any ideas? edit... his exact spec for it "removeAccount(String) Should remove the Account with the account number specified as a parameter if it the Account exists. The appropriate boolean value should then be returned via a BlueJ ‘method result’ dialog box."
has comment: http://stackoverflow.com/comment/42308185
has comment: http://stackoverflow.com/comment/42308006
tagged with: java
has comment: http://stackoverflow.com/comment/42308072
has comment: http://stackoverflow.com/comment/42308722
has comment: http://stackoverflow.com/comment/42308162
has comment: http://stackoverflow.com/comment/42308241
type: Question
has comment: http://stackoverflow.com/comment/42308070
has comment: http://stackoverflow.com/comment/42308200
has comment: http://stackoverflow.com/comment/42308094
has comment: http://stackoverflow.com/comment/42308060

http://stackoverflow.com/comment/42468141
type: AnswerComment
has text: Thanks for the quick reply, but it gives me the same error ):
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26965292

http://stackoverflow.com/q/26945246
score: 0
tagged with: rest
tagged with: adobe-brackets
type: UnansweredQuestion
has body: We have two separate web projects for our application One for Spring REST services Other for AngularJS, the front end of the application. We have been using eclipse for development of both and also for running those locally on tomcat server. It is a great deal of pain to view updates to JavaScript and CSS part of the second project from eclipse, because it requires restart or publish of the tomcat server every time which takes a long time. So I wanted to use eclipse for development of REST and front-end development editor like Brackets for development of AngularJS/JavaScript and CSS. But then they run on different ports causing Cross Site requests errors, and I don't want to write any CORS filter like this for this purpose. Is there any better way to get these tools work together ?
tagged with: java
tagged with: eclipse
has title: How to use Eclipse for Spring REST development with Brackets like editor for JavaScript/front end development?
type: Question
has answer: http://stackoverflow.com/a/26956131
answer count: 1
tagged with: javascript

http://stackoverflow.com/comment/42469282
has text: He passed strikes in this function: letterCheck(letterGuess, blanks, strikes). This function uses the name strikeCounter for the int argument: public static String letterCheck(String existance, StringBuilder updatedWord, int strikeCounter){
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26965971

http://stackoverflow.com/comment/42298258
score: 1
has text: Btw, IIRC you should call the recursive calls before the loop and not after it. Also AFAIK the pivot element should be the element in the middle and not the first one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26869505

http://stackoverflow.com/q/26867320
has body: I am trying to compare to objects without sorting them. I just want the sign of "value" to change. this is not a code, just the idea. public S(double value, SOME s1, SOME s2){ v=value; src1= s1; src2 =s2; } The SOME data type has a an array in its class. SOME is a java class that has an array, and passes the value of the s1, and s2. Assigns s1, and s2 as a value for the array. if src1 &lt; src2, v would be negative, else it would be positive. What method or class should I use?
tagged with: compare
downvote count: 1
has comment: http://stackoverflow.com/comment/42293946
has answer: http://stackoverflow.com/a/26867537
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26867537
tagged with: java
score: -1
tagged with: comparison
type: Question
upvote count: 0
has title: How to compare two objects without sorting in java
answer count: 1
favorite count: 0

http://stackoverflow.com/a/26934289
has body: You are not making any filtering anywhere in your code... The steps to do it should be these ones (in this order) : Android side : Calling your webservice (PHP code) with the user's department (in GET or POST parameter) WS side : Requesting your database with something like SELECT * FROM announcement WHERE receiver = '&lt;department'&gt; OR receiver = 'ALL' where department is the user's department WS side : Construct the JSON response Android side : Process the JSON response to display results The advantages of making it like this : Limit the number of data transfered (limit network consumption on the Android device and you limit the load on your PHP server) Limit the number of data processed Android side (limit the load of the Android app : it's not a desktop app ! Never forgive it !) PS : reading your post and your comment, I really think you should look into these points before starting to make your app : SQL request, PHP MySQL access (as pointed out by @Jay Blanchard), Web services and HTTP protocol, Android AsyncTask
answers question: http://stackoverflow.com/q/26933954
score: 0
has comment: http://stackoverflow.com/comment/42413842
type: Answer
has comment: http://stackoverflow.com/comment/42413572

http://stackoverflow.com/comment/42291417
type: QuestionComment
comment on: http://stackoverflow.com/q/26866012
has text: Don't do it - it's really obsolete design pattern which was used for compatibility with old Android versions
score: 0
type: Comment

http://stackoverflow.com/q/26931123
downvote count: 0
has body: this is actually my first time asking a question here, so please be patient with me :) I need to make an android game for university without the use of any external libraries and I have the following problem: In the game you control a taxi in space by sliding up and down the sides of the screen (landscape mode) where the top is max speed and the bottom is slow speed, on the right side you control the right thruster and on the left the left thruster. Basically the control is already working, with one problem: If you stop moving your finger (finger is still touching the screen) nothing happens anymore (after approx. 1 sec): This is my first time programming Android, please bear that in mind (in case I made a really obvious mistake): @Override public boolean onTouchEvent(MotionEvent event) { int maskedAction = event.getActionMasked(); switch (maskedAction) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_POINTER_DOWN: { // not needed break; } case MotionEvent.ACTION_MOVE: { // all Settings are set here // normalized in [0,1], will be given to GameEngine Acceleration methods float leftThrusterNormalized = 0.0f; float rightThrusterNormalized = 0.0f; // counter for the current pointer (= TouchEvent) int current = 0; // true = more than one pointer; false = one or no pointers boolean multiTouch = false; // go through each pointer for (int i = 0; i &lt; event.getPointerCount(); i++) { // if there are more than two pointers, this is needed, otherwise an // java.lang.IllegalArgumentException will be thrown if only pointer is active if (event.getPointerCount() &gt;= 2) { multiTouch = true; current = event.getPointerId(i); // the touch event occurs in the right area, relative to screen width if (event.getX(current) &lt; getWidth()*0.2 || event.getX(current) &gt; getWidth()*0.8) { engine.accelerateTaxiTranslation(normalizeCoords(event.getY(current))); // Touch event on the right side of the screen, set value for the right Thruster // via normalisation of y-Coordinate if (…
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42409427
tagged with: multi-touch
type: UnansweredQuestion
tagged with: android
tagged with: touch-event
answer count: 0
tagged with: java
upvote count: 1
type: Question
has title: Action.Move doesn't work when finger stops moving
has comment: http://stackoverflow.com/comment/42408149

http://stackoverflow.com/q/26886955
has body: Lets say.. if i hit google with https://www.google.com it will create a session, for the responce it will create url with session tokn like.. https://www.google.co.in/?gfe_rd=cr&amp;ei=oFBjVJSvLqnM8gft5YDwAQ&amp;gws_rd=ssl. My question is am connecting to google with the code: URL url = new URL(test); URLConnection conn = url.openConnection(); this will connect to google. for this google creates a session. then how would i get a session token back to my code?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26887491
type: UnansweredQuestion
has title: How to get session token form url?
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26887276

http://stackoverflow.com/q/26929125
tagged with: java
favorite count: 0
type: Question
upvote count: 2
tagged with: multipart
has comment: http://stackoverflow.com/comment/42405419
has body: I've written a code to upload images into my server. I've coded this with Spring integration, but when I try to resume multipartfile into service I get this errore Caused by: java.lang.IllegalStateException: File has been moved - cannot be read again at org.springframework.web.multipart.commons.CommonsMultipartFile.getInputStream(CommonsMultipartFile.java:123) I've a controller which fill a model (file and description) and then send its, with message channel, to a service for processing image. This is a part of my integration-context &lt;channel id="photoProcessingChannel"&gt; &lt;queue /&gt; &lt;/channel&gt; &lt;outbound-channel-adapter channel="photoProcessingChannel" method="processingBufferphoto" ref="BufferphotoService"&gt; &lt;poller fixed-rate="2000"/&gt; &lt;/outbound-channel-adapter&gt; Any suggestions?
has comment: http://stackoverflow.com/comment/42409391
tagged with: spring
tagged with: spring-mvc
score: 2
has comment: http://stackoverflow.com/comment/42409453
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: Spring integration http upload file
tagged with: spring-integration

http://stackoverflow.com/q/26964048
has comment: http://stackoverflow.com/comment/42498857
has answer: http://stackoverflow.com/a/26964183
has comment: http://stackoverflow.com/comment/42465915
type: UnansweredQuestion
has body: My JFrame window won't appear, though, by the tutorial I've been watching, I've been doing everything spot on, yet nothing happens. It doesn't even give me an error, which makes it so much worse. This is the code: import javax.swing.*; import java.awt.*; public class Window { public class Window { public void newWindow() { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); JLabel label = new JLabel("I am a star! A beautiful shining star!", SwingConstants.CENTER); frame.getContentPane().add(label); frame.setVisible(true); } } (This is a second class, the main one properly links to this one)
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/42466017
has comment: http://stackoverflow.com/comment/42465930
type: Question
has answer: http://stackoverflow.com/a/26964279
score: -2
has title: My JFrame window won't appear
has comment: http://stackoverflow.com/comment/42465966
has answer: http://stackoverflow.com/a/26964108
answer count: 3
downvote count: 3
upvote count: 1
favorite count: 0

http://stackoverflow.com/comment/42293671
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26866770
has text: It's much easier to get it added to the repository...so he can update it when a new version comes out.

http://stackoverflow.com/q/26986748
score: 0
answer count: 2
has body: I am quite new to java and I'm trying to create student record system. At the moment I'm storing my "registered student" in an ArrayList of Objects. I would like to be able to modify the value of for e.g. the first name of a specific student. The ID of the student is also his position in the ArrayList. Here is how I tried to do it but it doesnt seem to work: StudentStoring.StudentList.get(id) .setTitle(comboTitle.getSelectedItem().toString()); This is the bit of code that is suppose to take the new value of the title in the modifying page and replace the old one but I get an IndexOutOfBound error. Thanks.
has title: Modify value of variable inside an Object (java)
tagged with: arraylist
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26986796
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/26986872
tagged with: java
has comment: http://stackoverflow.com/comment/42506473

http://stackoverflow.com/q/26990090
has answer: http://stackoverflow.com/a/32525924
accepted answer: http://stackoverflow.com/a/32525924
has comment: http://stackoverflow.com/comment/42512673
has comment: http://stackoverflow.com/comment/42512510
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/42512128
downvote count: 0
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: I'm getting this error: 2014-11-14 17:39:44 [WARN]SqlExceptionHelper:143 SQL Error: 0, SQLState: 08S01 2014-11-14 17:39:44 [ERROR]SqlExceptionHelper:144 Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. 2014-11-14 17:39:44 [ERROR]BackupService:245 org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.JDBCConnectionException: Could not open connection Seems that Hibernate has a small transaction timeout for my job, but I can not find what is the default timeout value. I did not find it also in hibernate documentation, I find how to change it, but not the default value. This is my hibernate configuration: com.test.db.entity org.hibernate.dialect.HSQLDialect false false true org.hibernate.dialect.MySQLDialect false org.hibernate.transaction.JDBCTransactionFactory Do you know what is the default timeout value for an hibernate transaction with this configuration?
type: Question
has comment: http://stackoverflow.com/comment/42511934
tagged with: timeout
linked to: http://stackoverflow.com/q/10695028
has comment: http://stackoverflow.com/comment/42512474
upvote count: 2
answer count: 1
has title: Hibernate 4 default transaction timeout value
favorite count: 0
has comment: http://stackoverflow.com/comment/42518937
has comment: http://stackoverflow.com/comment/42512100
tagged with: spring

http://stackoverflow.com/a/75648041
answers question: http://stackoverflow.com/q/26889970
score: 0
type: Answer
has body: @ComponentScan(basePackages = "com.x.y") in your desired place. That's it.

http://stackoverflow.com/a/43592129
answers question: http://stackoverflow.com/q/26886121
type: Answer
has comment: http://stackoverflow.com/comment/78477495
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/78478168
has body: Tested with Spring 4.3.7 and Spring Security 4.2.2. You need to add a CSRF token to every form in your application. Any PATCH, POST, PUT and DELETE will be protected by Spring security (for the basic verbs). To avoid inserting a hidden input in every form manually you can create a FormRenderer on top of the provided one : import com.sun.faces.renderkit.html_basic.FormRenderer; import javax.el.ELContext; import javax.el.ExpressionFactory; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; import java.io.IOException; public class FormWithCSRFRenderer extends FormRenderer { @Override public void encodeEnd(FacesContext context, UIComponent component) throws IOException { log.debug("FormWithCSRFRenderer - Adding CSRF Token to form element"); ELContext elContext = context.getELContext(); ExpressionFactory expFactory = context.getApplication().getExpressionFactory(); ResponseWriter writer = context.getResponseWriter(); writer.startElement("input", component); writer.writeAttribute("type", "hidden", null); writer.writeAttribute("name", expFactory.createValueExpression(elContext, "${_csrf.parameterName}", String.class).getValue(elContext), null); writer.writeAttribute("value", expFactory.createValueExpression(elContext, "${_csrf.token}", String.class).getValue(elContext), null); writer.endElement("input"); writer.write("\n"); super.encodeEnd(context, component); } } Then register it to override the FormRenderer by setting it in faces-config.xml : <?xml version="1.0" encoding="UTF-8"?> javax.faces.Form javax.faces.Form com.acme.FormWithCSRFRenderer Also don't forget to enable CSRF in your spring context : <security:http auto-config="true" entry-point-ref="preAuthenticatedProcessingFilterEntryPoint" use-expressions="true"> <security:csrf/> <security:access-denied-handler error-page="/exception/accessDenied.xhtml"/> <security:intercept-url pattern="/**" access="hasAnyRole('ROLE_ADMINISTRATOR','ROLE_GUEST…
has comment: http://stackoverflow.com/comment/78570132
has comment: http://stackoverflow.com/comment/78541059
has comment: http://stackoverflow.com/comment/78540958
downvote count: 0

http://stackoverflow.com/comment/42549047
has text: @RomZes13 It looks like the same error, but you didn't post a full stacktrace, so it isn't seen a root cause.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26980676

http://stackoverflow.com/comment/42430796
comment on: http://stackoverflow.com/q/26943867
score: 0
type: Comment
type: QuestionComment
has text: That's really not the right formula for working out a distance.

http://stackoverflow.com/a/26887076
has comment: http://stackoverflow.com/comment/42493598
type: AcceptedAnswer
score: 0
has body: After setting the values of the backingBean in the page as shown below : &lt;f:attribute name="backingBean" value="#{pageFlowScope.backingPage3}"/&gt; it is working !!! and the expression should be in the above format itself.... Note: backingPage3 managed bean should be declared inside the particular taskflow in which the page using the template is placed
type: Answer
has comment: http://stackoverflow.com/comment/42459063
accepted answer of: http://stackoverflow.com/q/26861518
answers question: http://stackoverflow.com/q/26861518

http://stackoverflow.com/q/26876390
has answer: http://stackoverflow.com/a/26879872
has body: This code gives me an output of - first_name- [Tiger, Enrique] family_name- [Woods, Iglesias] import java.util.*; public class al_Concatenate { public static void main(String args[]) { // creating array list ArrayList&lt;String&gt; first_name = new ArrayList&lt;String&gt;(); ArrayList&lt;String&gt; family_name = new ArrayList&lt;String&gt;(); Arraylist&lt;String&gt; name = new Arraylist&lt;String&gt;(); // add elements to the array list first_name.add("Tiger"); first_name.add("Enrique"); family_name.add("Woods"); family_name.add("Iglesias"); name.?? //displaying the output System.out.println("first_name- " + first_name); System.out.println("family_name- "+ family_name); System.out.println("name- "+ name); } } But I need and output like this (without using loop, preferably a single line code)- name - [Tiger Woods, Enrique Iglesias] thanks in advance I would also like to add that the size of the arraylist is 2, but in my real program it's around 4500. I created this example to make it simple :) I edited the post a bit, sorry for making it cumbersome :(
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/26879140
has title: Concatenate string in Java arraylist
type: Question
has answer: http://stackoverflow.com/a/26876523
tagged with: list
has answer: http://stackoverflow.com/a/26876600
has comment: http://stackoverflow.com/comment/42310252
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42310524
has answer: http://stackoverflow.com/a/28334416
has answer: http://stackoverflow.com/a/26876527
tagged with: concatenation
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/26876486
tagged with: string
favorite count: 0
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42310288

http://stackoverflow.com/a/26865048
score: 2
upvote count: 3
downvote count: 1
answers question: http://stackoverflow.com/q/26864662
has comment: http://stackoverflow.com/comment/77046157
has body: Updating the PATH Environment Variable If you do not set the PATH variable, you need to specify the full path to the executable file every time you run it, such as: C:\&gt; "C:\Program Files\Java\jdk1.8.0\bin\javac" MyClass.java It is useful to set the PATH variable permanently so it will persist after rebooting. To set the PATH variable permanently, add the full path of the jdk1.8.0\bin directory to the PATH variable. Typically, this full path looks something like C:\Program Files\Java\jdk1.8.0\bin. Set the PATH variable as follows on Microsoft Windows: Click Start, then Control Panel, then System. Click Advanced, then Environment Variables. Add the location of the bin folder of the JDK installation to the PATH variable in System Variables. The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\Java\jdk1.8.0\bin Note: The PATH environment variable is a series of directories separated by semicolons (;) and is not case-sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right. You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored. If you are not sure where to add the JDK path, append it. The new path takes effect in each new command window you open after setting the PATH variable.
type: Answer

http://stackoverflow.com/q/26868067
favorite count: 0
type: Question
answer count: 2
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/42295684
has title: ArrayList group items
has answer: http://stackoverflow.com/a/26870165
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42295447
downvote count: 0
has answer: http://stackoverflow.com/a/26868452
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42295253
tagged with: arraylist
has body: I have a simple json file {"name":"item1", "category":"work", "id":1}, {"name":"item2", "category":"work", "id":2}, {"name":"item3", "category":"work", "id":3} {"name":"item4", "category":"home", "id":4} converted to ArrayList i want to group items by category like the following tree view work -item1 -item2 -item3 home -item4 Any ideas? private List&lt;Item&gt; item = new ArrayList&lt;Item&gt;(); try { JSONObject responseObject = new JSONObject(response); JSONObject itemsObject = responseObject.getJSONObject("items"); Iterator&lt;?&gt; keysIterator = itemsObject.keys(); while(keysIterator.hasNext()) { String keyString = (String)keysIterator.next(); JSONObject coupon = couponsObject.getJSONObject(keyString); Item item = new Item(); item.setName(item.getString("name")); item.setCategory(item.getString("category")); item.setID(item.getString("id")); itemList.add(item); } } catch (Exception e) { e.printStackTrace(); } adapter.notifyDataSetChanged();
has comment: http://stackoverflow.com/comment/42296323
score: 1

http://stackoverflow.com/comment/42240863
score: 0
comment on: http://stackoverflow.com/q/26836626
type: Comment
type: QuestionComment
has text: Do I need to have the rest of my code? I am unsure as to why it is necessary

http://stackoverflow.com/comment/42366788
score: 0
has text: You'll need to translate the relative position related to the component to absolute coordinates
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26908402

http://stackoverflow.com/comment/42293786
type: Comment
comment on: http://stackoverflow.com/a/26866884
type: AnswerComment
has text: you won the race. It was definitely the PostConstruct issue. With @PostInitialize everything is going smooth as the oil. I'm going to change the title of my question so that people can properly address the problem.
score: 0

http://stackoverflow.com/comment/42434450
type: AnswerComment
has text: Would you mind to guide me by providing me some solutions to implement into my situation? Because I tried to change and everything turned red :(
type: Comment
comment on: http://stackoverflow.com/a/26945955
score: 0

http://stackoverflow.com/a/26913008
downvote count: 0
answers question: http://stackoverflow.com/q/26912539
type: Answer
score: 2
has body: IMHO, you should use a database. For a simple application, you can use embedded databases such as HSQL, H2 or Derby. You could then easily migrate to MySQL, MariaDB, or PostgreSQL with exactly the same API if your needs grew later. JDBC is not exactly a very nice API, but is extremely portable, but you could considere looking at JPA which has some good implementation such as Hibernate, EclipseLink or OpenJPA if you want to store more than use information. And I almost forget, good practices recommend to store only the hash of the password, never the plain text version ...
upvote count: 2

http://stackoverflow.com/q/26958661
tagged with: variables
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/42456109
type: UnansweredQuestion
has title: JavaMail: How to send a variable value as email content instead of just text?
downvote count: 1
has comment: http://stackoverflow.com/comment/42456141
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/26958698
type: Question
tagged with: jakarta-mail
has body: I have the cut following code below, for emailing something to me. Message message = new MimeMessage(session); message.setFrom(new InternetAddress("emailfrom@gmail.com")); message.setRecipients(Message.RecipientType.TO, InternetAddress.parse("emailto@gmail.com")); message.setSubject("Email title"); message.setText("Email body"); Transport.send(message); It works fine when i put the message.setText line to something in quotations "", eg. message.setText("Hello there"); But the setText part is underlined in red whenever I try to use a variable name, eg. String x = Hello; String y = there; and use the above code with the line: message.setText(x + y); With the desired message to say "Hello there", using the variables instead of the quoted text. How do i do this?
answer count: 1

http://stackoverflow.com/a/26911714
score: 0
answers question: http://stackoverflow.com/q/26911184
type: Answer
has body: Spring MVC creates a new instance of your Ad object based upon the parameters in the request. So if the price value doesn't have a HTML input in the generated form then the value won't be populated in this new instance. You can use the &lt;form:hidden path="price"/&gt; tag to pass the value back from the form. If you look at the source of the HTML page you should see that this adds &lt;input type="hidden" name="price" value="100"/&gt; to the page.

http://stackoverflow.com/q/26837113
has body: I want to use X.509 certificate for the MongoDB authentication. How to configure Java MongoClient to use X.509 certificate? Can not find clear answer here: http://docs.mongodb.org/manual/reference/connection-string/
tagged with: mongodb-java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/26838973
favorite count: 0
accepted answer: http://stackoverflow.com/a/26838973
score: 1
tagged with: x509
upvote count: 1
type: AnsweredQuestion
has title: Configuring Java MongoClient to use X.509 certificate for the authentication
tagged with: java
type: Question
tagged with: mongodb

http://stackoverflow.com/q/26986219
tagged with: mousemotionlistener
tagged with: jpanel
has comment: http://stackoverflow.com/comment/42505621
score: 0
has comment: http://stackoverflow.com/comment/42505687
linked to: http://stackoverflow.com/q/5665156
has comment: http://stackoverflow.com/comment/42506185
has comment: http://stackoverflow.com/comment/42507305
has comment: http://stackoverflow.com/comment/42507311
has body: I made a JPanel with a mouse listener, a mouse motion listener and a scroll listener. And I have a JFrame that switches between JPanels like so: //tile is a JPanel //"this" is a JFrame tile.removeAll(); tile=tree.getCurrentNode().getContent().panel; this.add(tile); this.revalidate(); tile.requestFocus(); Now when I switch out the old JPanel for the one with mouse listeners some weird things start to happen. The mouse listener and the scroll listener still work but the mouse motion listener doesn't get called anymore. I even get a nullpointer exception when I try getMousePosition() from within the JPanel.
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has title: How can I get this imported MouseMotionListener to work again?
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/26991585
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26991852
tagged with: guice
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26991852
has title: Serializable class with unserializable injected member in JAVA
has body: I have a serializable class which has some members injected from guice module. However, these members are unserializable and I can't force the declaration of them with Serializable interface. How shall I write readObject and writeObject functions for this class to support the serializing the instance of this class?

http://stackoverflow.com/q/26836626
tagged with: filtering
has answer: http://stackoverflow.com/a/27089302
has title: Searching a file based on given user-inputted filters and parsing input?
has body: I am attempting to make a program that searches a given file for a Information is stored in the given format: Jane 19 50 86 85 84 83 45 76 There is the name, along with the age, followed by test scores. The user inputs a name and an age, then the program searches the file for a line that has this name and age. These test scores should be retrieved and stored, then printed. The program should then retrieve the information attached to that particular line in the file. What I had planned on doing was storing the user input in Strings, then searching the file with these, like so: Scanner input = Scanner(System.in); String params = ""; System.out.print("name? "); params += input.next() + " "; System.out.print("age? "); params += input.next(); System.out.println(params); return params; But this seems as though it would cause complications. If I searched for a boy named Tom who was 19, would this not also match with a boy named Tommy who was 19? In addition, I'm not really sure how to parse the numbers from the given line to print them. I made a separate Scanner for the input line, and attempted to use Integer.parseInt(), but the Scanner starts from the beginning of the line, so it attempts to change "Jane", for example, to a int, which is of course, not possible, so it creates a NumberFormatException. Addition of relevant code: public static String introQuery(Scanner input) { String params = ""; System.out.print("name? "); params += input.next() + " "; System.out.print("age? "); params += input.next(); System.out.println(params); return params; } public static void fileNameScanner(Scanner file, String params) { boolean fileContains = false; System.out.println("fileNameScanner ran"); int score = 0; Scanner split = new Scanner(params).useDelimiter(" "); String name = split.next().toUpperCase(); String gender = split.next().toUpperCase(); while (file.hasNextLine() /* &amp;&amp; (fileContains = false)*/) { String inputLine = file.nextLine().toUpperCase(); //commented out the …
answer count: 1
has comment: http://stackoverflow.com/comment/42238873
tagged with: parsing
accepted answer: http://stackoverflow.com/a/27089302
has comment: http://stackoverflow.com/comment/42241092
tagged with: input
has comment: http://stackoverflow.com/comment/42240863
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/42240887
type: Question

http://stackoverflow.com/a/26900171
type: Answer
has comment: http://stackoverflow.com/comment/42353053
score: 1
has comment: http://stackoverflow.com/comment/42353160
upvote count: 1
has body: If I understand your question then I believe your math is a bit off and I think you wanted something like, int width = g.getrW(); int height = g.getrH(); int minX = (g.ttx - radius) - (width / 2); int maxX = (g.ttx + radius) + (width / 2); int minY = (g.tty - radius) - (height / 2); int maxY = (g.tty + radius) + (height / 2); if (x &gt;= minX &amp;&amp; x &lt;= maxX &amp;&amp; y &gt;= minY &amp;&amp; y &lt;= maxY) { gameOver = true; m.start(); }
answers question: http://stackoverflow.com/q/26900049
has comment: http://stackoverflow.com/comment/42353239
downvote count: 0
has comment: http://stackoverflow.com/comment/42353063

http://stackoverflow.com/q/26976063
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42486907
tagged with: java
has body: I am new to Servlets and I tried to create a Helper class for Database access. I created this simple class and it works more or less. I can access the Database without any problems inside the "startUp" method, but when I access the methods inside the Servlets "dataSource" is always null. What am I doing wrong? I am using Netbeans with Glassfish 4.1 and Java 7. Database.class @Singleton @Startup public class Database { @Resource( lookup = "jdbc/resBookStoreMySql" ) private DataSource dataSource; @PostConstruct private void startUp() { System.err.println("====================="); System.err.println(this.dataSource == null); //false } @Lock( LockType.READ ) public boolean isPasswordCorrect(String username, String password) { boolean isPasswordCorrect = false; System.err.println(this.dataSource == null); //true // . . . return isPasswordCorrect; } @Lock(LockType.READ) public List&lt;Book&gt; getBooks() { List&lt;Book&gt; books = new ArrayList&lt;&gt;(); System.err.println(this.dataSource == null); //true // . . . return books; } } SomeServlet.jsp: .... &lt;jsp:useBean id="db" class="at.laubi.servlet.data.Database" scope="page" /&gt; ....
tagged with: servlets
type: Question
accepted answer: http://stackoverflow.com/a/26976808
tagged with: ejb
answer count: 1
tagged with: jsp
score: 0
has answer: http://stackoverflow.com/a/26976808
has title: @Resource null at runtime but not at startup
tagged with: jakarta-ee

http://stackoverflow.com/comment/42317351
score: 0
type: Comment
has text: server side code is correct.no problem with that.
type: QuestionComment
comment on: http://stackoverflow.com/q/26880504

http://stackoverflow.com/q/26924628
accepted answer: http://stackoverflow.com/a/26927971
score: 7
favorite count: 0
tagged with: load-factor
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42396171
tagged with: java
upvote count: 7
has comment: http://stackoverflow.com/comment/42396798
has answer: http://stackoverflow.com/a/26927971
type: Question
has comment: http://stackoverflow.com/comment/42396343
has body: Java doc says - When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed In below program - HashMap&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;(); int i = 1; while(i&lt;16) { map.put(i, new Integer(i).toString()); i++; } Key is of type Integer, at insertion of 13th to 15th element HashMap capacity remains as 16 and threshold remains same as 12, why ? Debug screenshot after adding 13th element in map - args String[0] (id=16) map HashMap&lt;K,V&gt; (id=19) entrySet null hashSeed 0 KeySet null loadFactor 0.75 modCount 13 size 13 table HashMap$Entry&lt;K,V&gt;[16] (id=25) threshold 12 values null i 14 [null, 1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9, 10=10, 11=11, 12=12, 13=13, null, null] HashMap with key of type String - HashMap&lt;String, String&gt; or a custom class - Map&lt;Employee,Integer&gt; show expected behaviour at 13th insertion
tagged with: hashmap
tagged with: threshold
downvote count: 0
has comment: http://stackoverflow.com/comment/42396904
has title: Hashmap Capacity not increased even on reaching threshold
answer count: 1

http://stackoverflow.com/comment/42431478
type: Comment
type: QuestionComment
has text: at what line are you getting the error?
comment on: http://stackoverflow.com/q/26944317
score: 0

last-modified
type: Tag
tag name: last-modified
tags question: http://stackoverflow.com/q/26977784

http://stackoverflow.com/comment/42325345
score: 0
type: Comment
has text: I have already done that in the code, please have a look to the snippet attached
comment on: http://stackoverflow.com/a/26885222
type: AnswerComment

http://stackoverflow.com/comment/42436817
has text: You could add a transient field `Map<String,Field> ` initialized to null and create and save the Map on the first call of getMutivalueFieldsAsMap().
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26891508

http://stackoverflow.com/comment/42388370
type: Comment
has text: Ahh ok, so basically I should use a different name there and everything is ok. Cool, thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26839951

autoboxing
tags question: http://stackoverflow.com/q/26946747
type: Tag
tags question: http://stackoverflow.com/q/26870312
tag name: autoboxing

http://stackoverflow.com/comment/42254446
comment on: http://stackoverflow.com/q/26840737
score: 0
has text: @JamesKanze I just used whatever's on Ideone, I believe that's g++ 4.8.2
type: Comment
type: QuestionComment

machine-learning
tags question: http://stackoverflow.com/q/26871585
tags question: http://stackoverflow.com/q/26987362
tags question: http://stackoverflow.com/q/26949249
tags question: http://stackoverflow.com/q/26947373
tag name: machine-learning
type: Tag
tags question: http://stackoverflow.com/q/26836729

http://stackoverflow.com/q/26833517
tagged with: android
has answer: http://stackoverflow.com/a/49012732
has answer: http://stackoverflow.com/a/59870822
possible better answer: http://stackoverflow.com/a/55631110
type: AnsweredQuestion
score: 27
has answer: http://stackoverflow.com/a/55631110
has answer: http://stackoverflow.com/a/27480173
tagged with: java
has answer: http://stackoverflow.com/a/56230701
has answer: http://stackoverflow.com/a/50160231
accepted answer: http://stackoverflow.com/a/37704732
has comment: http://stackoverflow.com/comment/96207770
type: Question
has body: I unexpectedly encountered the following error while trying to run my application: Binary XML file line #8: Error inflating class android.support.v7.widget.CardView Below is the log cat: 11-09 13:11:58.558: E/AndroidRuntime(12542): FATAL EXCEPTION: main 11-09 13:11:58.558: E/AndroidRuntime(12542): android.view.InflateException: Binary XML file line #8: Error inflating class android.support.v7.widget.CardView 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:698) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.view.LayoutInflater.inflate(LayoutInflater.java:489) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.view.LayoutInflater.inflate(LayoutInflater.java:396) 11-09 13:11:58.558: E/AndroidRuntime(12542): at com.dooba.beta.ThirdFragment.onCreateView(ThirdFragment.java:15) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1786) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1126) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1489) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:454) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.os.Handler.handleCallback(Handler.java:615) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.os.Handler.dispatchMessage(Handler.java:92) 11-09 13:11:58.558: E/AndroidRuntime(12542): at android.os.Looper.loop(Loo…
tagged with: android-layout
has title: Error inflating class android.support.v7.widget.CardView
linked to: http://stackoverflow.com/q/49512242
has comment: http://stackoverflow.com/comment/106786093
has answer: http://stackoverflow.com/a/59454602
answer count: 11
upvote count: 27
has answer: http://stackoverflow.com/a/27603000
downvote count: 0
tagged with: android-activity
has answer: http://stackoverflow.com/a/59227662
has answer: http://stackoverflow.com/a/27200914
favorite count: 0
has answer: http://stackoverflow.com/a/37704732

http://stackoverflow.com/a/26871521
has comment: http://stackoverflow.com/comment/42379342
answers question: http://stackoverflow.com/q/26871255
has comment: http://stackoverflow.com/comment/42304448
has body: You must insert this in your fxml file &lt;?scenebuilder-classpath-element &lt;path_to_CustomControl.jar&gt;?&gt;
has comment: http://stackoverflow.com/comment/42379129
downvote count: 1
has comment: http://stackoverflow.com/comment/42384734
has comment: http://stackoverflow.com/comment/42317714
upvote count: 0
type: AcceptedAnswer
score: -1
type: Answer
accepted answer of: http://stackoverflow.com/q/26871255

http://stackoverflow.com/q/26940557
upvote count: 3
type: Question
has body: My friend asked me to create an app that he can use in conjunction with the game Plague Inc, and he wants the soundtrack from the game to play in the application. Upon doing web research I have tried everything and nothing works. Is it possible to call the soundtrack from a java package (like with an image) instead of specifying folder directories and URLs? There was some promising information I found online but when I ran the code after trying it, the AudioInputStream keeps on giving me errors. I have tried using the clauses exceptions but that severely conflicted with the main method and the application would not even run. I have tried putting the coding in the constructor, a new method and even in the main method itself but all of them just throw out errors when I run the application (I don't even know where to put it so that it will work). Please help as this is getting seriously frustrating. My package is called Sound and the file is called plague.wav And although the game is an Android game, my application runs off Windows PC Here is the coding I have so far: File sound = new File("/Sound/plague.wav"); AudioInputStream audioIn = AudioSystem.getAudioInputStream(sound); Clip clip = AudioSystem.getClip(); clip.open(audioIn); clip.loop(Clip.LOOP_CONTINUOUSLY); } catch (LineUnavailableException ex) { Logger.getLogger(knownDiseases.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(knownDiseases.class.getName()).log(Level.SEVERE, null, ex); } catch (UnsupportedAudioFileException ex) { Logger.getLogger(knownDiseases.class.getName()).log(Level.SEVERE, null, ex); }
tagged with: audio
score: 3
has title: Can I call a .mp3 or .wav file from a Java package in NetBeans?
linked to: http://stackoverflow.com/q/3369794
tagged with: java
duplicate of: http://stackoverflow.com/q/3369794
has answer: http://stackoverflow.com/a/26940999
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26940999
type: AnsweredQuestion
tagged with: netbeans

http://stackoverflow.com/a/26909002
upvote count: 1
score: 1
has body: You might want to run bigquery.tables().list(projectId, datasetId).execute() on it's own line, then catch the error if any. Then of course you run next getTables(). You might want to dig in and search for other messages, like problems with credentials, SSL handshake problem. A full dump of the request would help you.
answers question: http://stackoverflow.com/q/26879046
downvote count: 0
type: Answer

http://stackoverflow.com/a/26842327
has body: Try this.. Only thing You need to change is IF condition public static void sort(int[] array){ for(int barrier = array.length-1; barrier &gt;= 0; barrier--){ for(int index = 0; index &lt; barrier; index++){ if(array[index] &gt; array[index+1]){ int tmp = array[index]; array[index] = array[index + 1]; array[index + 1] = tmp; } } }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26842259
has comment: http://stackoverflow.com/comment/42248308

http://stackoverflow.com/comment/42326194
type: QuestionComment
comment on: http://stackoverflow.com/q/26885147
has text: looks like I should use `&quot;&apos;&amp;` these in xml/xhtml and in my expression I should replace these. Is this the problem? if so do I have to escape this with \ ?
score: 0
type: Comment

http://stackoverflow.com/q/26902103
has comment: http://stackoverflow.com/comment/42356980
has comment: http://stackoverflow.com/comment/42356560
has comment: http://stackoverflow.com/comment/42356366
has comment: http://stackoverflow.com/comment/42356612
has body: I have to send user's location via sms. I want to get location first from gps and if gps in not available then it should send location from network. But my app sends two messages at the same time one from gps and one from network although the wifi network is turned off in my device I don't know from where it is getting location. I want it to use only gps first and if it doesn't find gps then send message from network. Here is my code. public class AlarmReceiver extends BroadcastReceiver implements LocationListener { long time = 0 * 1000; long distance = 0; boolean isGPSEnabled = false; boolean isNetworkEnabled = false; Location location; String device_id; double latitude ; double longitude; protected LocationManager locationManager; // flag for GPS status boolean canGetLocation = false; String phoneNo = "+923300000009"; @SuppressLint("NewApi") @Override public void onReceive(Context context, Intent intent) { System.out.println("alarm receiver...."); Intent service = new Intent(context, MyService.class); context.startService(service); //Start App On device restart if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) { Intent App = new Intent(context, MainActivity.class); App.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(App); } TelephonyManager tm = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE); device_id = tm.getDeviceId(); // returns IMEI number } try { locationManager = (LocationManager)context.getSystemService(context.LOCATION_SERVICE); // getting GPS status isGPSEnabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); // getting network status isNetworkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); if (!isGPSEnabled &amp;&amp; !isNetworkEnabled) { // no network provider is enabled } else { this.canGetLocation = true; // First check from GPS Provider if (isGPSEnabled) { if (location == null) { locationManager.requestLocationUpdates(LocationManager.GPS_PRO…
has comment: http://stackoverflow.com/comment/42357134
has comment: http://stackoverflow.com/comment/42356666
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42356186
tagged with: gps
answer count: 0
has comment: http://stackoverflow.com/comment/42356425
has comment: http://stackoverflow.com/comment/42356678
tagged with: java
has title: Android: getting location from network when wifi is turned off
type: Question
has comment: http://stackoverflow.com/comment/42356642
has comment: http://stackoverflow.com/comment/42356625
score: 0
has comment: http://stackoverflow.com/comment/42357031
has comment: http://stackoverflow.com/comment/42356569
has comment: http://stackoverflow.com/comment/42356219

http://stackoverflow.com/comment/42343251
has text: @Mageneto: **AGAIN**, please improve your question.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26894116

http://stackoverflow.com/comment/42347130
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26851599
type: AnswerComment
has text: not this one either: `find /Library/Java/JavaVirtualMachines -type l` brings nothing but some native libraries

http://stackoverflow.com/q/26898657
downvote count: 1
linked to: http://stackoverflow.com/q/3481828
has body: I am trying to write something in Java that basically does the same thing as "Text-to-Columns" in Excel. I have a long string of data (parsed out from some HTML) and I formatted it to divide the data I need by a semicolon. For example Str = brand name;1242141;brand name;753216;brand name;2356123;brand name;656258; So I want each of the brand names and numbers to be in their own cell. Any ideas on how to do this?
has answer: http://stackoverflow.com/a/26899815
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10187218
score: 1
favorite count: 0
has title: How to make Excel's "Text to columns" in Java?
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/42352372
tagged with: excel
tagged with: hssf
tagged with: java

http://stackoverflow.com/q/26914433
answer count: 1
tagged with: web
has answer: http://stackoverflow.com/a/26914877
score: 0
has body: I am new to Java web programming, I'm trying to make a web crawler, Using the Crawler4j sample code My problem is that when I submit the repost request, the Crawling task ( which is a blocking task) takes some time to get done, Heroku hosting has a request timeout of 3 seconds, which makes it impossible to run a synchronous crawling task, The same program works just fine on my local machine. From what I read, it's not possible to change Heroku's timeout with the basic/free offer. I was wondering if it was possible to launch this as an asynchronous task ( well I do know it is possible using the CrawlerController.startNonBlocking() function) and wait for it to finish so that I can show the results of the crawling operation. @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ String url = request.getParameter("url"); CrawlConfig config = new CrawlConfig(); String crawlStorageFolder = "/tmp/temp_storage"; config.setCrawlStorageFolder(crawlStorageFolder); int numberOfCrawlers = 1; config.setPolitenessDelay(1); config.setMaxDepthOfCrawling(2); config.setMaxPagesToFetch(5); config.setResumableCrawling(false); PageFetcher pageFetcher = new PageFetcher(config); RobotstxtConfig robotstxtConfig = new RobotstxtConfig(); RobotstxtServer robotstxtServer = new RobotstxtServer(robotstxtConfig, pageFetcher); CrawlController controller = null; try { controller = new CrawlController(config, pageFetcher, robotstxtServer); } catch(Exception e){ e.printStackTrace(); } controller.addSeed(url); controller.start(Crawler.class, numberOfCrawlers); // Methods showing the results of the crawling ... }
type: AnsweredQuestion
has title: Blocking Task on Java web application, and request timeout on Heroku server
type: Question
tagged with: heroku
tagged with: java
accepted answer: http://stackoverflow.com/a/26914877
tagged with: crawler4j
tagged with: web-crawler

http://stackoverflow.com/q/26903186
has comment: http://stackoverflow.com/comment/42393351
has comment: http://stackoverflow.com/comment/42392579
has comment: http://stackoverflow.com/comment/42358237
has answer: http://stackoverflow.com/a/26931525
accepted answer: http://stackoverflow.com/a/26931525
has answer: http://stackoverflow.com/a/27147414
favorite count: 0
tagged with: spring
has comment: http://stackoverflow.com/comment/42358277
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42371198
tagged with: broadleaf-commerce
has comment: http://stackoverflow.com/comment/42358081
upvote count: 1
possible better answer: http://stackoverflow.com/a/27147414
has title: ContextLoader - Context initialization failed
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42357911
has comment: http://stackoverflow.com/comment/42358394
has body: Unable to Start the deployed war file. I got the following error at the terminal [ERROR] 17:23:17 ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in resource loaded from byte array: Cannot resolve reference to bean 'blPersistenceUnitManager' while setting bean property 'persistenceUnitManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blPersistenceUnitManager': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'blMergedDataSources' defined in resource loaded from byte array: Cannot resolve reference to bean 'webDS' while setting bean property 'sourceMap' with key [TypedStringValue: value [jdbc/web], target type [null]]; The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact. Context.xml <?xml version="1.0" encoding="UTF-8"?> WEB-INF/web.xml <ResourceLink global="jdbc/web" name="jdbc/web" type="javax.sql.DataSource"/> Server.xml <?xml version="1.0" encoding="UTF-8"?> <Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/> <Listener className="org.apache.catalina.core.JasperListener"/> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/> <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/> <Resource auth="Container" driverClassName="com.mysql.jdbc.Driver" …
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42358363
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42358693
answer count: 2

http://stackoverflow.com/a/26833041
has body: If you allow untrusted code to run in a JVM without a security manager, it can turn off private checking via setAccessible thus making private fields and methods available via reflection. Java's SecurityManager has a poor history of withstanding determined attacks so it is not reasonable to assume that SecurityManager will prevent a determined attacker who can cause arbitrary bytecode to load. Even if the SecurityManager holds up, proofs of concept have shown how secrets have been extracted via low-level Java APIs like the serialization API. Can a secret be hidden in a 'safe' java class offering access credentials? lists some of the pitfalls with trying to store sensitive data in fields in a JVM that also runs untrusted code.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/26832844
accepted answer of: http://stackoverflow.com/q/26832844
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42334234
has text: I've already tried to use it, thanks. It block threads even worse than what I have at the moment.
type: Comment
comment on: http://stackoverflow.com/a/26888920
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42498559
type: Comment
type: QuestionComment
has text: unfortunately, you are not explaining it in a meaningful way. i would suggest sitting down with a debugger and determining _exactly_ where the problem is, then see if you can fix it. if not, put _all_ the details into a new question, and then maybe someone will be able to help you.
score: 1
comment on: http://stackoverflow.com/q/26981232

http://stackoverflow.com/comment/42548110
type: AnswerComment
score: 0
type: Comment
has text: Haha. My simple solution is always better than a long code. Whatever is given in question, it will work for it definitely.
comment on: http://stackoverflow.com/a/26991859

http://stackoverflow.com/a/26929451
has body: Answer to the unexcepected behavior of the CascadeType: Adding of @Version seems to change the saving behavior... because when i changed the CascadeType.MERGE to CascadeType.PERSIST it works again. Something more seems to change by adding the @Version: I receive all exception only after the transaction is committed. If i remove the @Version i receive the exception at the persist method.
has comment: http://stackoverflow.com/comment/43017106
score: 0
answers question: http://stackoverflow.com/q/26926503
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26926503
type: Answer

http://stackoverflow.com/comment/42307457
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26874776
type: Comment
has text: Thanks for pointing that out. Corrected the typo.

http://stackoverflow.com/q/26862571
tagged with: listview
linked to: http://stackoverflow.com/q/4247385
has title: How can I change the color of selected item from ListView?
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/26862977
has answer: http://stackoverflow.com/a/26862854
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42285232
has comment: http://stackoverflow.com/comment/42285224
has comment: http://stackoverflow.com/comment/42285189
has comment: http://stackoverflow.com/comment/42285659
linked to: http://stackoverflow.com/q/3506319
has answer: http://stackoverflow.com/a/26862678
has body: I have created an android project in which i have a list view with 6 items. I want that every time I select any item from the list, it gets a colour orange which stays until I press button submit. the code is: <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.SafeWalkApp.SecondActivity" > </RelativeLayout> this is my xml code. I have tried adding the color to color.xml but that is showing me an error message and basically it is for the backgroung. So please help me out on this.
tagged with: java
has comment: http://stackoverflow.com/comment/42285120
type: Question

http://stackoverflow.com/a/27151294
score: 0
has body: XQuery solution. Using this exrpression you can filter input xml document: declare function local:rewrite($node as node()) as node()? { typeswitch ($node) case element() return if (matches(local-name($node), "(version|name|synonym)")) then element {node-name($node)} { $node/@*, for $child in $node/node() return local:rewrite($child) } else () default return $node }; for $m in //metabolite return &lt;metabolite&gt;{for $c in $m/node() return local:rewrite($c)}&lt;/metabolite&gt; Replace (version|name|synonym) with regexp that matches xml node names you need to provide. Java 7 code that evaluates XQuery expression: import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import javax.xml.transform.sax.SAXSource; import javax.xml.transform.stream.StreamResult; import net.sf.saxon.Configuration; import net.sf.saxon.om.DocumentInfo; import net.sf.saxon.query.DynamicQueryContext; import net.sf.saxon.query.StaticQueryContext; import net.sf.saxon.query.XQueryExpression; import org.xml.sax.InputSource; // inside a method Configuration config = new Configuration(); StaticQueryContext sqc = config.newStaticQueryContext(); DynamicQueryContext dqc = new DynamicQueryContext(config); String xq = "XQUERY_EXPRESSION"; try (InputStream xmlFileInput = new FileInputStream("data.xml"); OutputStream xmlFileOutput = new FileOutputStream("data-filtered.xml")) { XQueryExpression expression = sqc.compileQuery(xq); SAXSource source = new SAXSource(new InputSource(xmlFileInput)); DocumentInfo di = config.buildDocument(source); dqc.setContextItem(di); expression.run(dqc, new StreamResult(xmlFileOutput), null); } catch (Exception e) { System.err.println(e.getMessage()); } Saxon (e.g. saxon9he.jar) library must be present in classpath in order to compile and run this code.
answers question: http://stackoverflow.com/q/26960290
type: Answer

http://stackoverflow.com/q/26960601
score: 0
has title: How to Append new Input to existing JFace TreeViewer
tagged with: jface
answer count: 0
type: UnansweredQuestion
has body: I want to emulate the java package explorer view where in new projects are appended to existing explorer view. I tried using setInput and refresh methods but it creates the TreeView for the new input and the old input is gone. How to append a new input to existing elements in TreeViewer. Is there a way to handle this in inputChanged method. Code Snippet : public class FileTree extends ApplicationWindow { /** * FileTree constructor */ public FileTree() { super(null); } /** * Runs the application */ public void run() { // Don't return from open() until window closes setBlockOnOpen(true); // Open the main window open(); // Dispose the display Display.getCurrent().dispose(); } /** * Configures the shell * * @param shell * the shell */ protected void configureShell(Shell shell) { super.configureShell(shell); // Set the title bar text and the size shell.setText("File Tree"); shell.setSize(400, 400); } /** * Creates the main window's contents * * @param parent * the main window * @return Control */ protected Control createContents(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); // Add a checkbox to toggle whether the labels preserve case Button preserveCase = new Button(composite, SWT.CHECK); preserveCase.setText("&amp;Preserve case"); // Create the tree viewer to display the file tree final TreeViewer tv = new TreeViewer(composite); tv.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); tv.setContentProvider(new FileTreeContentProvider()); tv.setLabelProvider(new FileTreeLabelProvider()); tv.setInput("C:\\Auto"); // pass a non-null that will be ignored final Action a = new Action("") { }; final MenuManager mgr = new MenuManager(); mgr.setRemoveAllWhenShown(true); mgr.addMenuListener(new IMenuListener() { @Override public void menuAboutToShow(IMenuManager manager) { IStructuredSelection selection = (IStructuredSelection) tv .getSelection(); if (!selection.isEmpty()) { try { a.setImageDescripto…
has comment: http://stackoverflow.com/comment/42481309
has comment: http://stackoverflow.com/comment/42459739
has comment: http://stackoverflow.com/comment/42459846
has comment: http://stackoverflow.com/comment/42460108
tagged with: java
type: Question
tagged with: eclipse-plugin
tagged with: eclipse-rcp

http://stackoverflow.com/comment/42460597
score: 0
has text: @MikeOliveira No we can't because you have only 4 reputation. For chat you require at least 20 reputation.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26959489

http://stackoverflow.com/comment/42397924
has text: I'm a little understand about it,Thanks for your answer!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26925665
type: AnswerComment

http://stackoverflow.com/comment/42301199
has text: @Jaskey maybe other classes implemented in other libraries that extends OutputStream but don't follow this "flush-on-close" contract that is stated in nowhere? :-)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26865845

http://stackoverflow.com/comment/42552445
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26976473
has text: This is strange. When non-application exception is thrown then transaction should be rolled back as sepcification says. What symptoms do you experience by saying that it is not rolled back? E.g. data are commited to DB?
type: AnswerComment

http://stackoverflow.com/comment/43108387
comment on: http://stackoverflow.com/a/27324435
has text: The json object is read from a file, not streamed from Twitter.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26962112
has comment: http://stackoverflow.com/comment/42462512
downvote count: 0
has comment: http://stackoverflow.com/comment/42462311
answers question: http://stackoverflow.com/q/26962034
has comment: http://stackoverflow.com/comment/42462307
type: Answer
has comment: http://stackoverflow.com/comment/42500342
score: 1
upvote count: 1
has body: A prime number is defined as a number only divisible by itself and 1. To determine if a number N is a prime, a naive approach would be to check if the number is divisible by any number between 1 and N. public static boolean isPrime (int num) { for (int i=2; i&lt;num; i++) if (num % i == 0) // num is divisible by i return false; // num is not prime. return true; // because num passed all tests, num is prime. }

http://stackoverflow.com/comment/42411786
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26930862
score: 0
has text: @StuPointerException.. observe the simple code below as: if(boolean Exp1){ String someStr = "FirstStrObj"+someVar1;}else{ String someStr = "FirstStrObj"+someVar2;} then the doubt is how many times the string object "FirstStrObj" is created?

http://stackoverflow.com/comment/42243014
type: Comment
type: QuestionComment
has text: @Seelenvirtuose: DBOperations operations = new DBOperations(); as a 'global' variable in my Harta.java. public Connection conexiune; in my DBOperations.java.
comment on: http://stackoverflow.com/q/26839139
score: 0

http://stackoverflow.com/a/26855135
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42272577
type: Answer
has body: Of course it's more efficient to specify/reduce the fields you are trying to access. Less data to access by the RDBMS. Less Data to transfer via network in case you're trying to access a remote DB. Furthermore The * specifier does not guarantee the order of the returned fields. If your code is supposed to work with different DB Engines you may be surprised to see that the returned column #3 refers to a different content (been there done that). So even if you're trying to access the full width of a statement/table it is still saver to explicitly specify the cols you like to access.
score: 2
has comment: http://stackoverflow.com/comment/42273996
downvote count: 0
has comment: http://stackoverflow.com/comment/42292796
answers question: http://stackoverflow.com/q/26855015
has comment: http://stackoverflow.com/comment/42283014
accepted answer of: http://stackoverflow.com/q/26855015
upvote count: 2

http://stackoverflow.com/comment/42426619
has text: I usually prefer `(9.0 / 5.0) * C + 32.0` over `d` (or even uppercase `D`) because `d` seems to be rather unknown. And if confusion counts: `double num = (010D / 0X5.P0) * C + 32E0;`
type: Comment
score: 2
comment on: http://stackoverflow.com/a/26941250
type: AnswerComment

soap
tags question: http://stackoverflow.com/q/26974981
tags question: http://stackoverflow.com/q/26871568
tags question: http://stackoverflow.com/q/26861163
tags question: http://stackoverflow.com/q/26912032
tags question: http://stackoverflow.com/q/26842375
type: Tag
tags question: http://stackoverflow.com/q/26917870
tags question: http://stackoverflow.com/q/26867418
tags question: http://stackoverflow.com/q/26907856
tags question: http://stackoverflow.com/q/26850635
tags question: http://stackoverflow.com/q/26869577
tags question: http://stackoverflow.com/q/26862786
tags question: http://stackoverflow.com/q/26874795
tags question: http://stackoverflow.com/q/26918008
tags question: http://stackoverflow.com/q/26854098
tags question: http://stackoverflow.com/q/26989634
tags question: http://stackoverflow.com/q/26861801
tags question: http://stackoverflow.com/q/26849496
tags question: http://stackoverflow.com/q/26844581
tags question: http://stackoverflow.com/q/26866203
tags question: http://stackoverflow.com/q/26873669
tags question: http://stackoverflow.com/q/26906849
tag name: soap
tags question: http://stackoverflow.com/q/26906442
tags question: http://stackoverflow.com/q/26906454

http://stackoverflow.com/q/26959488
linked to: http://stackoverflow.com/q/18618745
tagged with: eclipse
linked to: http://stackoverflow.com/q/25579362
has answer: http://stackoverflow.com/a/28007641
answer count: 2
possible better answer: http://stackoverflow.com/a/40099025
has comment: http://stackoverflow.com/comment/42457442
downvote count: 0
tagged with: web
has answer: http://stackoverflow.com/a/40099025
favorite count: 0
linked to: http://stackoverflow.com/q/24735065
has body: I created my first web service and all seems to run ok, but when I launch the Web Service Explorer, it returns a HTTP ERROR: 500. I'm using the version Luna Service Release 1 (4.4.1) of Eclipse, Tomcat 8.0.14, Axis2 1.6.2 and JRE 1.8.0_25. I read that it's solved changing the version to jre7, but i didn't work. [Edited] What I was doing is this tutorial. The problem comes when I tried the second part. Instead of appears the Web Services Explorer I get the 500 Error. Thanks for your help! :D
accepted answer: http://stackoverflow.com/a/28007641
tagged with: service
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: explorer
upvote count: 1
has title: Error 500 launching the Web Service Explorer with Eclipse
type: Question
has comment: http://stackoverflow.com/comment/42458856

http://stackoverflow.com/comment/42277215
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26857818
type: Comment
has text: if parent class doesn't that method then how to call `super.onBackPressed();` ?

http://stackoverflow.com/comment/42280392
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26859738
has text: Any kind of implementing the feature is highly dependent on the framework. I think you should provide details about how are get requests and forms are handled by the fw.
score: 0

http://stackoverflow.com/q/26990642
type: Question
has comment: http://stackoverflow.com/comment/42514591
tagged with: iterator
has title: Getting java.util.ConcurrentModificationException even when I am not adding to or removing from an ArrayList
has comment: http://stackoverflow.com/comment/42514549
has comment: http://stackoverflow.com/comment/42513966
has comment: http://stackoverflow.com/comment/42512829
has comment: http://stackoverflow.com/comment/42513195
has body: public void modifyList(String key, List&lt;Person&gt; persons, String value) { if (StringUtils.isNotBlank(key)) { for (Person person: persons) { if (person!= null &amp;&amp; key.equalsIgnoreCase(person.getName())) { person.setValue(value); break; } } } } In the above mentioned code, I am getting java.util.ConcurrentModificationException in the third line. Also, the occurrence of the exception is rare. What could be the reason for this.
score: 0
has comment: http://stackoverflow.com/comment/42512746
has comment: http://stackoverflow.com/comment/42514304
has comment: http://stackoverflow.com/comment/42552818
type: UnansweredQuestion
tagged with: foreach
tagged with: list
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42512870
tagged with: collections

http://stackoverflow.com/a/26917179
score: 0
has comment: http://stackoverflow.com/comment/42439134
has comment: http://stackoverflow.com/comment/42395472
answers question: http://stackoverflow.com/q/26917123
has body: Take a look at this class (and there are plenty of associated tutorials out there). http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/multipart/MultipartFile.html
type: Answer

http://stackoverflow.com/a/26940052
has comment: http://stackoverflow.com/comment/42443549
has comment: http://stackoverflow.com/comment/42436888
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26939574
accepted answer of: http://stackoverflow.com/q/26939574
type: Answer
has body: The problem is that you're trying to access a regular Item as a RichTextItem. The RichTextItem are special fields that are created with its own method just like this: RichTextItem rtsample = (RichTextItem)sampledoc.createRichTextItem('samplerichtextfield'); It's different to the regular Items that can be created with a simple sampledoc.replaceItemValue(etc). So, if you want to know if a item is RichTextItem and if it does not exist, create it, you can do this: RichTextItem rti = null; Item item = doc.getFirstItem("somefield"); if (item != null) { if (item instanceof RichTextItem) { //Yay! rti = (RichTextItem) item; } else { //:-( } } else { rti = doc.createRichTextItem("somefield"); //etc. }
upvote count: 1

http://stackoverflow.com/q/26927269
has body: When creating the PropertySheet in the createProperties method of a BeanNode subclass, is there a way to change height of a single row? Or is there a way to tell the property to change its height according to its content? (There should be displayed a 64x64 valueIcon in the property, but parts of the height are cut off)
type: Question
score: 1
tagged with: java
has title: Netbeans Property Sheet - Row Height
tagged with: propertysheet
answer count: 1
downvote count: 0
favorite count: 0
tagged with: netbeans-platform
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26927366
tagged with: properties
tagged with: netbeans
upvote count: 1

http://stackoverflow.com/q/26867055
has comment: http://stackoverflow.com/comment/42293627
has answer: http://stackoverflow.com/a/62329860
favorite count: 0
possible better answer: http://stackoverflow.com/a/44370157
has body: The email gets sents only to the last email address in the String[] to array. I'm intending to send to all email addresses added to the array. How can I make that work? public void sendMail(String from, String[] to, String subject, String msg, List attachments) throws MessagingException { // Creating message sender.setHost("smtp.gmail.com"); MimeMessage mimeMsg = sender.createMimeMessage(); MimeMessageHelper helper = new MimeMessageHelper(mimeMsg, true); Properties props = new Properties(); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.port", "425"); Session session = Session.getDefaultInstance(props, null); helper.setFrom(from); helper.setTo(to); helper.setSubject(subject); helper.setText(msg + " hi welcome </html", true); Iterator it = attachments.iterator(); while (it.hasNext()) { FileSystemResource file = new FileSystemResource(new File((String) it.next())); helper.addAttachment(file.getFilename(), file); } // Sending message sender.send(mimeMsg); }
has answer: http://stackoverflow.com/a/52102814
answer count: 9
tagged with: spring
has answer: http://stackoverflow.com/a/44370157
has answer: http://stackoverflow.com/a/65105833
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/41219489
type: Question
has answer: http://stackoverflow.com/a/39269200
accepted answer: http://stackoverflow.com/a/26867119
has title: How to send an email to multiple recipients in Spring
has answer: http://stackoverflow.com/a/44632513
has answer: http://stackoverflow.com/a/72401860
linked to: http://stackoverflow.com/q/2925153
score: 35
has answer: http://stackoverflow.com/a/26867119
upvote count: 35
tagged with: email
downvote count: 0

http://stackoverflow.com/comment/42480498
comment on: http://stackoverflow.com/q/26971315
has text: Check referenced libraries. Are they accessible?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42355230
comment on: http://stackoverflow.com/a/26901378
score: 0
type: AnswerComment
has text: I don't have that option. I have main class and main applet.
type: Comment

http://stackoverflow.com/q/26958073
answer count: 3
has title: Is there any design pattern to use?
has answer: http://stackoverflow.com/a/27899948
has body: I should use and name a design pattern for following problem: I have separate interfaces: Basic, Complex. All classes implement Basic. Some of the classes implement Complex but they have to inherit from Abstract class. I was thinking about decorator but I don't know if I'm right. Code is in Java.
score: 4
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/27445303
has comment: http://stackoverflow.com/comment/42455266
has comment: http://stackoverflow.com/comment/42455117
has comment: http://stackoverflow.com/comment/43329668
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43330308
tagged with: design-patterns
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42455330
possible better answer: http://stackoverflow.com/a/27445303
has answer: http://stackoverflow.com/a/27450030
accepted answer: http://stackoverflow.com/a/27450030
tagged with: java
has comment: http://stackoverflow.com/comment/42455366
has comment: http://stackoverflow.com/comment/42455134

http://stackoverflow.com/comment/42509637
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26988526
type: AnswerComment
has text: Thank you for a quick answer. As I understand. If I have an object `A` using a piece of memory and program done with `A` so `A` still waiting till memory running low to make that memory free, right?

http://stackoverflow.com/comment/42336033
comment on: http://stackoverflow.com/q/26889162
has text: @Peter, I am working on a migration from very complex Ant script, and I cannot change the structure of the project, that's why I need to create more tasks for independent builds. What is the correct setting of the `classpath` to get the dependencies from the definition? Thanks!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42348487
type: Comment
has text: You must create create the `Thread` objects in a loop and then save them in a `java.util.Collection` within your `User` object. Building an object from SQL is always the same, doesn't matter if it's a `User` object or a `Thread` object. Maybe you could also have a look at some NoSQL solution, there you could store all those one-to-many relations within a single document. And retrieve it without joining data.
comment on: http://stackoverflow.com/a/26897643
score: 0
type: AnswerComment

http://stackoverflow.com/q/26911477
tagged with: gradle
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/42377112
score: 0
has title: maven project depending on gradle one in eclipse
has answer: http://stackoverflow.com/a/26911966
has body: When I use maven projects in eclipse they automatically manage dependencies. That is - if the project A is imported to eclipse, all other projects using A have the project itself in "build path" instead of the artifact. This makes changes done in project A instantly visible to e.g. unit tests in other projects. I have a maven project B depending on gradle project A. How to replicate this behaviour? Currently I need to rebuild B (and deploy to local maven repo) whenever I change it.
linked to: http://stackoverflow.com/q/25333657
type: UnansweredQuestion
tagged with: maven
tagged with: dependency-management
linked to: http://stackoverflow.com/q/17281927
tagged with: java

http://stackoverflow.com/comment/42319980
type: Comment
has text: Could it be some naming conflict like here: http://stackoverflow.com/questions/9914873/play-2-0-java-cant-pass-list-into-template ?
comment on: http://stackoverflow.com/a/26881703
score: 0
type: AnswerComment

http://stackoverflow.com/q/26950920
tagged with: sieve-of-eratosthenes
answer count: 2
has body: Here is small snippet of a program I'm currently working on where the infinite loop is occurring. I have set all the variables to the values they are at in the program when it encounters this loop. The goal of this loop is to get it to either break (which it won't with these values of course) or to go through the entire loop and then move on, which I believe it should based on the conditions set in the for loop, but instead it becomes an infinite loop. I am lost and wondering if someone could help me. Why is this an infinite loop and how can I fix it? Thanks. The first code snippet is the minimal code to show the infinite loop. The place where I have put the System.out.println("Infinite"); is where the infinite loop is occurring. It never reaches the if statement in the for loop. I have tried debugging to no avail. int e = 1; int f = 0; int q = 2; int posInt = 10; int[] Prime = new int[posInt]; Prime[0] = 2; Prime[1] = 3; Prime[2] = 5; int stay = 0; while(stay == 0){ while(e &lt;= posInt){ if((q + 1) == Prime[f]){ stay++; System.out.println("BREAKING"); break; } e++; f++; } q++; } Here is the entire program so far in case it helps. The goal is to test whether or not a number entered by the user is a prime number by using the Sieve of Eratosthenes. I realize there may be other errors in the program and it may not be right, but I'm still working on it. Currently I cannot progress though as I am stuck in this infinite loop. int posInt; Scanner reader = new Scanner(System.in); System.out.print("Please enter in any positive integer greater than one to see if it is a prime number: "); posInt = reader.nextInt(); System.out.println(); int n = posInt; int q = 2; int a = 3; int b = 1; int[] list = new int[n]; list[0] = 2; while(a &lt;= n){ list[b] = a; a++; b++; } int c = 2; int d = 0; int P = 0; int nP = 0; int[] notPrime = new int[n]; int[] Prime = new int[n]; while(c &lt;= n){ if(list[d] == q){ Prime[P] = list[d]; P++; } else if(list[d] % q == 0){ notPrime[nP] = list[d]; n…
upvote count: 1
has answer: http://stackoverflow.com/a/26951069
accepted answer: http://stackoverflow.com/a/26951069
has comment: http://stackoverflow.com/comment/42443060
favorite count: 0
has comment: http://stackoverflow.com/comment/42442992
possible better answer: http://stackoverflow.com/a/26951462
has answer: http://stackoverflow.com/a/26951462
has comment: http://stackoverflow.com/comment/42443121
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42442991
tagged with: infinite-loop
has title: Java - Why is this an infinite loop and how can I fix it?

http://stackoverflow.com/a/26934381
answers question: http://stackoverflow.com/q/26934220
score: 0
has body: You should use a many-to-many setting, e.g. with annotations you'd d: class Song { @ManyToMany @JoinTable( name = "user_songs_mapping", joinColumns = @JoinColumn ( name = "song_id", referencedColumnName = "songid" ), //assuming the id column in the song table is named songid inverseJoinColumns = @JoinColumn ( name = " user_id", referencedColumnName = "userid" ) ) //assuming the id column in the user table is named userid Set&lt;Users&gt; users; } class User { @ManyToMany( mappedBy = "users" ) Set&lt;Song&gt; songs; } Note that one side defines the table and the other side just declares where to find the mapping. In my example Song would be the owning side, i.e. you'd need to update the users set in Song to get changes persisted. If you want User to be the owning side just switch annotations and join columns. Update: Rereading your question I assume you want a unidirectional association user->songs. Thus only add the relation to User: class User{ @ManyToMany @JoinTable( name = "user_songs_mapping", joinColumns = @JoinColumn ( name = " user_id", referencedColumnName = "userid" ), inverseJoinColumns = @JoinColumn ( name = "song_id", referencedColumnName = "songid" ) ) Set&lt;Song&gt; songs; }
type: Answer

http://stackoverflow.com/comment/42339994
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26893128
has text: define belowAverage? How much?
type: Comment

pessimistic-locking
type: Tag
tags question: http://stackoverflow.com/q/26878396
tag name: pessimistic-locking

http://stackoverflow.com/comment/42249329
has text: dear is any langue convert video into string ???? strange question
comment on: http://stackoverflow.com/q/26842768
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42460627
score: 0
type: Comment
has text: It's not as shocking if you remember that a basic feature of polymorphism is that contracts are inherited, meaning the entire HashSet class must adhere to the contract of the Set class, which [goes out of its way to point out](https://docs.oracle.com/javase/8/docs/api/java/util/Set.html) that “Great care must be exercised if mutable objects are used as set elements. The behavior of a set is not specified if the value of an object is changed in a manner that affects equals comparisons while the object is an element in the set.”
type: AnswerComment
comment on: http://stackoverflow.com/a/26948360

http://stackoverflow.com/a/29981962
has body: ios [localPlayer generateIdentityVerificationSignatureWithCompletionHandler:^(NSURL *publicKeyUrl, NSData *signature, NSData *salt, uint64_t timestamp, NSError *error) { if(error != nil){ //login failed. }else{ NSLog(@"signature : %@", [signature base64Encoding]); NSLog(@"salt : %@", [salt base64Encoding]); NSLog(@"PUBLIC_KEY_URL : %@", publicKeyUrl); NSLog(@"signature : %@", [signature base64EncodedStringWithOptions:0]); NSLog(@"salt : %@", [salt base64EncodedStringWithOptions:0]); NSLog(@"timestamp : %lld", timestamp); NSLog(@"Gamecenter login success."); NSMutableData *payload = [[NSMutableData alloc] init]; [payload appendData:[[GKLocalPlayer localPlayer].playerID dataUsingEncoding:NSUTF8StringEncoding]]; [payload appendData:[[[NSBundle mainBundle] bundleIdentifier] dataUsingEncoding:NSUTF8StringEncoding]]; uint64_t timestampBE = CFSwapInt64HostToBig(timestamp); [payload appendBytes:&amp;timestampBE length:sizeof(timestampBE)]; [payload appendData:salt]; NSString *ext_id = localPlayer.playerID; NSString *encodedSignedData = [payload base64EncodedStringWithOptions:0]; NSLog(@"SIGNEDDATA : %@", encodedSignedData); NSString *encodedSignature = [signature base64Encoding]; NSString *publicKeyUrlStr = [publicKeyUrl absoluteString]; } }]; java code is.. public static String makeEncodedSignedDataForAppleVerify(String player_id, String bundle_id, String timestamp, String salt){ return new String(Base64.encodeBase64(concat(player_id.getBytes(), bundle_id.getBytes(), ByteBuffer.allocate(8).putLong(Long.parseLong(timestamp)).array(), Base64.decodeBase64(salt)))); } public static boolean gamecenterUserVerify(String publicKeyUrl, String signedData, String signature){ try{ URL url = new URL(publicKeyUrl); HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(); HttpURLConnection httpConn = (HttpURLConnection) urlConn; httpConn.setAllowUserInteraction(false); httpConn.connect(); InputStream in = httpConn.getInputStream(); BufferedInputStream bis = new BufferedInput…
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26900116
upvote count: 2

http://stackoverflow.com/q/26883601
type: Question
has answer: http://stackoverflow.com/a/26904095
has comment: http://stackoverflow.com/comment/42325096
tagged with: java
has title: Uploading Multipart-form-data to php
has comment: http://stackoverflow.com/comment/42324074
tagged with: forms
has comment: http://stackoverflow.com/comment/42323788
has comment: http://stackoverflow.com/comment/42325300
answer count: 1
linked to: http://stackoverflow.com/q/19762581
tagged with: upload
has comment: http://stackoverflow.com/comment/42323524
has body: I would like upload any data (Username, Description,..) and a photo from my Android-App to my Server (PHP-Script). By searching for this i found a solution: How to take a photo and send to HTTP POST request with Android? By click on my send button, the upload-process starts and the php-script works but the $_POST -Vars are empty? Can anybody help me? My request-code: [...] case R.id.btnSend: String strName = tName.getText().toString(); String strEmail = tEmail.getText().toString(); String strDatum = tDatum.getText().toString(); String strBeschreibung = tBeschreibung.getText().toString(); nvPairs = new ArrayList&lt;NameValuePair&gt;(2); nvPairs.add(new BasicNameValuePair("sender", "AndoidApp")); nvPairs.add(new BasicNameValuePair("name", strName)); nvPairs.add(new BasicNameValuePair("email", strEmail)); nvPairs.add(new BasicNameValuePair("datum", strDatum)); nvPairs.add(new BasicNameValuePair("beschreibung", strBeschreibung)); nvPairs.add(new BasicNameValuePair("bild", bmpUrl)); new UploadTask().execute(); } [...] private class UploadTask extends AsyncTask&lt;Void, Void, List&lt;String&gt;&gt; { @Override protected List&lt;String&gt; doInBackground(Void... params) { String response = ""; try { response = new MultipartServer().postData(new URL(postUrl), nvPairs); } catch (IOException e) { e.printStackTrace(); } return null; } } On the MultipartServer-Code i changed the line: if ((avatarName = pair.getName()).equals("avatar")) { avatarPath = pair.getValue(); } to this: if ((avatarName = pair.getName()).equals("bild")) { avatarPath = pair.getValue(); } And the Variables "bmpUrl" and "postUrl" are set correctly at an another line in my code.
has comment: http://stackoverflow.com/comment/42327149
has comment: http://stackoverflow.com/comment/42323378
score: 0
has comment: http://stackoverflow.com/comment/42323617
tagged with: android
has comment: http://stackoverflow.com/comment/42323244
has comment: http://stackoverflow.com/comment/42349029
type: UnansweredQuestion
tagged with: php
has comment: http://stackoverflow.com/comment/42326988

http://stackoverflow.com/a/57275198
score: 1
upvote count: 1
has body: Please try File-> Synchronize. Then close and reopen IntelliJ before you invalidate. Once I restarted. I would have invalidated but the synchronize cleared everything after restarting.
downvote count: 0
answers question: http://stackoverflow.com/q/26952078
type: Answer

http://stackoverflow.com/a/26961089
downvote count: 2
has comment: http://stackoverflow.com/comment/42460480
upvote count: 7
has body: You could use the writeTo method of ByteArrayOutputStream. ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] bytes = new byte[8]; bos.write(bytes); bos.writeTo(oos); You can create an instance of ByteArrayOutputStream. You then need to write the data to this ByteOutputStream instance and then using the writeTo method, which accepts an OutputStream, you can enable the ByteArrayOutputStream to write the output, to the instance of OutputStream which you passed as the argument. Hope it works!
has comment: http://stackoverflow.com/comment/102351071
score: 5
has comment: http://stackoverflow.com/comment/42467714
answers question: http://stackoverflow.com/q/26960997
type: Answer
has comment: http://stackoverflow.com/comment/42461976

http://stackoverflow.com/comment/42393647
comment on: http://stackoverflow.com/q/26923062
score: 0
type: Comment
type: QuestionComment
has text: I know this isn't what you asked - but instead of all your `if` statements, you could just write `totalPrice += e.getSource().getPrice();`

http://stackoverflow.com/q/26951322
type: AnsweredQuestion
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26952463
tagged with: spring
answer count: 1
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has title: Spring Data JPA LocalEntityManagerFactoryBean getNativeEntityManagerFactory returns null
has body: I'm trying to attach an Interceptor to my Hibernate JPA EntityManagerFactory following sds's directions on this post, but with java config. Here's the relevant part of my config: @Bean public JpaTransactionManager transactionManager() { JpaTransactionManager txm = new JpaTransactionManager(); txm.setEntityManagerFactory(entityManagerFactory().getObject()); return txm; } @SuppressWarnings("unchecked") @Bean public SynchronizedEntityChangeInterceptor synchronizedEntityChangeInterceptor() { SynchronizedEntityChangeInterceptor synchronizedEntityChangeInterceptor = new SynchronizedEntityChangeInterceptor(); synchronizedEntityChangeInterceptor.registerEntityClasses(Device.class, Artist.class); return synchronizedEntityChangeInterceptor; } @Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean(); entityManagerFactory.setDataSource(dataSource()); entityManagerFactory.setPersistenceUnitName("metamp-client"); entityManagerFactory.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); Properties jpaProperties = new Properties(); jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); jpaProperties.put("hibernate.show_sql", "true"); jpaProperties.put("hibernate.format_sql", "true"); jpaProperties.put("hibernate.hbm2ddl.auto", "update"); jpaProperties.put("hibernate.cache.use_second_level_cache", "false"); entityManagerFactory.setJpaProperties(jpaProperties); return entityManagerFactory; } @Bean public HibernateInterceptor hibernateInterceptor() { HibernateInterceptor hibernateInterceptor = new HibernateInterceptor(); if(entityManagerFactory().getNativeEntityManagerFactory() == null) throw new NullPointerException("This shouldn't happen"); hibernateInterceptor.setSessionFactory( ((HibernateEntityManagerFactory)entityManagerFactory() .getNativeEntityManagerFactory()).unwrap(SessionFactory.class)); hibernateInterceptor.setEntityIntercep…
accepted answer: http://stackoverflow.com/a/26952463
score: 2
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/42369796
has text: See my updated answer with a link to a complete "ready to run" example. You should get it running within 5 minutes :)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26881478

timer
tag name: timer
tags question: http://stackoverflow.com/q/26973933
tags question: http://stackoverflow.com/q/26838110
type: Tag
tags question: http://stackoverflow.com/q/26938644
tags question: http://stackoverflow.com/q/26884169
tags question: http://stackoverflow.com/q/26835878
tags question: http://stackoverflow.com/q/26959439
tags question: http://stackoverflow.com/q/26976386
tags question: http://stackoverflow.com/q/26965049
tags question: http://stackoverflow.com/q/26948013

http://stackoverflow.com/a/26946781
upvote count: 1
answers question: http://stackoverflow.com/q/26946766
score: 1
has comment: http://stackoverflow.com/comment/42435730
downvote count: 0
has comment: http://stackoverflow.com/comment/42435746
has comment: http://stackoverflow.com/comment/42435811
has body: you have both jdk 1.6 and 1.7 in your path remove the older version from the path
type: Answer

http://stackoverflow.com/comment/42343042
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26894590
has text: @MikeOunsworth, I don't think OP can see (and then correct) the compiler errors, since compiler is throwing a NPE :-)

http://stackoverflow.com/comment/42466018
has text: @ankur-singhal thank you for showing me. Although I did as you did and when I print out the array, it only prints out the memory address I believe.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26963970
type: Comment

http://stackoverflow.com/comment/42259105
type: Comment
has text: An arraylist would be the simplest way? every time they enter a number just do an .add(int)
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26848125

http://stackoverflow.com/comment/42352612
has text: `getGraphics` is not how painting is done, take a look at [Painting in AWT and Swing](http://www.oracle.com/technetwork/java/painting-140037.html) and [Performing Custom Painting](http://docs.oracle.com/javase/tutorial/uiswing/painting/) for more details...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26895825

http://stackoverflow.com/comment/42415723
type: Comment
type: QuestionComment
has text: A key is not a String, it consists of bits. Either you should use all possible values of a `byte[]` - possibly by using a hexadecimal representation, or you should use password based encryption.
comment on: http://stackoverflow.com/q/26935310
score: 0

http://stackoverflow.com/comment/42436788
comment on: http://stackoverflow.com/a/26947195
type: AnswerComment
has text: here is the error i tried using what @multisync says it is now different from the first one http://jsfiddle.net/mzfgz20d/
score: 0
type: Comment

http://stackoverflow.com/comment/42480019
comment on: http://stackoverflow.com/q/26972261
type: Comment
has text: Maybe you wanted to write `checkout1[0].Size()` when printing the size?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42397320
has text: If you added a `sout` in the test method, can you see that? Otherwise are you sure you are using a "real" logger, and not the "noop" version?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26924392

http://stackoverflow.com/q/26902895
upvote count: 3
tagged with: workmanagers
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/35042193
answer count: 1
downvote count: 0
tagged with: asynchronous
favorite count: 0
has title: How to create independent thread using spring @Async
type: UnansweredQuestion
tagged with: multithreading
has body: I am using spring @Async with weblogic workmanager, Spring version is 3.2.2 Web.xml : ReportWorkmanager commonj.work.WorkManager Container Shareable weblogic.xml : ReportWorkmanager <fair-share-request-class> Priority 100 </fair-share-request-class> <min-threads-constraint> MinThreadCount 15 </min-threads-constraint> <max-threads-constraint> MaxThreadCount 25 </max-threads-constraint> <work-manager-shutdown-trigger> 120 25 </work-manager-shutdown-trigger> Spring configuration xml : <property name="workManagerName" value="java:comp/env/ReportWorkmanager" /> Controller : @RequestMapping(value = "/publish", method = RequestMethod.POST) public MarketingScenario publishReport(@RequestBody final PublishReportDTO reportDTO, final HttpServletRequest request) throws Exception { reportDTO.setReqUserName(DominoWebUtil.getLoggedInUserName(request)); reportEngine.publishReport(reportDTO); MarketingScenario scenario = scenarioService.findMarketingScenarioById(reportDTO.getScenarioId()); _LOGGER.debug("Job submitted , successfully came out for scenario id {}", reportDTO.getScenarioId()); return scenario; } Service : @Async(value = "reportWorkManagerTaskExecutor") public void publishReport(final PublishReportDTO reportDTO) { //Some long run job } Whenever request is coming from fornt end , controller should intiate job by calling service method and it should returns response with out waiting for service job. When @Async is not applied everything goes perfectly but when I applied, service thread is getting killed because of my request thread is done. Please let me know, Using @Async how to create a thread independent of request thread. That independent thread may run for 2 minutes or 20 minutes depends on input.
tagged with: spring-mvc
score: 3

http://stackoverflow.com/q/26851372
accepted answer: http://stackoverflow.com/a/26852468
has body: I am trying to implement Stanford's POS tagger in a Java application using the following lines of code: MaxentTagger tagger = new MaxentTagger("taggers/english-left3words-distsim.tagger"); String taggedString = tagger.tagString(string); It works fine when running the project in NetBeans, but the executable .jar compiled in NetBeans will not run the tagger. I am fairly new to Java and to programming in general, and I haven't figured out how to log whatever error/exception is occurring in the GUI console of the application, and no error/exception occurs when running the project in NetBeans. A couple things occurred to me that could be happening. The Stanford NLP group says: "The system requires Java 1.8+ to be installed. Depending on whether you're running 32 or 64 bit Java and the complexity of the tagger model, you'll need somewhere between 60 and 200 MB of memory to run a trained tagger (i.e., you may need to give java an option like java -mx200m). Plenty of memory is needed to train a tagger. It again depends on the complexity of the model but at least 1GB is usually needed, often more." http://nlp.stanford.edu/software/tagger.shtml In the shortcut that I use to run the application, I specified the path of a javaw.exe that is version 1.8+, and I also tried replacing the latest release of the tagger with the August 2014 release, pre-Java 8 upgrade, and neither solved the problem. As for the memory issue, I went to my Java control panel and entered "-Xms1024m" as a runtime parameter for every javaw.exe on my machine, and that also did not solve the problem. Can anybody suggest what might be making the .jar fail to run the tagger, when it works fine running the project from NetBeans? Thanks!
has comment: http://stackoverflow.com/comment/42266112
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42265290
has title: Trouble running Java application implementing Stanford POS tagger as a .jar, runs fine in NetBeans IDE
type: AnsweredQuestion
tagged with: java
tagged with: pos-tagger
type: Question
has comment: http://stackoverflow.com/comment/42265853
tagged with: stanford-nlp
answer count: 1
has answer: http://stackoverflow.com/a/26852468
score: 0
has comment: http://stackoverflow.com/comment/42265579

http://stackoverflow.com/comment/42447603
has text: @ChristianConkle I guess they have downvoted due to the lack of research effort. Or maybe because he "borrowed" his code from [here](http://stackoverflow.com/questions/8183840/probability-in-java#8183867) without saying so or with trying to understand that code and changing it accordingly. But I'm just guessing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26953460
score: 1

http://stackoverflow.com/comment/42395921
type: QuestionComment
comment on: http://stackoverflow.com/q/26922525
has text: Where's the Java declaration of `setFilePath()`?
score: 0
type: Comment

jax-rs
tags question: http://stackoverflow.com/q/26989608
tags question: http://stackoverflow.com/q/26967672
tags question: http://stackoverflow.com/q/26864688
tags question: http://stackoverflow.com/q/26863417
tags question: http://stackoverflow.com/q/26875840
tags question: http://stackoverflow.com/q/26890149
tags question: http://stackoverflow.com/q/26914088
tags question: http://stackoverflow.com/q/26903729
tags question: http://stackoverflow.com/q/26985183
tags question: http://stackoverflow.com/q/26863828
tags question: http://stackoverflow.com/q/26955663
tags question: http://stackoverflow.com/q/26969626
tags question: http://stackoverflow.com/q/26862500
tags question: http://stackoverflow.com/q/26986718
type: Tag
tags question: http://stackoverflow.com/q/26919156
tags question: http://stackoverflow.com/q/26834708
tags question: http://stackoverflow.com/q/26974000
tags question: http://stackoverflow.com/q/26866446
tags question: http://stackoverflow.com/q/26881986
tags question: http://stackoverflow.com/q/26945281
tags question: http://stackoverflow.com/q/26849356
tag name: jax-rs

http://stackoverflow.com/a/26942175
has comment: http://stackoverflow.com/comment/42428038
type: Answer
accepted answer of: http://stackoverflow.com/q/26942065
answers question: http://stackoverflow.com/q/26942065
has comment: http://stackoverflow.com/comment/42427935
has comment: http://stackoverflow.com/comment/42427961
score: 0
type: AcceptedAnswer
has body: The simplest way to do this would probably be to use an if statement to run the code in the loop only if the character is not a space. If you don't want to skip the character in the random string, you would need a separate variable to track the current character index in that string. Example: Put this after defining one and two and put the rest of the loop inside it: if(two==' '){ ... } Then, add the space in the output: else{ newSentence+=" "; }
has comment: http://stackoverflow.com/comment/42428011

http://stackoverflow.com/q/26848606
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42264510
has comment: http://stackoverflow.com/comment/42264693
has body: I am searching for an elegant equivalent of this piece of code using Java 8's streams: Collection&lt;X&gt; xs = ...; Map&lt;B, A&gt; map = new SomeMap&lt;&gt;(); for (X x : xs) { A a = x.getA(); Collection&lt;B&gt; bs = x.getBs(); for (B b : bs) map.put(b, a); } That one is a bit too tricky for me as I can’t think of a combination using flatMap and Collectors.toMap which would implement the desired functionality. Compilable example: import java.util.Arrays; import java.util.Collection; import java.util.HashMap; import java.util.Map; public class Application { public static class A {} public static class B {} public static class X { private A a; private Collection&lt;B&gt; bs; public X(A a, Collection&lt;B&gt; bs) { this.a = a; this.bs = bs; } public A getA() { return a; } public Collection&lt;B&gt; getBs() { return bs; } } public static void main(String[] args) { X x1 = new X(new A(), Arrays.asList(new B(), new B())); X x2 = new X(new A(), Arrays.asList(new B())); Collection&lt;X&gt; xs = Arrays.asList(x1, x2); Map&lt;B, A&gt; map = new HashMap&lt;&gt;(); for (X x : xs) { A a = x.getA(); Collection&lt;B&gt; bs = x.getBs(); for (B b : bs) map.put(b, a); } } }
has comment: http://stackoverflow.com/comment/42261831
tagged with: nested-loops
tagged with: java
type: Question
has title: Creating a Map using Java8 streams on a nested Data Structure
score: 5
answer count: 1
has comment: http://stackoverflow.com/comment/42259956
has answer: http://stackoverflow.com/a/26849681
accepted answer: http://stackoverflow.com/a/26849681
has comment: http://stackoverflow.com/comment/42265583
has comment: http://stackoverflow.com/comment/42264739
tagged with: dictionary
has comment: http://stackoverflow.com/comment/42260616
favorite count: 0
upvote count: 5
downvote count: 0
tagged with: java-stream
has comment: http://stackoverflow.com/comment/42261450
has comment: http://stackoverflow.com/comment/42260095
has comment: http://stackoverflow.com/comment/42264338
has comment: http://stackoverflow.com/comment/42260442
tagged with: java-8

http://stackoverflow.com/a/26947134
has body: I don't think you can. JXPath allows navigation of bean hierarchies using the standard bean get/is notation, but doesn't provide a means of accessing annotations on a field. I think you should perhaps look at this answer re. finding annotations. Perhaps you can combine with a JXPath solution ?
type: Answer
accepted answer of: http://stackoverflow.com/q/26947096
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/26947096

http://stackoverflow.com/comment/42514309
has text: @AndrzejDoyle No... I don't have the instance of that class. I only have the instance of `Class` class, which describes the class which I want to load.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26991070

http://stackoverflow.com/comment/42327606
comment on: http://stackoverflow.com/a/26885842
has text: @UweAllner! I tried it in my java program, as `pattern = Pattern.compile("^[a-zA-Z0-9 \"'&!#$%()*+,-./:;?@[\\]^_{|}~]+$"); boolean isValid = pattern.matcher(targetStringToValidate).matches();` but still having the same `java.util.regex.PatternSyntaxException: Unclosed character class` I think there is problem with string escape characters in java. pls help!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26900690
score: 0
has comment: http://stackoverflow.com/comment/42354280
answer count: 1
has title: understanding cuboc libgdx example
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26901868
type: AnsweredQuestion
upvote count: 1
downvote count: 1
has body: I have cloned and was able to produce a functional application from the Cuboc libgdx demo I got from here: https://github.com/libgdx/libgdx-demo-cuboc I am trying to understand this bit of code in the Cuboc libgdx demo. I will add my questions as comments in the code below: package com.badlogic.cubocy; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Pixmap; import com.badlogic.gdx.utils.Array; public class Map { static int EMPTY = 0; /*** *** why do these ints have to be in hex ? ***/ static int TILE = 0xffffff; static int START = 0xff0000; static int END = 0xff00ff; static int DISPENSER = 0xff0100; static int SPIKES = 0x00ff00; static int ROCKET = 0x0000ff; ... private void loadBinary () { /*** *** how did the file "levels.png" get created ? ***/ Pixmap pixmap = new Pixmap(Gdx.files.internal("data/levels.png")); tiles = new int[pixmap.getWidth()][pixmap.getHeight()]; for (int y = 0; y &lt; 35; y++) { for (int x = 0; x &lt; 150; x++) { /*** *** What's up with the bitwise operations? ***/ int pix = (pixmap.getPixel(x, y) &gt;&gt;&gt; 8) &amp; 0xffffff; if (match(pix, START)) { ... } else if (match(pix, DISPENSER)) { ... } else if (match(pix, ROCKET)) { ... } else { tiles[x][y] = pix; } } } ... Thanks!
type: Question
tagged with: libgdx
accepted answer: http://stackoverflow.com/a/26901868
tagged with: java

http://stackoverflow.com/comment/42503220
comment on: http://stackoverflow.com/q/26984591
score: 0
has text: Where are you comparing the hardcoded string to the text field?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42488674
comment on: http://stackoverflow.com/q/26976978
type: Comment
type: QuestionComment
has text: The first way is fine if you know it will always return List<Student> if you aren't sure what it will return you should use your third approach...
score: 1

http://stackoverflow.com/q/26863241
score: 0
has title: XmlPullParser can't find attribute with a colon in its name
answer count: 2
possible better answer: http://stackoverflow.com/a/26863447
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26863447
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26863574
tagged with: xmlpullparser
type: Question
has answer: http://stackoverflow.com/a/26863574
tagged with: java
has body: In my XML there's a tag with an attribute which has a name with a colon in it: &lt;GGS:bericht StUF:bestandsnaam="bestand.txt" &gt; I've tried all these combinations to try and return the value of this attribute: parser.getAttributeValue(null, "StUF:bestandsnaam"); parser.getAttributeValue("StUF", "bestandsnaam"); parser.getAttributeValue(null, "bestandsnaam"); parser.getAttributeValue("bestandsnaam", "StUF"); ... but they all return null. If I manually remove the "StUF:" part of the attribute name, it works by calling: parser.getAttributeValue(null, "bestandsnaam"); So how do you get the value of such an attribute? Without using the int-parameter version of getAttributeValue(), that is.

http://stackoverflow.com/comment/42307565
comment on: http://stackoverflow.com/a/26874876
score: 0
type: AnswerComment
type: Comment
has text: Well he has a lot of problems. But the bottom line of the question says he doesn't know how to check if the number is already entered, which is what I answered.

http://stackoverflow.com/comment/42255390
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26838644
has text: Yes it is a web project with selenium
score: 0

http://stackoverflow.com/q/26963710
has answer: http://stackoverflow.com/a/26963753
tagged with: java
has comment: http://stackoverflow.com/comment/42465319
tagged with: eclipse
tagged with: image
type: AnsweredQuestion
has body: I got an application where you can make and save a picture. Now I when this picture to display in another class. I just started programming in java and have no idea how to do this. FotoMaker.java: package com.example.random; import java.io.FileNotFoundException; import android.app.Activity; import android.content.ContentValues; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.net.Uri; import android.view.View; import android.view.Window; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; public class FotoMaker extends Activity { ImageView iv; Uri uriOfPicture; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.addpictolist); iv = (ImageView) findViewById(R.id.imageView); Button btn = (Button) findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick (View v){ takeImageFromCamera(); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == 0) { Bitmap image=createBitmapFromURI(uriOfPicture); iv.setImageBitmap(image); } } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); if (uriOfPicture != null) { outState.putString("cameraImageUri", uriOfPicture.toString()); } } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); if (savedInstanceState.containsKey("cameraImageUri")) { uriOfPicture = Uri.parse(savedInstanceState.getString("cameraImageUri")); } } public void takeImageFromCamera(){ String fileName = "new-photo-name.jpg"; ContentValues values = new ContentValues(); values.put(MediaStore.Images.Media.TITLE, fileName); values.put(MediaStore.Images.Media.DESCRIPTION, "Im…
has title: How to show a picture in a class, which I saved in another class
accepted answer: http://stackoverflow.com/a/26963753
type: Question
tagged with: android
score: 0
answer count: 1

http://stackoverflow.com/a/43083865
downvote count: 0
has body: A convenient option is to use javax.xml.bind.JAXB: StringWriter sw = new StringWriter(); JAXB.marshal(customer, sw); String xmlString = sw.toString(); The [reverse] process (unmarshal) would be: Customer customer = JAXB.unmarshal(new StringReader(xmlString), Customer.class); No need to deal with checked exceptions in this approach.
score: 58
type: Answer
upvote count: 58
has comment: http://stackoverflow.com/comment/126997341
answers question: http://stackoverflow.com/q/26959343
has comment: http://stackoverflow.com/comment/111427895

http://stackoverflow.com/q/26873908
tagged with: dead-code
has answer: http://stackoverflow.com/a/26874205
has comment: http://stackoverflow.com/comment/42305713
linked to: http://stackoverflow.com/q/16107683
has body: Why do I get no dead code warning for the initialisation of someVal here? public class DeadCode { private int someVal = 0; public DeadCode(int someVal) { this.someVal = someVal; } public int getSomeVal() { return someVal; } public void setSomeVal(int someVal) { this.someVal = someVal; } } The Java compiler is supposed to pick up on dead code and issue a warning; but this is dead twice over, and passes by without a hitch. It's dead twice over because Java automatically initialises instance fields to 0 or equivalent; the value of someVal can't be read without being written to. I realise that the compiler can elide the assignment if it wants to, but that's true (by definition) of all dead code. If there is a distinction to be made between dead code and code that has no effect, then I would expect The assignment to variable someVal has no effect. which is what I would get if I wrote someVal = someVal; in my code. But I don't get that either. In any case, Wikipedia sees dead code elimination as removal of code that has no effect on program results; and this is certainly a case of that.
has comment: http://stackoverflow.com/comment/42306204
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42305816
answer count: 2
tagged with: compiler-warnings
has answer: http://stackoverflow.com/a/26874055
tagged with: compiler-optimization
score: 0
has comment: http://stackoverflow.com/comment/42305890
has comment: http://stackoverflow.com/comment/42306021
tagged with: initialization
has comment: http://stackoverflow.com/comment/42306200
has title: Why isn't "int someVal=0" for an instance field considered dead code?
has comment: http://stackoverflow.com/comment/42305951
has comment: http://stackoverflow.com/comment/42306214
type: UnansweredQuestion

http://stackoverflow.com/comment/42355533
type: QuestionComment
has text: please mention the error line where crash occurs.
comment on: http://stackoverflow.com/q/26901712
score: 0
type: Comment

http://stackoverflow.com/a/26954513
score: 0
has body: ِEasiest way: System.out.println(Math.floor(percent*100)/100);
answers question: http://stackoverflow.com/q/26954443
type: Answer

http://stackoverflow.com/q/26920586
has comment: http://stackoverflow.com/comment/42389441
has comment: http://stackoverflow.com/comment/42389412
score: 0
has body: I have a double linked node with one element and I implement this class DNode to my DoubleLinkedList class. I have everything set up but I want to create a DoubleLinkedList where the E element is String[2]. How can I do this? I want to do something like this: package pt.ips.pa.model.modelo; import pt.ips.pa.model.tads.DoubleLinkedList; public class Ranking { private DoubleLinkedList&lt;String[]&gt; ranking; public Ranking() { this.ranking = new DoubleLinkedList&lt;&gt;(); } } DNode class is: package pt.ips.pa.model.tads; public class DNode&lt;E&gt; { private DNode&lt;E&gt; prev, next; private E elem; public DNode(E elem, DNode&lt;E&gt; prev, DNode&lt;E&gt; next) { this.elem = elem; this.prev = prev; this.next = next; } public DNode&lt;E&gt; getPrev() { return prev; } public void setPrev(DNode&lt;E&gt; prev) { this.prev = prev; } public DNode&lt;E&gt; getNext() { return next; } public void setNext(DNode&lt;E&gt; next) { this.next = next; } public E getElem() { return elem; } public void setElem(E elem) { this.elem = elem; } } here is the DoubleLinkedList class: package pt.ips.pa.model.tads; public class DoubleLinkedList&lt;E&gt; implements List&lt;E&gt; { private DNode&lt;E&gt; header; private DNode&lt;E&gt; trailer; private int size; public DoubleLinkedList() { this.header = new DNode&lt;&gt;(null, null, null); this.trailer = new DNode&lt;&gt;(null, header, null); this.header.setNext(trailer); this.size = 0; } @Override public int size() { return this.size; } @Override public boolean isEmpty() { return this.size == 0; } @Override public E get(int r) throws OutofBoundsException { if (r &lt; 0 || r &gt;= this.size) { throw new UnsupportedOperationException("Not supported yet."); } return nodeAtRank(r).getElem(); } @Override public E set(int r, E elem) throws OutofBoundsException { if (r &lt; 0 || r &gt;= this.size) { throw new UnsupportedOperationException("Not supported yet."); } DNode&lt;E&gt; nodeAux = nodeAtRank(r); E elemAux = nodeAux.getElem(); nodeAux.setElem(e…
has comment: http://stackoverflow.com/comment/42389514
tagged with: generics
has comment: http://stackoverflow.com/comment/42389612
has comment: http://stackoverflow.com/comment/42389474
has comment: http://stackoverflow.com/comment/42389402
has answer: http://stackoverflow.com/a/26928087
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42389535
has comment: http://stackoverflow.com/comment/42389376
tagged with: java
possible better answer: http://stackoverflow.com/a/26920800
has answer: http://stackoverflow.com/a/26920800
type: Question
has comment: http://stackoverflow.com/comment/42389390
answer count: 2
accepted answer: http://stackoverflow.com/a/26928087
has title: DoubleLinkedList with array String has generic element of Node

http://stackoverflow.com/comment/42449869
score: 0
has text: @YuvaRaj.I want a button below the listview.But since the listview has match_parent , it fills up the entire screen and the button is not visible.I want the button to be visible.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26955056

http://stackoverflow.com/a/26919195
downvote count: 0
answers question: http://stackoverflow.com/q/26917239
upvote count: 2
has body: A RevWalk can be used as follows to obtain the first commit that contains 'file.txt' RevWalk revWalk = new RevWalk( repository ); revWalk.markStart( revWalk.parseCommit( repository.resolve( Constants.HEAD ) ) ); revWalk.setTreeFilter( PathFilter.create( "path/to/file.txt" ) ); revWalk.sort( RevSort.COMMIT_TIME_DESC ); revWalk.sort( RevSort.REVERSE, true ); RevCommit commit = revWalk.next(); ... revWalk.dispose(); In the example the history starts at HEAD. Adjust the markStart() call the start from somewhere else or call markStart() multiple times to include several start points. The PathFilter excludes commits that do not contain the given repository-relative path name. And finally the two sort() calls take care that commits are ordered by their time stamp (newest first) in reverse order. Hence the oldest commit that contains the given file is returned by next(). Be aware that the commit passed to markStart() must be from the same revision walker, i.e. it must be obtained with a call to parseCommit() from the same revWalk instance. See also this thread for more details.
has comment: http://stackoverflow.com/comment/42417392
has comment: http://stackoverflow.com/comment/42424005
type: AcceptedAnswer
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26917239

http://stackoverflow.com/a/26906797
answers question: http://stackoverflow.com/q/26906530
type: Answer
has comment: http://stackoverflow.com/comment/42363970
has comment: http://stackoverflow.com/comment/42363920
has comment: http://stackoverflow.com/comment/42363926
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42363930
has comment: http://stackoverflow.com/comment/42363997
has body: what about switch/case statement. something like.... public String myFunction(int i, boolean condition) { String str = "default"; if (condition) { switch (i) { case 0: str = "The value is 0"; break; case 100: str = "The value is 100"; break; default: str = "default"; break; } } return str; }
downvote count: 0

http://stackoverflow.com/comment/42258058
has text: Because objects should encapsulate their data instead of spreading it to everything in the world. Doing so makes programs much harder to reason about. Your own terminology "in the class where they belong to" is a dead giveaway.
type: QuestionComment
comment on: http://stackoverflow.com/q/26847444
type: Comment
score: 0

http://stackoverflow.com/comment/45802803
has text: have you gain any new information in this topis, which you could add to your question ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26871585

http://stackoverflow.com/comment/42546037
comment on: http://stackoverflow.com/a/26987603
score: 0
type: Comment
has text: No it is not in grid form and it is printing out 30 characters in a 5x5 2d array
type: AnswerComment

http://stackoverflow.com/comment/42292208
type: Comment
has text: You shouldn't use an enhanced for loop when you have to modify the collection; always use the iterator. Look at the return type of the `remove` method: https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html#remove()
comment on: http://stackoverflow.com/q/26866464
score: 1
type: QuestionComment

http://stackoverflow.com/q/26961529
score: 0
has title: android activity work with intent
tagged with: android-intent
has comment: http://stackoverflow.com/comment/42462265
tagged with: java
has comment: http://stackoverflow.com/comment/42463307
has comment: http://stackoverflow.com/comment/42461517
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42462494
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42464189
has body: i made three activities for a game i want to go from 1st to 2nd to 3rd and then go 1st 2nd 3rd again but i got confused with the whole intent thing tried all kind of combinations but for some reason i stuck always with a problem currently it goes from 1st to 2nd to 3rd to 1st and when it supposed to lunch 2nd it exits from the whole app //1st activity Intent discoverintent = new Intent(getBaseContext(), discoverstring.class); //discoverintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(discoverintent); //2nd activity Intent MainIntent = new Intent(getBaseContext(), learningword.class); //MainIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); MainIntent.putExtra("text", text); MainIntent.putExtra("speakeronoff", Integer.toString(speakeronoff)); MainIntent.putExtra("previous", Integer.toString(previous)); startActivity(MainIntent); and the 3rd activity just uses finish package self.yanfaingold.talkgame; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.os.Bundle; import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; import android.view.View.OnTouchListener; import android.view.Window; import android.view.WindowManager; @SuppressLint("NewApi") public class savewords extends Activity implements OnTouchListener { OurView v; //Intent secondintent; Canvas c; int cheight,cwidth,loop=0; Bitmap notalk,notalkscaled,bittalk; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); v=new OurView(this); v.setOnTouchListener(this); //Remove title bar requestWindowFeature(Window.FEATURE_NO_TITLE); //Remove notification bar getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(v); notalk=BitmapFa…
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/42463487
tagged with: android
has comment: http://stackoverflow.com/comment/42463375
has comment: http://stackoverflow.com/comment/42470061
tagged with: android-activity
has comment: http://stackoverflow.com/comment/42462310
has comment: http://stackoverflow.com/comment/42461953
has comment: http://stackoverflow.com/comment/42462320

javascript
tags question: http://stackoverflow.com/q/26967648
tags question: http://stackoverflow.com/q/26865476
tags question: http://stackoverflow.com/q/26857041
tags question: http://stackoverflow.com/q/26956042
tags question: http://stackoverflow.com/q/26983484
tags question: http://stackoverflow.com/q/26942868
tags question: http://stackoverflow.com/q/26877982
tags question: http://stackoverflow.com/q/26930429
tags question: http://stackoverflow.com/q/26910913
tag name: javascript
tags question: http://stackoverflow.com/q/26864944
tags question: http://stackoverflow.com/q/26902297
tags question: http://stackoverflow.com/q/26917002
tags question: http://stackoverflow.com/q/26954682
tags question: http://stackoverflow.com/q/26873201
tags question: http://stackoverflow.com/q/26945246
tags question: http://stackoverflow.com/q/26863359
tags question: http://stackoverflow.com/q/26846078
tags question: http://stackoverflow.com/q/26857457
tags question: http://stackoverflow.com/q/26893744
tags question: http://stackoverflow.com/q/26847251
type: Tag
tags question: http://stackoverflow.com/q/26885817
tags question: http://stackoverflow.com/q/26931116
tags question: http://stackoverflow.com/q/26879529
tags question: http://stackoverflow.com/q/26960809
tags question: http://stackoverflow.com/q/26979083
tags question: http://stackoverflow.com/q/26834749
tags question: http://stackoverflow.com/q/26886235
tags question: http://stackoverflow.com/q/26932476
tags question: http://stackoverflow.com/q/26877246
tags question: http://stackoverflow.com/q/26859554
tags question: http://stackoverflow.com/q/26859096
tags question: http://stackoverflow.com/q/26963748
tags question: http://stackoverflow.com/q/26986156
tags question: http://stackoverflow.com/q/26879859
tags question: http://stackoverflow.com/q/26892050
tags question: http://stackoverflow.com/q/26902631
tags question: http://stackoverflow.com/q/26962157
tags question: http://stackoverflow.com/q/26969519
tags question: http://stackoverflow.com/q/26968002
tags question: http://stackoverflow.com/q/26889120
tags question: http://stackoverflow.com/q/26922327
tags question: http://stackoverflow.com/q/26863260
tags question: http://stackoverflow.com/q/26860744
tags question: http://stackoverflow.com/q/26968598
tags question: http://stackoverflow.com/q/26926502
tags question: http://stackoverflow.com/q/26968297
tags question: http://stackoverflow.com/q/26982531
tags question: http://stackoverflow.com/q/26944089
tags question: http://stackoverflow.com/q/26901712
tags question: http://stackoverflow.com/q/26978559
tags question: http://stackoverflow.com/q/26958449
tags question: http://stackoverflow.com/q/26940739
tags question: http://stackoverflow.com/q/26911263
tags question: http://stackoverflow.com/q/26881914

http://stackoverflow.com/comment/42435730
comment on: http://stackoverflow.com/a/26946781
has text: how do I remove it from path? I just add path in .profile. Also can't I have two java version installed?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26911883
favorite count: 0
has answer: http://stackoverflow.com/a/27006009
accepted answer: http://stackoverflow.com/a/27006009
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42536629
tagged with: caching
type: Question
has title: Hibernate session.createCriteria versus session.get performance
tagged with: criteria
has comment: http://stackoverflow.com/comment/42529073
answer count: 1
upvote count: 3
tagged with: jdbc
has body: Our development team has recently become worried that criteria and HQL are too slow. I ran some benchmarks to understand where the slowness is coming from. I ran the following queries 1001 times each. The first time I run the query the entity is not cached by the session, but every time after that the entity is cached. Entity e = (Entity) session.get(Entity.class, new EntityID("Composite key value 1", "Composite key value 2")); First call: 80.505875 Average of next 1000 calls: 0.045958 ms Entity e = (Entity) session.createCriteria(Entity.class) .add(Restrictions.eq("id", new EntityID("Composite key value 1", "Composite key value 2"))) .uniqueResult(); First call: 91.489098 ms Average of next 1000 calls: 0.847434 ms As a side note, the same query in HQL took longer the first time, but was statistically equivalent on all subsequent calls. I've read that the criteria to HQL and HQL to SQL translations take an insignificant amount of time compared to database queries. According to my tests, it appears that these translations take 18.4 times longer than the session get. 0.847434 / 0.045958 = 18.439314 Assuming some implementation details, I expect that the translation of the queries takes 0.801476 ms. This means the translation step takes 17.4 times as long as the session get. With JDBC we can run these queries in under 0.025368 ms. This is a conversion project that previously used ODBC, so we are looking for speeds that are comparable to what we had before. However, even with caching, it seems we are unable to approach comparable speeds. (0.847434 - 0.045958) / 0.045958 = 17.439314 I expected that by using caching to avoid talking to the database, we would reach speeds comparable to JDBC on subsequent calls. Is it normal for criteria translation to take the better part of a millisecond to run? How do people reach speeds comparable to JDBC with caching using criteria? Edit: My post contained a major mistake, where it appeared the same code produced two different statisti…

http://stackoverflow.com/comment/42311740
has text: If you're using the Oracle JSON kit, it sucks.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26876786

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/26892558
type: Tag

http://stackoverflow.com/q/26835190
has comment: http://stackoverflow.com/comment/42236444
has comment: http://stackoverflow.com/comment/42236449
type: Question
tagged with: vector
has comment: http://stackoverflow.com/comment/42236329
has comment: http://stackoverflow.com/comment/42236347
score: -1
has body: I'm trying to convert a function that i had that quickSorted an array into a vector quicksort function. I keep getting this cannot find symbol. This is my function that im trying to adapt into vector quickSort public static void quickSort(Vector&lt;Personne&gt; arr, int low, int high, Personne[] pers) { if (arr.isEmpty() == true || arr.size()== 0) return; if (low &gt;= high) return; int middle = low + (high - low) / 2; int pivot = arr.get(middle).getNumero(); int i = low, j = high; while (i &lt;= j) { while (arr.get(i).getNumero() &lt; pivot) { i++; } while (arr.get(j).getNumero() &gt; pivot) { j--; } if (i &lt;= j) { Vector&lt;Personne&gt; temp = new Vector&lt;Personne&gt;(); temp.add(arr.get(i)); arr.get(i).add(arr.get(j)); i++; j--; } } if (low &lt; j) quickSort(arr, low, j, pers); if (high &gt; i) quickSort(arr, i, high, pers); } This part of the function is giving me errors: if (i &lt;= j) { Vector&lt;Personne&gt; temp = new Vector&lt;Personne&gt;(); temp.add(arr.get(i)); arr.get(i).add(arr.get(j)); i++; j--; } I tried .get() ,.elementAt() ,creating a new temp vectors that will hold the information but I just can't seem to fix it. error C:\Users\Arnold\Desktop\numero3.java:241: error: cannot find symbol arr.get(i).add(arr.get(j)); ^ symbol: method add(Personne) location: class Personne 1 error
linked to: http://stackoverflow.com/q/3988788
answer count: 2
accepted answer: http://stackoverflow.com/a/26835302
has comment: http://stackoverflow.com/comment/42236433
has comment: http://stackoverflow.com/comment/42236334
possible better answer: http://stackoverflow.com/a/26835243
has comment: http://stackoverflow.com/comment/42236408
favorite count: 0
has answer: http://stackoverflow.com/a/26835243
linked to: http://stackoverflow.com/q/12248906
has comment: http://stackoverflow.com/comment/42236317
has comment: http://stackoverflow.com/comment/42236536
tagged with: quicksort
type: AnsweredQuestion
has title: Java quickSort Vectors
has answer: http://stackoverflow.com/a/26835302
has comment: http://stackoverflow.com/comment/42236363
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42236285
upvote count: 1

http://stackoverflow.com/q/26855660
downvote count: 1
type: Question
has title: Null exception on inserting object to SQLite DB
has answer: http://stackoverflow.com/a/26857170
score: 0
answer count: 3
upvote count: 1
tagged with: sqlite
possible better answer: http://stackoverflow.com/a/26857170
has body: Im creating a very basic fragment containing 2 EditText fields and a submit button. On submit the values should be inserted as a row to my SQLite DB. Im getting a NullPointerException i just dont get.. Inside my onCreateView method of the fragment im getting my field values and setting up a click listener like this: View rootView = inflater.inflate(R.layout.fragment_add_customer, container, false); customerName = (EditText) rootView.findViewById(R.id.editCompanyName); customerAddress = (EditText) rootView.findViewById(R.id.editCompanyAddress); addButton = (Button) rootView.findViewById(R.id.submitCustomerBtn); addButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { String sCustomerName = customerName.getText().toString(); String sCustomerAddress = customerAddress.getText().toString(); if(sCustomerName.trim().length() &gt; 0 &amp;&amp; sCustomerAddress.trim().length() &gt; 0) { Customer customer = new Customer(); customer.setName(sCustomerName); customer.setAddress(sCustomerAddress); customer.setLocation("Not set"); customer.setImage("None"); customer = dataSource.createCustomer(customer); if(customer.getId() != 0) { Toast.makeText(getActivity(), customer.getName() + " with id: " + customer.getId() + " was created!", Toast.LENGTH_LONG).show(); Log.i(LOGTAG, "Customer created with id " + customer.getId()); } }else{ Toast.makeText(getActivity(), "Please fill all fields.", Toast.LENGTH_LONG).show(); } } }); return rootView; Inside my dataSource class where i controle my DB query and statement im calling the createCustomer method, which looks like this: public Customer createCustomer(Customer customer) { ContentValues values = new ContentValues(); values.put(BusinessDBOpenHelper.CUSTOMER_NAME, customer.getName()); values.put(BusinessDBOpenHelper.CUSTOMER_ADDRESS, customer.getAddress()); values.put(BusinessDBOpenHelper.CUSTOMER_LOCATION, customer.getLocation()); values.put(BusinessDBOpenHelper.CUSTOMER_IMAGE, customer.getImage(…
favorite count: 0
has comment: http://stackoverflow.com/comment/42273734
tagged with: android
has comment: http://stackoverflow.com/comment/42274042
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/41876106
has answer: http://stackoverflow.com/a/26855965
accepted answer: http://stackoverflow.com/a/26855965
has comment: http://stackoverflow.com/comment/42273761

http://stackoverflow.com/comment/42469541
has text: I already did that (as noted in the question). They are. I'm assuming they're being sorted as a generic Object as opposed to a Float.
comment on: http://stackoverflow.com/q/26966063
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42314803
type: QuestionComment
comment on: http://stackoverflow.com/q/26878965
has text: `JFrame` with `BorderLayout`, `JPanel` in frame with a `GridBagLayout`. See [Laying Out Components Within a Container](http://docs.oracle.com/javase/tutorial/uiswing/layout/index.html) and [How to Use GridBagLayout](http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html) for more details
score: 0
type: Comment

http://stackoverflow.com/q/26991163
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26991378
upvote count: 1
linked to: http://stackoverflow.com/q/10284564
type: Question
tagged with: date-conversion
tagged with: gwt
tagged with: date
has answer: http://stackoverflow.com/a/26991300
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42513929
has body: I'm fetching a date which is of String type but I need the Date type of it. I'm working in a gwt project so I cannot use SimpleDateFormat or Calendar (which doesn't work in the runtime and throws source code not found exception) new Date(stringDate) is deprecated so any other way I could do it?
favorite count: 0
has answer: http://stackoverflow.com/a/26991268
has answer: http://stackoverflow.com/a/26991297
answer count: 4
has title: Convert a date of String type to java.util.Date type without using SimpleDateFormat or Calendar

http://stackoverflow.com/comment/42407439
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26928951
type: Comment
has text: You're welcome, note it should be dividable by 8. AES uses a safer block size than 3DES, 16 bytes, so I got stuck on that one :)

http://stackoverflow.com/a/26872165
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/26871881
answers question: http://stackoverflow.com/q/26871881
has body: By default, when an exception is thrown inside an EJB method the EJB container will wrap it with an EJBException. You can, however, annotate your EJB method with ApplicationException, which will tell the EJB container to throw the application exception directly.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42303132
type: Answer
has comment: http://stackoverflow.com/comment/42302840

http://stackoverflow.com/comment/42404169
score: 0
type: Comment
type: QuestionComment
has text: @mKorbel: Any code help please?
comment on: http://stackoverflow.com/q/26929247

http://stackoverflow.com/comment/42275871
has text: Paul Richter now I understand better. Post as answer let me accept
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26856897

http://stackoverflow.com/a/26886106
has comment: http://stackoverflow.com/comment/42328937
type: Answer
has comment: http://stackoverflow.com/comment/42327830
has comment: http://stackoverflow.com/comment/42328040
has comment: http://stackoverflow.com/comment/42328973
has body: This may help you Replace &lt;@= table.user @&gt; with &lt;%= table.user %&gt;
score: 0
answers question: http://stackoverflow.com/q/26885964

http://stackoverflow.com/q/26848555
has answer: http://stackoverflow.com/a/26848670
tagged with: eclipse
tagged with: classpath
type: Question
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/26848670
has title: ClassNotFoundException when trying to connect with mysql dbms?
tagged with: jdbc
has body: I have seen many solutions in this site relating the same problem that I am facing now, I rectified my project structure also but still no success, First attempt I placed mysqlconnector.jar in WEB-INF/lib -> GOT ERROR. Second, I removed it from lib folder, and added as external jar in build path -> GOT ERROR. Also I tried both above ways after placing mysqlconnector jar file in jre8/lib/ext -> NO SUCCESS! Please ignore any small or irrelevant modifications, I just needed to check the connectivity thats all. I have JRE8 and Tomcat8 server running, which I believe is not an issue in this. Here is a simple code of connectivity I just want to check if it is establishing a connection or not, that is why I haven't coded any further. public class MySQLConnection { public static final String DRIVER_CLASS = "com.mysql.jdbc.Driver"; public static final String URL = "jdbc:mysql://localhost:3306/payinguest"; public static final String USER = "root"; public static final String PASSWORD = "root"; public MySQLConnection() { try { Class.forName(DRIVER_CLASS); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } My index.jsp is <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" import="com.pg.dao.MySQLConnection"%> Insert title here <% MySQLConnection db = new MySQLConnection();%> Error: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at com.pg.dao.JDBCMySQLConnection.<init>(JDBCMySQLConnection.java:15) at org.apache.jsp.index_jsp._jspService(index_jsp.java:71)
favorite count: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42505010
has text: Create a StringBuffer, loop `arr` and append each word to the StringBuffer
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26985840
score: 0

http://stackoverflow.com/comment/42486782
comment on: http://stackoverflow.com/q/26973196
type: Comment
type: QuestionComment
score: 0
has text: Are you saying you want to process the messages in a specific order, or that you just don't want to process other messages until you are ready?

http://stackoverflow.com/q/26903483
favorite count: 0
upvote count: 8
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/70555486
has comment: http://stackoverflow.com/comment/92747346
tagged with: java
has title: Filling Color in polygon while points intersecting in Android
score: 8
tagged with: polygon
tagged with: google-maps
has comment: http://stackoverflow.com/comment/74075648
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/20901141
tagged with: google-maps-api-2
downvote count: 0
has body: I am trying to draw a polygon using hand on google map and then filling the color to the polygon. Normally the color is filling fine and working as expected but if the polygon has intercepting point then the fill color is not working. I am using below code to draw polygon and fill the color to the polygon PolygonOptions drawShapeOptions = new PolygonOptions(); drawShapeOptions.addAll(mLatLngList); drawShapeOptions.strokeColor(Color.BLACK); drawShapeOptions.strokeWidth(5); drawShapeOptions.fillColor(Color.GRAY); mDrawShape = mGoogleMap.addPolygon(drawShapeOptions); The Result is as below How can i fill color in this polygon with intersecting points?

http://stackoverflow.com/comment/61104514
comment on: http://stackoverflow.com/q/26862771
type: Comment
type: QuestionComment
has text: This could help too: http://ph0b.com/android-abis-and-so-files/
score: 1

http://stackoverflow.com/comment/42507915
comment on: http://stackoverflow.com/q/26973480
score: 0
has text: Well, the ear is not the only thing to check here; depending on your servlet container, there are other elements prepended to an application's classpath before the ones of your app itself.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26866446
has answer: http://stackoverflow.com/a/26867129
accepted answer: http://stackoverflow.com/a/26867129
downvote count: 0
possible better answer: http://stackoverflow.com/a/62194450
type: AnsweredQuestion
score: 3
tagged with: java
has body: I want to pass an optional parameter in the JAX-RS path.I am using the below path but its not working. @Path("/lock/{userName}/{userid:(([a-zA-Z]{2})?)}") The resource should get invoked for both with userid and without user id parameter in the path. Can anyone suggest me what needs to be done? Thanks
type: Question
answer count: 2
tagged with: jersey
has answer: http://stackoverflow.com/a/62194450
upvote count: 3
tagged with: rest
tagged with: jax-rs
favorite count: 0
has title: Regarding optional path in JAX-RS

http://stackoverflow.com/q/26878764
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26879827
tagged with: character-encoding
type: Question
has answer: http://stackoverflow.com/a/26879827
tagged with: tomcat
score: 0
has title: Reading Korean characters from Tomcat Servlet
answer count: 1
has body: My server cannot receives Korean characters through a POST request and cannot writes them to console. Here is my code: protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { request.setCharacterEncoding("UTF-8"); PrintWriter out = response.getWriter(); StringBuffer buffer = new StringBuffer(); String line = null; BufferedReader reader = request.getReader(); while ((line = reader.readLine()) != null) buffer.append(line); String requestMessage = buffer.toString(); //working System.out.println("teniszütő"); //not working (???????) System.out.println("\uc548\ub155\ud558\uc138\uc694\uc138\uacc4"); //not working (??) System.out.println("여니"); //accents are working, Korean characters aren't System.out.println(requestMessage); //writing 3F (the code of the ? instead of the code of the character) System.out.println(bytesToHexString(requestMessage.getBytes())); out.println("Answer"); } I use Eclipse and if I check the Properties of the project I can see that the "Text file encoding" is "Inherited from container (UTF-8)". If I make a normal HelloWorld application (with the same settings), it prints the Korean characters. Thank you for help!

http://stackoverflow.com/comment/42247520
score: 0
comment on: http://stackoverflow.com/q/26841771
type: QuestionComment
has text: java.text.DecimalFormat (beware of the Locale though).
type: Comment

http://stackoverflow.com/comment/42324024
comment on: http://stackoverflow.com/q/26884088
score: 0
type: QuestionComment
has text: You might want to check your output loop, too: for frequent values, you are not only accessing the count array, but converting the count to digits over and again.
type: Comment

http://stackoverflow.com/comment/42369868
type: QuestionComment
type: Comment
has text: `col1.getName()` is possible.
comment on: http://stackoverflow.com/q/26910117
score: 4

http://stackoverflow.com/q/26954494
has comment: http://stackoverflow.com/comment/42449807
type: Question
has body: My assignment consists of this: I have to design a calculator that allows user to enter the number of triangles. Goals are the following: -User enters x number of triangles -Computer automatically generates 3 numbers from my list of numbers between 3 and 13. -Computer displays those numbers on screen. -It decides if the numbers represent the sides of a valid triangle. (For example, 5, 5, and 13 do NOT create a triangle). -If the numbers do not represent a valid triangle, displays an error message -If the numbers are valid, the program determines, and displays a) Side classification of the triangle – equilateral, isosceles, or scalene, and b) The angle classification of the triangle – right, acute, or obtuse [Here's what I did, but something seems to have gone wrong,as computer only displays "Acute", or "Not valid".] public class triangle_creator extends javax.swing.JFrame { private static int side1 = (int) (11 * Math.random() + 3); private static int side2 = (int) (11 * Math.random() + 3); private static int side3 = (int) (11 * Math.random() + 3); private static int userNum; private static String userInput; private void calculateButtonActionPerformed(java.awt.event.ActionEvent evt) { //get number of triangles by user in amountInput field userInput=amountInput.getText(); side1=Integer.parseInt(userInput); side2=Integer.parseInt(userInput); side3=Integer.parseInt(userInput); //add all sides together int sumTriangle= side1+ side2+ side3; // generate error message if(side1+ side2&lt; side3){ outputArea.setText("Not valid"); } else{ if (side1==side2 &amp;&amp; side1==side3 &amp;&amp; side2==side3 ) outputArea.setText("Equilateral"); if (sumTriangle==sumTriangle) outputArea.setText("Isosceles"); if (side1!=side2&amp;&amp; side1!=side3&amp;&amp; side2!=side3) outputArea.setText("Scalene"); if (side1*side1+ side2*side2==side3*side3){ outputArea.setText("Triangle is right"); } else if (side3*side3&lt; side1*side1+ side2*side2) outputArea.setText("Triangle is acute"); else if…
tagged with: java
tagged with: random
upvote count: 1
answer count: 1
has title: Triangle Side & Angle Classification Generator
favorite count: 0
accepted answer: http://stackoverflow.com/a/26955076
score: 0
has comment: http://stackoverflow.com/comment/42449297
has comment: http://stackoverflow.com/comment/42449184
downvote count: 1
tagged with: generator
tagged with: integer
has answer: http://stackoverflow.com/a/26955076
type: AnsweredQuestion
tagged with: geometry

http://stackoverflow.com/q/26882723
has comment: http://stackoverflow.com/comment/42321735
has comment: http://stackoverflow.com/comment/42321277
score: 0
has answer: http://stackoverflow.com/a/26883193
answer count: 1
tagged with: service
has comment: http://stackoverflow.com/comment/42321862
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
has body: I am creating android application to lock the apps installed in the mobile. In this application, I have created two activities and two classes LockAppMainActivity (Main Activity used for setting password and starting service) CreatedWith (Class file locks the screen after certain time) LockScreen (Lock screen is shown to the user when user starts app in which lock is applied) ServiceRestarts (Class File to start the service after reboot) The problem with this application is that when user tries to unlock the app, after unlocking the app the lockscreen goes to background and does not get killed. I want lockscreen activity to get killed when user unlocks the app. LockAppMainActivity (It starts the service) startService(new Intent(this, CreatedWith.class)); CreatedWith @Override public int onStartCommand(Intent intent, int startId,int ff) { int delay = 10; int period = 100; Timer timer = new Timer(); timer.scheduleAtFixedRate(new TimerTask() { public void run() { odopo(); } }, delay, period); return START_STICKY; } void odopo(){ ActivityManager mActivityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); final List&lt;ActivityManager.RunningTaskInfo&gt; RunningTask = mActivityManager.getRunningTasks(1); ActivityManager.RunningTaskInfo ar = RunningTask.get(0); String activityOnTop = ar.topActivity.getClassName(); if(activityOnTop.contains("whatsapp")) { if(LockAppMainActivity.myId!=1){ Intent lockIntent = new Intent(this, LockScreen.class); lockIntent.putExtra("sec", activityOnTop); lockIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); this.startActivity(lockIntent); }}} LockScreen If password entered by the user is correct then the following code runs. Intent LaunchApp = getPackageManager().getLaunchIntentForPackage(ar.topActivity.getPackageName()); LaunchApp.setFlags(LaunchApp.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY); startActivity(LaunchApp); The problem with this code is that when the application is unlocked the LockScreen goes to background b…
has comment: http://stackoverflow.com/comment/42321256
has comment: http://stackoverflow.com/comment/42321062
tagged with: java
type: Question
has title: Killing activity which starts other activity

http://stackoverflow.com/a/26890158
type: Answer
score: 3
answers question: http://stackoverflow.com/q/26889530
upvote count: 3
has body: To use a Target definition in Eclipse on a workstation with no or limited Internet access, there are (at least) a couple of options: Set up local mirrors of each p2 repository used in your Target. Eclipse p2 has command-line tools to do this. Once you have local mirrors you can create an alternate Target definition that replaces the source repository URLs with the local mirror URLs. The process is described in more detail here. Create an Update Site project that includes all the bundles used in your Target definition. You first create a Feature project that includes everything used in your Target, as well as your workspace projects that make up your plugin(s) or application. You then create an Update Site project that publishes that Feature, and export that Update Site. Exporting will produce a local update site that you can then use in a modified version of your Target definition. Detailed documentation is here.
has comment: http://stackoverflow.com/comment/42336488
has comment: http://stackoverflow.com/comment/42344257
accepted answer of: http://stackoverflow.com/q/26889530
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42450514
type: QuestionComment
score: 1
has text: According to their web site this is available for paid accounts only.
comment on: http://stackoverflow.com/q/26955005
type: Comment

http://stackoverflow.com/q/26892873
type: Question
has comment: http://stackoverflow.com/comment/42339627
has comment: http://stackoverflow.com/comment/42341877
score: 0
has answer: http://stackoverflow.com/a/26895741
has comment: http://stackoverflow.com/comment/42341940
tagged with: ssh
answer count: 1
has body: Ok - so I have been working on this for some time (sometimes not working on it), and I am ALMOST there but not yet. I am trying to tunnel into a mysql db and was able to successfully connect ssh using Jsch. But when I try to connect to the database, it gives me an "Access denied for user 'usernamne'@'localhost' (using password: YES) Here is the following code: (of course I masked out sensitive info) public void connect(){ String user = "user"; String password = "password"; String host = "host.com"; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = null; Properties info = new Properties(); JSch jsch = new JSch(); Session session = jsch.getSession(user, host, 22); jsch.addIdentity("/Users/user/.ssh/id_rsa", password); session.setConfig("StrictHostKeyChecking", "no"); System.out.println("Establishing Connection..."); if(session.isConnected()){ session.disconnect(); } session.connect(); conn = DriverManager.getConnection("jdbc:mysql://localhost:4417/dbname","dbuser", "dbpassword"); System.out.print("Connection successful!" + "\n\n"); System.out.print("Connection:" + conn + "\n\n"); Statement stmt = conn.createStatement(); ResultSet resultSet = stmt.executeQuery("SELECT * FROM TABLENAME limit 1"); System.out.print(resultSet); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } catch (JSchException j){ j.printStackTrace(); } } I've read other posts on here but I have not found the exact solution to my problem. I am able to ssh in correct. And what's even more interesting is that if I do the same exact procedure command_line, it works fine. So I don't know why it wouldn't work here.
type: UnansweredQuestion
tagged with: tunnel
tagged with: java
has comment: http://stackoverflow.com/comment/42339751
tagged with: mysql
has title: I am not able to connect to mysql via ssh and I don't know why using Java

http://stackoverflow.com/comment/42350028
type: Comment
has text: @stringy05, thank you for the help! The target server may write substantial amounts of data on the PrintWriter of the HttpServletResponse object and I don't want to send the data from target -> proxy -> source. So what I want to save is megabytes sent on the network.
comment on: http://stackoverflow.com/q/26897665
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42403541
type: AnswerComment
has text: The question is tagged with `C#`, so it would be 0-based in this case.
type: Comment
comment on: http://stackoverflow.com/a/26928797
score: 0

http://stackoverflow.com/comment/42311418
type: QuestionComment
comment on: http://stackoverflow.com/q/26876594
has text: basically, what i want is to read the file text content for now and insert it into the database.
score: 0
type: Comment

http://stackoverflow.com/comment/42249616
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26843058
type: QuestionComment
has text: Also, this is sort of entering into a discussion/asking for examples rather than asking a concrete solvable question

http://stackoverflow.com/comment/71730781
has text: This was helpful. For other IDEs that may not have this feature you can go to Scene Builder and click View > Show Sample Controller Skeleton as well. Then copy that information over to your controller manually.
type: AnswerComment
score: 6
type: Comment
comment on: http://stackoverflow.com/a/38958936

http://stackoverflow.com/q/26846078
score: 1
tagged with: java
tagged with: javafx
type: Question
has comment: http://stackoverflow.com/comment/42279889
has answer: http://stackoverflow.com/a/32871527
downvote count: 0
tagged with: javascript
tagged with: javafx-webengine
answer count: 1
has body: I'm going to use WebView/WebEngine to display "logs" (i.e. chat message, game status message, ...) for simple multiplayer game. Here is what I wrote on javascript part. function addLogMessage(o) { var kind = o.getMessageKindCase(); if (kind.equals(kind.CHAT_MESSAGE)) { $("body").append(createChatMessage(o.getChatMessage())); } else (/* other cases following... */) } function addLogMessages(l) { var n = l.size(); for (var i = 0; i &lt; n; i++) { addLogMessage(l.get(i)); } } Here is what I wrote on java part. private GameStatus gameStatus; private WebEngine logWebEngine; private final ObjectProperty&lt;JSObject&gt; window = new SimpleObjectProperty&lt;&gt;(this, "window"); public void initialize(URL url, ResourceBundle rb) { gameStatus = /* ... */; window.addListener((o, oldValue, newValue) -&gt; { if (newValue == null) { return; } // getLogMessages() will return java.util.List&lt;LogMessage&gt; newValue.call("addLogMessages", gameStatus.getLogMessages()); }); logWebEngine = logView.getEngine(); logWebEngine.getLoadWorker().stateProperty().addListener((o, oldValue, newValue) -&gt; { if (newValue == Worker.State.SUCCEEDED) { window.set((JSObject) logWebEngine.executeScript("window")); } }); logWebEngine.load(getClass().getResource("log.html").toString()); } When I called addLogMessage() from java side, it works as intended. However, calling addLogMessages() caused the following exception. Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessException: Class sun.reflect.misc.Trampoline can not access a member of class java.util.Collections$UnmodifiableCollection with modifiers "public" It seems that l.size() in addLogMessages caused this exception. What's the reason of this exception? And, is there any solution for this issue? Thanks in advance.
favorite count: 0
type: UnansweredQuestion
has title: IllegalAccessException while using java object in javascript
upvote count: 1

http://stackoverflow.com/q/26945034
tagged with: java
possible better answer: http://stackoverflow.com/a/34429093
type: Question
has comment: http://stackoverflow.com/comment/42432839
has answer: http://stackoverflow.com/a/26945404
accepted answer: http://stackoverflow.com/a/26945404
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/12070215
linked to: http://stackoverflow.com/q/16896948
has title: How can activity call a method inside fragment created dynamically
tagged with: android
has answer: http://stackoverflow.com/a/34429093
type: AnsweredQuestion
has body: I have a main activity which creates fragments using the following code private void launchFragment(int pos) { Fragment f = null; String title = null; if (pos == 1) { title = "Friends"; f = new FriendList(); } else if (pos == 2) { title = "Notes"; f = new NoteList(); } else if (pos == 3) { title = "Projects"; f = new ProjectList(); } else if (pos == 5) { title = "About"; f = new AboutUs(); } else if (pos == 6) { startActivity(new Intent(this, Login.class)); finish(); } if (f != null) { while (getSupportFragmentManager().getBackStackEntryCount() &gt; 0) { getSupportFragmentManager().popBackStackImmediate(); } getSupportFragmentManager().beginTransaction() .replace(R.id.content_frame, f).addToBackStack(title) .commit(); } } Here is the code of a fragment. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.group_chat, null); loadConversationList(); contactName = this.getArguments().getString("contactusername"); contactId = this.getArguments().getString("contactid"); ListView list = (ListView) v.findViewById(R.id.list); adp = new ChatAdapter(); list.setAdapter(adp); list.setTranscriptMode(AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL); list.setStackFromBottom(true); txt = (EditText) v.findViewById(R.id.txt); txt.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE); setTouchNClick(v.findViewById(R.id.btnCamera)); setTouchNClick(v.findViewById(R.id.btnSend)); return v; } I want to call a method in above fragment class. I was not able to do this as I have not given id of the fragment in the XML file. I am not loading the static fragment using XML. Therefore, I don't have Id. I have already seen this and this questions on the StackOverFlow, but they are not solving my problem. Kindly help if anyone knows how to tackle this scenario.
tagged with: android-fragments

http://stackoverflow.com/q/26954353
type: Question
has comment: http://stackoverflow.com/comment/42448723
has comment: http://stackoverflow.com/comment/42448678
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42448739
favorite count: 0
has answer: http://stackoverflow.com/a/26954552
has body: I am trying to use jxpath to navigate through generated java objects. I have the navigate structure in the form of an xpath a:FirstElement/aa:SecondElement/aaa:ThirdElement I need to get the string in the following format firstElement/secondElement/thirdElement How can I do this using regex in Java?
possible better answer: http://stackoverflow.com/a/26954446
tagged with: regex
has answer: http://stackoverflow.com/a/26954446
type: AnsweredQuestion
has title: Regex to remove namespace and convert first letter to lowercase
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26954552

http://stackoverflow.com/q/26899387
has comment: http://stackoverflow.com/comment/42351710
favorite count: 0
tagged with: step-into
has comment: http://stackoverflow.com/comment/42352316
has title: Eclipse Debugger Goes to Library Classes
score: 2
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42352329
has answer: http://stackoverflow.com/a/35628965
type: Question
tagged with: debugging
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42351581
upvote count: 2
has body: Just debugging a project using Eclipse Luna 4.4.0, when using the debugger, upon reaching my breakpoint, and hence using the "step into" button, it takes me to generic Library classes such as Threads.class etc.. I'm pretty sure it's a problem with my Eclipse configuration, as it was working perfectly fine on a different machine, but since switching it's become a real pain having to step over a fair few Library classes before I can get back to my own code. Any help with what to change would be extremely helpful, thanks.
answer count: 1

http://stackoverflow.com/comment/42506375
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26986587
has text: Okay I understand that I might be pushing the contract of HashSet a bit, but for this particular project equality is solely determined by the hashcode and I know for sure that there will be only one object per hashcode/hashbucket. The reason I was pretty reluctant to use a HashMap is because I would need to convert the primitive ints I'm mapping with to Integer objects as a HashMap only takes in objects as keys, and I'm also worried that might affect performance. Is there anything else I could do to implement similar code instead?

http://stackoverflow.com/q/26913957
linked to: http://stackoverflow.com/q/30681805
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/29095967
accepted answer: http://stackoverflow.com/a/31427982
linked to: http://stackoverflow.com/q/31021784
linked to: http://stackoverflow.com/q/20470010
score: 0
has comment: http://stackoverflow.com/comment/42377550
answer count: 1
has title: How to partition a collection into arbitrary sized partition
has body: I'm trying to use Java 8 Lambda expressions and streams to parse some logs. I have one giant log file that has run after run. I want to split it into separate collections, one for each run. I do not know how many runs the log has in advanced. And to exercise my very weak lambda expressions muscles I'd like to do it in one pass through the list. Here is my current implementation: List&lt;String&gt; lines = readLines(fileDirectory); Pattern runStartPattern = Pattern.compile("INFO: \\d\\d:\\d\\d:\\d\\d: Starting"); LinkedList&lt;List&lt;String&gt;&gt; testRuns = new LinkedList&lt;&gt;(); List&lt;String&gt; currentTestRun = new LinkedList&lt;&gt;(); // In case log starts in middle of run testRuns.add(currentTestRun); for(String line:lines){ if(runStartPattern.matcher(line).find()){ currentTestRun = new ArrayList&lt;&gt;(); testRuns.add(currentTestRun); } currentTestRun.add(line); } if(testRuns.getFirst().size()==0){ // In case log starts at a run testRuns.removeFirst(); } Basically something like TomekRekawek's solution here but with an unknown partition size to begin with.
has comment: http://stackoverflow.com/comment/42377591
has answer: http://stackoverflow.com/a/31427982
has comment: http://stackoverflow.com/comment/46836489
tagged with: lambda
tagged with: java-8

http://stackoverflow.com/q/26980798
tagged with: string
has title: Boolean Logic String Iteration
linked to: http://stackoverflow.com/q/47882
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26980840
type: Question
has body: I'm using a for loop to parse a string, like so: for (int i = 1; i &lt; s.length(); ++i) The string is all lowercase, and if either the current character or previous character is not a letter, I want to avoid it, like so: if (s.charAt(i) - 97 &lt; 0 || s.charAt(i) - 97 &gt; 25 || s.charAt(i-1) &lt; 0 || s.charAt(i-1) &gt; 25) { continue } The first string I input is "marty," yet the if statement is registering true. I've confirmed that every single one of the four boolean values evaluates to false, yet the if statement itself is apparently true for every single letter in every single string. I even made four separate bool variables, one for each parameter, confirmed they're all false, then OR'd them all together. Also false. Yet the if statement fires every single time. I really don't know what I'm missing here. Can anyone help me?
tagged with: if-statement
tagged with: java
tagged with: boolean
score: 0
has comment: http://stackoverflow.com/comment/42495864
answer count: 1

http://stackoverflow.com/comment/42265480
comment on: http://stackoverflow.com/q/26850419
score: 0
has text: Please enlight me. What are `matrix params`?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26981713
has body: I have one java code to format the another java code programaticlly. The code is working fine for simple java code.But when i am introducing commnent in my input java code (input taken as String code) then in the following line textEdit is returned as null which is causing nullpointerexception in next steps. TextEdit textEdit = codeFormatter.format(CodeFormatter.K_UNKNOWN , code, 0, code.length(), 0, null); import org.eclipse.jdt.core.ToolFactory; import org.eclipse.jdt.core.formatter.CodeFormatter; import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.text.edits.MalformedTreeException; import org.eclipse.text.edits.TextEdit; public class FormatCode { public static void main(String[] args) { String code = "public class TestFormatter{public static void main(String[] args){for(i=0;i&lt;10;i++){i=i+2;\\abc"+"}System.out.println(\"Hello World\");}}"; CodeFormatter codeFormatter = ToolFactory.createCodeFormatter(null); TextEdit textEdit = codeFormatter.format(CodeFormatter.K_UNKNOWN , code, 0, code.length(), 0, null); IDocument doc = new Document(code); try { textEdit.apply(doc); System.out.println(doc.get()); } catch (MalformedTreeException e) { e.printStackTrace(); } catch (BadLocationException e) { e.printStackTrace(); } } } Any hint to solve this issue.
has comment: http://stackoverflow.com/comment/42497491
has comment: http://stackoverflow.com/comment/42497554
has answer: http://stackoverflow.com/a/26981794
accepted answer: http://stackoverflow.com/a/26981794
has answer: http://stackoverflow.com/a/26981891
type: AnsweredQuestion
tagged with: java
tagged with: eclipse-jdt
has comment: http://stackoverflow.com/comment/42497592
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42497420
has title: java codeformatter throwing NullPointerEception
linked to: http://stackoverflow.com/q/16015240
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26982132
possible better answer: http://stackoverflow.com/a/26981891
has comment: http://stackoverflow.com/comment/42497523

http://stackoverflow.com/a/26874680
type: Answer
has body: That is an implementation concern that belongs to the Budget itself and its knowledge about how to name a certain status: a) the domain service: numberOfBudgets = budgetRepository.numberOfBudgetsIn(anYear); budget = Budget.newFrom(anYear, numberOfBudgets + 1); budgetRepository.add(budget); b) the public factory method within the Budget class: Budget.newFrom(anYear, budgetNumber) { status = 'INITIAL'; if (numberOfBudgets &gt; 0) { status = 'CORRECTIVE' + budgetNumber } return new Budget(anYear, status); } This way you only have one domain service mentioned in point a. Cheers, Sebastian.
answers question: http://stackoverflow.com/q/26862117
score: 0

http://stackoverflow.com/q/26985762
has title: How do I find the even elements in a list of items?
has comment: http://stackoverflow.com/comment/42504923
type: Question
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/42505025
tagged with: java
has body: public class ListItem { final int number; ListItem next; public static ListItem evenElements(ListItem ls) { ListItem l = ls.duplicate(); if(ls == null){ return null; } else{ for(int i = 0; i &lt; ls.length(); i++){ if(ls.number % 2 == 0){ l = ls; ls = ls.next; } else{ ls = ls.next; } } return l; } } When I run this code of a list of items: [3,2,6,9], it returns [2,6,9] when it should only return [2,6]. The duplicate method duplicates the ListItem, and the length method determines the length of the list. How can I fix this issue?
tagged with: listitem
answer count: 1
has answer: http://stackoverflow.com/a/26985894
accepted answer: http://stackoverflow.com/a/26985894
has comment: http://stackoverflow.com/comment/42504960
score: 0
has comment: http://stackoverflow.com/comment/42505057

http://stackoverflow.com/q/26916200
tagged with: class
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42381195
possible better answer: http://stackoverflow.com/a/26916269
has answer: http://stackoverflow.com/a/26916269
score: -1
has title: Java Print Products in Basket
has body: Trying to wrap my head around something I've been trying to do with little to no success today I figured I'd go ask the smart guys at StackOverflow. What I am trying to do is create two classes: Basket and Product. The Product class looks like this: public class Product { private final String identifier; private final float price; public Product(final String productIdentifier, float productPrice) { identifier = productIdentifier; price = productPrice; } public String getIdentifier() { return identifier; } public float getPrice() { return price; } public void print() { System.out.println(identifier + " " + price + " EUR"); } } The Basket class I am now trying to do is supposed to be able to do a few things. First and most importantly it is supposed to add products to the basket and print them out on the console. The latter is what I am having huge difficulties with. Here is what I have so far: import java.util.ArrayList; public class Basket { private ArrayList&lt;Product&gt; products; public Basket() { produkte = new ArrayList&lt;Product&gt;(); } public void addProduct(final String productIdentifier, final float productPrice) { produkte.add( new Product (productIdentifier, productPrice)); } public void printBasket() { //Print products in basket using the print() function of the Product class. } } I have tried a lot of things to get it to print out the products I added. However they were so fruitless that I find myself here asking for help now. What I have tried so far looked something like this: for(int i = 0; i &lt; products.size(); i++) { Product.print(); } What this throws back at me is that I cant use print() in a static context. So I have tried making print() a static function, that won't work though, because I am using the non-static variables identifier and price in it. I feel like what I am missing is just a little thing, however being new to Java I am probably just missing it big time. What I hope for is a nudge into the right direction and to be pointed out…
downvote count: 1
has answer: http://stackoverflow.com/a/26916250
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26916341
accepted answer: http://stackoverflow.com/a/26916250
favorite count: 0

http://stackoverflow.com/a/26896055
score: 0
has comment: http://stackoverflow.com/comment/42357082
type: Answer
has body: You could do it like this: (?!.*_)(\w{4}-){9}\w{4} This makes use of the fact that \w means "any letter, number or underscore" and the negative look ahead prevents the underscore.
answers question: http://stackoverflow.com/q/26895588

http://stackoverflow.com/a/26893529
type: Answer
has body: That's because you are assigning a string to a string array in your two for loops. product= sc.toString(); should be product[i] = sc.toString(); and the same goes for itemCost.
answers question: http://stackoverflow.com/q/26893473
score: 0

http://stackoverflow.com/comment/42613280
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26913321
type: QuestionComment
has text: @jtoberon lastest 1.4.182

jsp
tags question: http://stackoverflow.com/q/26869196
tags question: http://stackoverflow.com/q/26936848
tags question: http://stackoverflow.com/q/26850028
tags question: http://stackoverflow.com/q/26975655
tags question: http://stackoverflow.com/q/26890162
tags question: http://stackoverflow.com/q/26922196
tags question: http://stackoverflow.com/q/26954191
tags question: http://stackoverflow.com/q/26951986
tags question: http://stackoverflow.com/q/26911184
tags question: http://stackoverflow.com/q/26990486
tags question: http://stackoverflow.com/q/26946218
tags question: http://stackoverflow.com/q/26857457
tags question: http://stackoverflow.com/q/26988203
tags question: http://stackoverflow.com/q/26904283
tags question: http://stackoverflow.com/q/26890727
tags question: http://stackoverflow.com/q/26961410
tags question: http://stackoverflow.com/q/26838036
tags question: http://stackoverflow.com/q/26925891
tags question: http://stackoverflow.com/q/26951673
tags question: http://stackoverflow.com/q/26885817
tags question: http://stackoverflow.com/q/26839107
tags question: http://stackoverflow.com/q/26879529
tags question: http://stackoverflow.com/q/26869026
tags question: http://stackoverflow.com/q/26931157
tags question: http://stackoverflow.com/q/26968877
tags question: http://stackoverflow.com/q/26940690
tags question: http://stackoverflow.com/q/26863231
tags question: http://stackoverflow.com/q/26911603
tags question: http://stackoverflow.com/q/26916178
tags question: http://stackoverflow.com/q/26987293
tags question: http://stackoverflow.com/q/26868848
tags question: http://stackoverflow.com/q/26969846
tags question: http://stackoverflow.com/q/26879070
tags question: http://stackoverflow.com/q/26984382
tags question: http://stackoverflow.com/q/26970110
tags question: http://stackoverflow.com/q/26920116
tags question: http://stackoverflow.com/q/26926874
tags question: http://stackoverflow.com/q/26904952
tags question: http://stackoverflow.com/q/26989906
type: Tag
tags question: http://stackoverflow.com/q/26835324
tags question: http://stackoverflow.com/q/26912114
tags question: http://stackoverflow.com/q/26910115
tags question: http://stackoverflow.com/q/26861270
tags question: http://stackoverflow.com/q/26875316
tags question: http://stackoverflow.com/q/26965216
tags question: http://stackoverflow.com/q/26947126
tags question: http://stackoverflow.com/q/26902631
tags question: http://stackoverflow.com/q/26932665
tags question: http://stackoverflow.com/q/26915321
tags question: http://stackoverflow.com/q/26889940
tags question: http://stackoverflow.com/q/26962157
tags question: http://stackoverflow.com/q/26918040
tags question: http://stackoverflow.com/q/26900887
tags question: http://stackoverflow.com/q/26976063
tags question: http://stackoverflow.com/q/26947148
tags question: http://stackoverflow.com/q/26968598
tags question: http://stackoverflow.com/q/26991298
tags question: http://stackoverflow.com/q/26926502
tags question: http://stackoverflow.com/q/26835645
tag name: jsp
tags question: http://stackoverflow.com/q/26974610
tags question: http://stackoverflow.com/q/26948254
tags question: http://stackoverflow.com/q/26983204
tags question: http://stackoverflow.com/q/26912276
tags question: http://stackoverflow.com/q/26978559
tags question: http://stackoverflow.com/q/26876943
tags question: http://stackoverflow.com/q/26954824
tags question: http://stackoverflow.com/q/26908447
tags question: http://stackoverflow.com/q/26972773
tags question: http://stackoverflow.com/q/26940739
tags question: http://stackoverflow.com/q/26967648
tags question: http://stackoverflow.com/q/26843106
tags question: http://stackoverflow.com/q/26941621
tags question: http://stackoverflow.com/q/26885557
tags question: http://stackoverflow.com/q/26894282
tags question: http://stackoverflow.com/q/26876828
tags question: http://stackoverflow.com/q/26968002
tags question: http://stackoverflow.com/q/26947719
tags question: http://stackoverflow.com/q/26922327

http://stackoverflow.com/a/26911567
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26910536
upvote count: 1
type: Answer
has body: If you want to process all XML files in the directory, you can use a FileFilter. Sample code: // Directory where the files are located File dir = new File("xml_folder"); // Create a FileFilter that matches ".xml" files FileFilter filter = new FileFilter() { @Override public boolean accept(File file) { return file.isFile() &amp;&amp; file.getName().endsWith(".xml"); } }; // Get pathnames of matching files. File[] paths = dir.listFiles(filter); You can then use a for loop to iterate through the paths array and parse each file as you wish. If you are using Java 1.8 or for anyone who is and wants the above in Lambda expression form then you can use: // Directory where the files are located File dir = new File("xml_folder"); // Create a FileFilter that matches ".xml" files FileFilter filter = (File file) -&gt; file.isFile() &amp;&amp; file.getName().endsWith(".xml"); // Get pathnames of matching files. File[] paths = dir.listFiles(filter);

http://stackoverflow.com/comment/42237678
has text: +1 for showing me the obvious solution, I couldn't think of! still wouldn't see `Math.pow()` as fancy :)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26835824

runnable
tags question: http://stackoverflow.com/q/26942402
type: Tag
tags question: http://stackoverflow.com/q/26888513
tags question: http://stackoverflow.com/q/26859896
tags question: http://stackoverflow.com/q/26844544
tags question: http://stackoverflow.com/q/26966118
tag name: runnable

http://stackoverflow.com/q/26922439
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/1199646
tagged with: if-statement
tagged with: java
tagged with: switch-statement
type: Question
has answer: http://stackoverflow.com/a/26922535
accepted answer: http://stackoverflow.com/a/26922535
has body: I want to start off by saying sorry, I wasn't able to search for this problem as I couldn't exactly describe it myself. I have a series of if-statements to account for each scenario. As you can see in the mammoth block of code below, I want arguments to come in any order. How, if possible, can I shorten this? if(args[1].startsWith("u:") &amp;&amp; args[2].startsWith("r:") &amp;&amp; args[3].startsWith("l:")){ // u / r / l Player p = player.getServer().getPlayer(args[1].split(":")[1]); String r = args[2].split(":")[1]; String l = args[3].split(":")[1]; Config.addPlayer(p, r, l, player); return true; }else if(args[1].startsWith("r:") &amp;&amp; args[2].startsWith("l:") &amp;&amp; args[3].startsWith("u:")){ // r / l / u Player p = player.getServer().getPlayer(args[3].split(":")[1]); String r = args[1].split(":")[1]; String l = args[2].split(":")[1]; Config.addPlayer(p, r, l, player); return true; }else if(args[1].startsWith("l:") &amp;&amp; args[2].startsWith("u:") &amp;&amp; args[3].startsWith("r:")){ // l / u / r Player p = player.getServer().getPlayer(args[2].split(":")[1]); String r = args[3].split(":")[1]; String l = args[1].split(":")[1]; Config.addPlayer(p, r, l, player); return true; }else if(args[1].startsWith("u") &amp;&amp; args[2].startsWith("l:") &amp;&amp; args[3].startsWith("r:")){ // u / l / r Player p = player.getServer().getPlayer(args[1].split(":")[1]); String r = args[3].split(":")[1]; String l = args[2].split(":")[1]; Config.addPlayer(p, r, l, player); return true; }else if(args[1].startsWith("l:") &amp;&amp; args[2].startsWith("r:") &amp;&amp; args[3].startsWith("u:")){ // l / r / u Player p = player.getServer().getPlayer(args[2].split(":")[1]); String r = args[2].split(":")[1]; String l = args[1].split(":")[1]; Config.addPlayer(p, r, l, player); return true; }else if(args[1].startsWith("r:") &amp;&amp; args[2].startsWith("u:") &amp;&amp; args[3].startsWith("l:")){ // r / u / l Player p = player.getServer().getPlayer(args[2].split(":")[1]); String…
score: -1
has answer: http://stackoverflow.com/a/26922678
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/26922612
favorite count: 0
has comment: http://stackoverflow.com/comment/42392567
has comment: http://stackoverflow.com/comment/42392459
has title: Parsing argument list specifying a player to be added
linked to: http://stackoverflow.com/q/8571490
possible better answer: http://stackoverflow.com/a/26922612
linked to: http://stackoverflow.com/q/3806822

http://stackoverflow.com/q/26891555
has title: Java PrintWriter to file (on a mac) not working
has body: I've read several threads on here and still can't find out why PrintWriter isn't printing to file and is instead throwing a java.io.FileNotFoundException. I've checked the file location, I've checked the upper/lowercases in the file path. Can someone tell me what I'm doing wrong: File output = new File("/Users/&lt;myname&gt;/Documents/javaoutput.txt"); output.getParentFile().mkdir(); PrintWriter writer = new Printwriter(output);
score: 0
tagged with: file-io
answer count: 1
has answer: http://stackoverflow.com/a/26892114
tagged with: macos
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42337659
tagged with: printwriter
tagged with: java
type: Question

http://stackoverflow.com/comment/42250740
has text: I am dynamically creating a part which is implementing this partDescriptor (where the code is ). I did not add any bindingContext manually.(If i understood your question)
score: 0
comment on: http://stackoverflow.com/q/26841285
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26887934
tagged with: spring-security
tagged with: ldap
type: UnansweredQuestion
tagged with: spring
answer count: 0
has comment: http://stackoverflow.com/comment/42330803
score: 0
tagged with: java
has title: Customising log in form
tagged with: authentication
has body: I took the Spring Security example from the Spring framework website, and I make it to work. Now I have to extend it so I can use a log in form customized by me. I think I need to change this method: protected void configure(HttpSecurity http) Does anyone know how to do this?` package hello; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.authentication.configurers.GlobalAuthenticationConfigurerAdapter; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.annotation.web.servlet.configuration.EnableWebMvcSecurity; @Configuration @EnableWebMvcSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/css/**").permitAll().anyRequest() .fullyAuthenticated().and().formLogin(); @Configuration protected static class AuthenticationConfiguration extends GlobalAuthenticationConfigurerAdapter { @Override public void init(AuthenticationManagerBuilder auth) throws Exception { auth.ldapAuthentication().userDnPatterns("uid={0},ou=otherpeople") .groupSearchBase("ou=groups").contextSource() .ldif("classpath:test-server.ldif"); } } }
type: Question
has comment: http://stackoverflow.com/comment/42330930

http://stackoverflow.com/comment/42431944
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26944152
has text: Just tell me is there any problem in the way i'm using query or using the listview?
score: 0

http://stackoverflow.com/comment/42326646
comment on: http://stackoverflow.com/q/26876437
score: 0
type: QuestionComment
has text: Unfortunately, the project is built on Java 7.
type: Comment

http://stackoverflow.com/comment/42275107
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26856462
has text: Does the applet have permission to make network connection? You may also want to have a read of [Concurrency in Swing](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/)
score: 0

http://stackoverflow.com/comment/42713261
type: Comment
has text: Yes, but during the migration to 4.5, the content of those files have changed which is clearly stated on http://docs.codehaus.org/display/SONAR/Release+4.5+Upgrade+Notes
comment on: http://stackoverflow.com/a/26977414
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42357300
has text: have u check xml file in assest folder not in subfolder have u added screen shot of thia
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26902338
score: 0

http://stackoverflow.com/a/26929923
has body: Firstly check are you following all steps to create AVD, Check SDK that you are using is downloaded properly or not. If not then download require SDK version, then recreate AVD.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42405168
answers question: http://stackoverflow.com/q/26929713

http://stackoverflow.com/q/26858976
tagged with: grails
score: 0
tagged with: cmd
has answer: http://stackoverflow.com/a/27685806
has body: I'm a newbie in Grails Framework, I've downloaded Grails version 2.4.4 and set Path to it. I create new application (like "hello world") but when run it with command (after cd application folder): grails run-app , cmd was stopped at this line : Configuring classpath. Then I google, and try to use this way : setting "verbose" in BuildConfig.groovy file and it still like before with these errors : | Error Resolve error obtaining dependencies: Failed to read artifact descriptor for org.slf4j:jcl-over-slf4j:jar:1.7.5 org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for org.slf4j:jcl-over-slf4j:jar:1.7.5 at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:370) at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:217) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.resolveCachedArtifactDescriptor(DefaultDependencyCollector.java:525) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.getArtifactDescriptorResult(DefaultDependencyCollector.java:509) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:409) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.process(DefaultDependencyCollector.java:351) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.doRecurse(DefaultDependencyCollector.java:494) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:458) at org.eclipse.aether.internal.impl.DefaultDependencyCollector.processDependency(DefaultDependencyCollector.java:363) What can I do next?? and why it has these error, and what can I do for running this application. P/s : Java version that I use is Java 1.6.…
accepted answer: http://stackoverflow.com/a/27685806
type: AnsweredQuestion
has title: Issue when run app with Grails
tagged with: java
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/27691269
type: Question
has answer: http://stackoverflow.com/a/27691269
answer count: 2

http://stackoverflow.com/comment/42508874
type: QuestionComment
has text: OK, maybe this will not solve your problem but try and `flush()` before you `close()`. Also, if you use Java 7, use a try-with-resources statement
score: 1
type: Comment
comment on: http://stackoverflow.com/q/26988287

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/26979476
tags question: http://stackoverflow.com/q/26979268
tags question: http://stackoverflow.com/q/26923463
tags question: http://stackoverflow.com/q/26981625
tags question: http://stackoverflow.com/q/26981006
tag name: android-actionbar

http://stackoverflow.com/comment/42329811
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26842584
type: Comment
has text: Would you consider using java decompiler to see how the ServiceLoader is used in the 3rd party library? And just guessing, could it be that it uses the wrong classloader? Do you have multiple external.lib.path.TheConreteClass or TheFactoryInterface in classpath?

http://stackoverflow.com/comment/42429370
score: 0
has text: I tried it...Itz working..Thank You trashgod & aterai..
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26933276

http://stackoverflow.com/q/26893686
linked to: http://stackoverflow.com/q/10664182
type: Question
tagged with: java
score: 15
upvote count: 15
answer count: 3
linked to: http://stackoverflow.com/q/3295496
has answer: http://stackoverflow.com/a/26893800
downvote count: 0
has answer: http://stackoverflow.com/a/26893834
favorite count: 0
tagged with: proxy
has answer: http://stackoverflow.com/a/26893862
tagged with: spring
has body: At work and online I keep hearing the term "proxy" with respect to enterprise Java development. For example, metrics-spring uses this phrase: This module does the following things: Creates metrics and proxies beans which contain methods annotated with @Timed, @Metered, @ExceptionMetered, and @Counted [emphasis mine] I'm unfamiliar with a lot of the language in the Java ecosystem of frameworks and libraries. I feel like I have a good understanding of what a bean is, but I'm still not clear about how one would proxy a bean. What does it mean to proxy a bean?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26893862
has title: What does it mean to "proxy a bean"?
accepted answer: http://stackoverflow.com/a/26893834

http://stackoverflow.com/q/26978520
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I'm using Log4j version 2.1 (the latest stable version) and trying to use a Syslog appender to log to a syslog server. I'm using the configuration given at their official site (http://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender): &lt;Syslog name="RFC5424" format="RFC5424" host="localhost" port="514" protocol="UDP" appName="MyApp" includeMDC="true" facility="LOCAL0" enterpriseNumber="18060" newLine="true" messageId="Audit" id="App"/&gt; When I start my app and do a LogManager.getLogger(), I get an error (stack trace bellow), so, before I report an error to their bug tracker, am I doing something wrong? 014-11-17 18:26:23,640 ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.SyslogAppender for element Syslog. java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:135) at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:766) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:706) at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:698) at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:358) at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161) at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359) at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420) at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138…
tagged with: log4j2
type: Question
score: 5
tagged with: syslog
accepted answer: http://stackoverflow.com/a/27024698
answer count: 1
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/27024698
upvote count: 5
has title: Log4j2 SyslogAppender not working
tagged with: logging

http://stackoverflow.com/comment/42474833
type: Comment
comment on: http://stackoverflow.com/a/26969184
has text: I used eclipse data source explorer but it save outside my project folder. When I published my game, it has a possibility to not be included in my executable jar?
type: AnswerComment
score: 0

http://stackoverflow.com/q/26973480
favorite count: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42507915
has title: JodaTime - NoSuchMethodError: DateTimeFormatterBuilder.appendFixedDecimal
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42518633
has comment: http://stackoverflow.com/comment/42491883
tagged with: json-schema-validator
has comment: http://stackoverflow.com/comment/42483986
type: Question
tagged with: jodatime
has body: While executing below piece of code import com.github.fge.jsonschema.main.JsonSchemaFactory; JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); I am getting below error. ]] Root cause of ServletException. java.lang.NoSuchMethodError: org.joda.time.format.DateTimeFormatterBuilder.appendFixedDecimal(Lorg/joda/time/ DateTimeFieldType;I)Lorg/joda/time/format/DateTimeFormatterBuilder; at com.github.fge.jsonschema.format.common.DateTimeAttribute.<clinit>(DateTimeAttribute.java:56) at com.github.fge.jsonschema.library.format.CommonFormatAttributesDictionary.<clinit>(CommonFormatAttributesDictionary.java:52) at com.github.fge.jsonschema.library.format.DraftV3FormatAttributesDictionary.<clinit>(DraftV3FormatAttributesDictionary.java:47) at com.github.fge.jsonschema.library.DraftV3Library.<clinit>(DraftV3Library.java:32) at com.github.fge.jsonschema.cfg.ValidationConfigurationBuilder.<clinit>(ValidationConfigurationBuilder.java:63) Truncated. see log file for complete stacktrace Used maven dependency is as below. com.github.fge json-schema-validator 2.2.6 Can someone please help me out to figure out what could be wrong?
has comment: http://stackoverflow.com/comment/42494222
has comment: http://stackoverflow.com/comment/42483322
has comment: http://stackoverflow.com/comment/42483829
has comment: http://stackoverflow.com/comment/42591456
has comment: http://stackoverflow.com/comment/42484037
has comment: http://stackoverflow.com/comment/42517253
has comment: http://stackoverflow.com/comment/42518477
has comment: http://stackoverflow.com/comment/42514855
has comment: http://stackoverflow.com/comment/42484122
upvote count: 1
has comment: http://stackoverflow.com/comment/42556249

http://stackoverflow.com/a/26953455
answers question: http://stackoverflow.com/q/26953077
accepted answer of: http://stackoverflow.com/q/26953077
type: Answer
has body: Use GregorianCalendar object which is a subclass of Calendar: String dayPattern = "DD"; SimpleDateFormat days = new SimpleDateFormat(dayPattern); return Integer.parseInt(days.format(endingDate.getTimeInMillis()-beginningDate.getTimeInMillis())); Oracle docs
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/26961812
score: 2
has comment: http://stackoverflow.com/comment/42462543
has title: Summing Values from SQLite into EditText
tagged with: java
has comment: http://stackoverflow.com/comment/42461948
type: Question
has body: in my app i have an sql database that holds an item name and its litres, I have a list view that prints out each row, in each row i am printing the name of each item and a plus and minus button. when a button is pressed I want the litres of that item to be added to a running total. I just cant get it to work and would really appreciate any help I can get. At the moment I am reading the litres for each item into a variable 'test' I am then sending this variable to print in the edittext through an interface but when I click a button the editText doesnt get the litres it just prints out some sort of string. This is the adapter where I am trying to read in the litres, Should I be trying to do this here or somewhere different? import android.content.Context; import android.database.Cursor; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.CursorAdapter; import android.widget.EditText; import android.widget.TextView; import java.util.ArrayList; public class CustomCursorAdapter extends CursorAdapter { //public int counter = 0; public ArrayList&lt;Integer&gt; counter; private MyAdapterInterface mMyInterface; public CustomCursorAdapter(Context context, Cursor cursor, MyAdapterInterface myInterface) { //instantiating the values super(context, cursor); this.context = context; this.mMyInterface = myInterface; //array to sort each value per row counter = new ArrayList&lt;Integer&gt;(); //default all counters to 0 for(int i=0; i&lt;cursor.getCount(); i++) { counter.add(0); } } Context context; @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { // when the view will be created for first time, // we need to tell the adapters, how each item will look LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View retView = inflater.inflate(R.layout.row, parent, false); return retView; } public void bindView(View view, Context context, final Cursor cu…
has comment: http://stackoverflow.com/comment/42461847
downvote count: 0
favorite count: 0
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/42461910
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/42246974
type: AnswerComment
comment on: http://stackoverflow.com/a/26841321
has text: I have to finally store the value of LinkedHaspMap into double type of array i.e primitive type as this value will be used further into ChartDirector.XYChart method which takes primitive type arguments.
score: 0
type: Comment

http://stackoverflow.com/q/26892906
has title: JSON response in struts
has comment: http://stackoverflow.com/comment/42339721
has answer: http://stackoverflow.com/a/26898570
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42340477
type: Question
has comment: http://stackoverflow.com/comment/42340634
tagged with: struts2
has comment: http://stackoverflow.com/comment/42340235
tagged with: struts-config
has comment: http://stackoverflow.com/comment/42339790
has body: I have defined the result type for my action as follows. usageBreakUp true NotImplemented.html NotImplemented.html My action class has the following members // input parameters private int storageId; private Date fromDate; private Date toDate; private int aggregationId; // Output private Map<String, String> usageBreakUp = new HashMap<>(); But the JSON response I get is not rooted at usageBreakUp. { "actionErrors":[ ], "actionMessages":[ ], "aggregationId":2, "errorMessages":[ ], "errors":{ }, "fieldErrors":{ }, "fromDate":null, "locale":{ "ISO3Country":"USA", "ISO3Language":"eng", "country":"US", "displayCountry":"United States", "displayLanguage":"English", "displayName":"English (United States)", "displayScript":"", "displayVariant":"", "extensionKeys":[ ], "language":"en", "script":"", "unicodeLocaleAttributes":[ ], "unicodeLocaleKeys":[ ], "variant":"" }, "storageId":1, "texts":null, "toDate":null, "usageBreakUp":{ "3rd Floor":"20", "Ist Floor":"20", "4th Floor":"40", "2nd Floor":"20" } } What am I missing here? EDIT : Here is my entire action class public class WaterUsageAction extends ActionSupport { private final static int NO_DATA = -1; /** * Action method which gives the break up of water usage amongst child * aggregations */ // Input parameters private int storageId; private Date fromDate; private Date toDate; private int aggregationId; // Output private Map<String, String> usageBreakUp = new HashMap<>(); // http://localhost:8080/SWNBackend/service/waterUsageByAggregation.json?aggregationId=2&storageId=1 public String usageBreakUp() { AggregationDAO aggregationDAO = new AggregationDAO(); Aggregation aggregation = aggregationDAO.findByIdLazy(aggregationId); for (int childAggregationId : aggregation.getAggregationIds()) { Aggregation childAggregation = aggregationDAO .findByIdLazy(childAggregationId); String usageString = String.valueOf(getUsage( childAggregation.getId(), fromDate, toDate)); if (usageString.equals(String.valueOf(NO_DATA))) usageString = "No …
has comment: http://stackoverflow.com/comment/42340102
has comment: http://stackoverflow.com/comment/42339906
upvote count: 1
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26898570
has comment: http://stackoverflow.com/comment/42340428
type: AnsweredQuestion

http://stackoverflow.com/comment/42365690
has text: I still miss a step. What should I write insde salveUtente() to manage the 3 insert session.saveOrUpdate(User); session.saveOrUpdate(UserCredentials); session.saveOrUpdate(UserOtherDetails);
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26889838

http://stackoverflow.com/comment/42493288
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26979268
has text: did you try R.id.menu_search instead of Menus.PROCURAR?
score: 0

http://stackoverflow.com/a/26966542
type: Answer
has comment: http://stackoverflow.com/comment/42470206
answers question: http://stackoverflow.com/q/26966123
score: 0
has body: import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Spinner; public class My_Fragment extends Fragment { Spinner spinner; String[] Languages = { "Select a Language", "C# Language", "HTML Language", "XML Language", "PHP Language" }; ArrayAdapter<String> adapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View view = inflater.inflate(R.layout.myfragment, null); spinner = (Spinner) view.findViewById(R.id.spinner); adapter = new ArrayAdapter<String>(getActivity(), R.layout.rowspinner,R.id.textView1 ,Languages); spinner.setAdapter(adapter); return view; } } xml file <Spinner android:id="@+id/spinner" android:layout_width="match_parent" android:layout_height="wrap_content" /> row spnieer <TextView android:id="@+id/textView1" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:text="TextView" android:textSize="30dp" />

http://stackoverflow.com/q/26907795
linked to: http://stackoverflow.com/q/7246369
tagged with: java
has answer: http://stackoverflow.com/a/26908055
type: Question
tagged with: code-injection
answer count: 1
has title: Spring - properties filte to Map<String, Class<Object>>
tagged with: spring
tagged with: dictionary
tagged with: properties
type: UnansweredQuestion
score: 0
has body: I'm trying to load a class passing a properties file as parameter on the constructor but I'm getting a cast exception: java.lang.String cannot be cast to java.lang.Class. Can anyone help? Here is my code: myMap.properties BAR=com.mycomp.myapp.Bar application-context.xml looks like this: &lt;util:properties id="myMap" location="classpath:myMap.properties" local-override="false" value-type="java.lang.Class" /&gt; &lt;bean id="foo" class="com.mycomp.myapp.Foo"&gt; &lt;constructor-arg name="myMap" ref="myMap"/&gt; &lt;/bean&gt; Foo.java public class Foo { private Map&lt;String, Class&lt;Object&gt;&gt; myMap; public Foo(Map&lt;String, Class&lt;Object&gt;&gt; myMap){ this.myMap = myMap; Class&lt;Object&gt; barClass = myMap.get("BAR"); //failure point } }

http://stackoverflow.com/comment/42492803
type: Comment
comment on: http://stackoverflow.com/q/26979036
score: 0
has text: @Edward how do I do that?
type: QuestionComment

http://stackoverflow.com/a/26922826
accepted answer of: http://stackoverflow.com/q/26922727
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/75681346
answers question: http://stackoverflow.com/q/26922727
type: AcceptedAnswer
has body: First, the first line in all XML file, must be something similar to: <?xml version='1.0' encoding='utf-8'?> So, you can try the next: <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/database user user123 1 org.hibernate.dialect.MySQLDialect thread org.hibernate.cache.NoCacheProvider true create <mapping class="hibernateDTO.StudentDetails"/> </hibernate-configuration> See also XML Validator online and Hibernate Configuration in www.tutorialspoint.com
downvote count: 0

http://stackoverflow.com/a/79344615
has body: For anybody from the future: I don't know if it's the same bug but try this Workaround, as I couldn't make use of the GetStringSet because of an Invalid Cast Exception public ICollection<string> RetrieveValues(string key) { ICollection<string> values= new Collection<string>(); try { //GetStringSet doesn't work sometimes, apparently a Xamarin.Android bug, it throws InvalidCastException in those cases. values = sharedPreferences.GetStringSet(key, null); } catch { var javaCollectionValues= (Android.Runtime.JavaCollection)sharedPreferences.All.Where(x=> x.Key == key).FirstOrDefault().Value; foreach (string item in javaCollectionValues) { values.Add(item); } } return values; } The Android.Runtime.JavaCollection type is the underlying type, this has an IEnumerable, which can allow us iterate through and return an appropiate ICollection<string> as you can see, you can just get this value from the entire list of preferences in order to get the value you saved using SetStringSet(ICollection<string> value) /or when using a MultiListSelectPreference preference screen. Of course key is the SharedPreference key you have used for the MultiListSelectPreference screen, which in your case is "list" the sharedPreference field I have in my snippet would be your Prefs field, of type ISharedPreferences Even if it's too late, I think you still managed to solve it in one way or another, this is my solution and I hope it helps somebody in the future.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26905839

http://stackoverflow.com/q/26848742
has answer: http://stackoverflow.com/a/26851512
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/42261422
linked to: http://stackoverflow.com/q/6198986
type: Question
has comment: http://stackoverflow.com/comment/42260122
accepted answer: http://stackoverflow.com/a/26851512
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42260203
has body: I pulled out some text values from database, I need to parse this text but when I print text on the console it has some '?' character which are not visible on notepad++ and sqlyog. Below is the sample: (some character string)??????(another string)??? I need to remove them, but all my efforts went into vain. I used string replaceall method and convert text into char array and again build the text but it is not working. How to remove these '?' characters from text? Thanks in advance.
has title: String with unwanted character in java
type: AnsweredQuestion

http://stackoverflow.com/a/26946020
has comment: http://stackoverflow.com/comment/42434794
has comment: http://stackoverflow.com/comment/42434554
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42459098
has body: public class AssignIdToArticleAnswer implements Answer&lt;Void&gt; { private final Long id; public AssignIdToArticleAnswer(Long id) { this.id = id; } @Override public Void answer(InvocationOnMock invocation) throws Throwable { Article article = (Article) invocation.getArguments()[0]; article.setId(id); return null; } } And then doAnswer(new AssignIdToArticleAnswer(1L)).when(em).persist(any(Article.class));
type: Answer
answers question: http://stackoverflow.com/q/26945891
upvote count: 7
accepted answer of: http://stackoverflow.com/q/26945891
score: 7

http://stackoverflow.com/q/26849005
type: AnsweredQuestion
downvote count: 0
favorite count: 0
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26849154
tagged with: spring
has title: Spring inject dependency for constructors
has answer: http://stackoverflow.com/a/26849409
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/42260630
has body: I'm planning to create my objects in my Spring MVC using the below setup but How can I inject values to my MyService ie; instantiate the object with default value... public class MyController { private MyService myService; @Autowired public void setMyService(MyService aService) { // autowired by Spring this.myService = aService; } @RequestMapping("/blah") public String someAction() { // do something here myService.foo(); return "someView"; } } MyService class Myservice(){ String servicename; public Myservice(servicename){ this.servicename = servicename; } } Without Spring MyService first = new MyService("firstservice"); MyService second = new MyService("secondservice");
tagged with: java
has comment: http://stackoverflow.com/comment/42260729
possible better answer: http://stackoverflow.com/a/26849409
accepted answer: http://stackoverflow.com/a/26849154
has comment: http://stackoverflow.com/comment/42260766
has comment: http://stackoverflow.com/comment/42260775
score: 2

http://stackoverflow.com/comment/42498419
has text: i'm pretty sure in your previous comment, you indicated that the datagram consumer was receiving the correct data. if that's not the case, then the problem is probably in your consumer. if that is the case, then i fail to see why you say "i'm sending incorrect data but the consumer is receiving correct data"?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26981232

http://stackoverflow.com/comment/42630222
type: AnswerComment
score: 0
has text: @AliCheaito Your answer is wrong. `java.lang.Object Object = new java.lang.Object();` is perfectly valid Java by itself; the only reason it doesn't compile is that @Elist is name-shadowing `java` with his class. That's a very bad idea. `Object o = java.lang.Object;` is **not** valid Java, unless you have the weird code that @Elist added. Try both in your compiler without @Elist's code and you'll see that the first line is valid and the second line is not.
type: Comment
comment on: http://stackoverflow.com/a/26980283

http://stackoverflow.com/comment/53928290
comment on: http://stackoverflow.com/q/26961410
has text: @AndyP try some other alias name for status, coz status is keyword
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26855509
upvote count: 1
has body: The scroll pane has a viewport which can have its own border. scrollPane.setViewportBorder(null);
has comment: http://stackoverflow.com/comment/42273389
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26855468
type: Answer
has comment: http://stackoverflow.com/comment/42273291

http://stackoverflow.com/a/26948230
has body: In response to your first question, CXF has the foundational component of a bus. The bus is simply a registry of components. If you leverage Spring for your CXF web services, this bus will register up components through the Spring application context. CXF also uses a servlet transport that will act similar in nature to the Spring MVC controller by loading the Spring context for you. You can certainly publish your CXF service endpoints without Spring. Check the CXF documentation on Servlet Transport for more details on how. As mentioned above, CXF implements JAX-RS. There are some parts of the specification on the client side that were not fully supported by CXF version 2.x, so I would recommend to use CXF version 3.x if you plan to implement JAX-RS web services. As CXF implements the pipes and filters pattern, it is certainly a different implementation than Spring MVC; however, at the end of the day, I feel you can be successful implementing RESTful service development with either approach. I could not tell you which framework is more popular. It really depends on your requirements.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26902047

http://stackoverflow.com/a/26917454
type: Answer
has body: EDIT (after comments and alter of the posted code) This is happening because the Spring Web application has 2 contexts: 1 is the root context and another one is the Web context (the one you register by the @EnableWebMvc annotation). Please do the following: 1) Remove the @Import annotation from your MjurWebAppConfig - remember this is your web context. 2) Add the @Import in the MjurAppConfig config essentially looking like: @Configuration @Import({MongoConfiguration.class}) @ComponentScan({"prv.makro.mjur.dao", "prv.makro.mjur.repository"}) public class MjurAppConfig { //.. These steps should make visible your autowired DAO bean inside your Service bean. Before EDIT: I bet your TestService bean is under package prv.makro.mjur.service judging by the component scan annotation: @ComponentScan({"prv.makro.mjur.controller"}) In other words @ComponentScan cannot see your TestService to register the @Autowired dependency. Make sure TestService is visible by your component scan and under the above assumption if you do: @ComponentScan({"prv.makro.mjur"}) it should work.
has comment: http://stackoverflow.com/comment/42385668
has comment: http://stackoverflow.com/comment/42385986
has comment: http://stackoverflow.com/comment/42386789
has comment: http://stackoverflow.com/comment/42386571
answers question: http://stackoverflow.com/q/26916763
score: 0

http://stackoverflow.com/q/26983905
has comment: http://stackoverflow.com/comment/42510809
has answer: http://stackoverflow.com/a/27235031
accepted answer: http://stackoverflow.com/a/27235031
answer count: 3
upvote count: 7
possible better answer: http://stackoverflow.com/a/27130523
favorite count: 0
linked to: http://stackoverflow.com/q/1283499
has answer: http://stackoverflow.com/a/27130523
has answer: http://stackoverflow.com/a/27213896
tagged with: android
has title: Android Programming - Making a URI to get audio location
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42502072
downvote count: 0
score: 7
tagged with: java
type: Question
has body: I'm brand new to Java and also android programming, so things are a little strange to me! I mainly come from a background in C++/C# so speak the tech! Anyhow. I'm trying to create a simple class that handles audio for a custom music player i'm designing. I've got all the keypress events handled, so now i'm working on the functionality. I'm using the MediaPlayer class for handling most of the hard stuff, but I'm a little confused on how to access audio that is saved on a users mobile device. I've been doing a little research, and apparently the android device has an inbuilt database that manages the locations of all the audio, and to access this data I have to use a Uri? If someone could post some code samples of how to use a Uri to access this, then i'm rather sure I will be able to build on top of that to then add the data into whatever container I desire. Just to make clear - the music location directory isn't known by the user, and I'm not making a raw folder, I want to gain access to ALL music held on the users device where the software can then play it. Or if that fails, a nice tutorial... I've looked at the docs gave by google, but there aren't any example codes so I don't really know where to start! Thanks all.
tagged with: uri

http://stackoverflow.com/a/26863051
answers question: http://stackoverflow.com/q/26862948
has comment: http://stackoverflow.com/comment/42286285
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26862948
has body: Actually calendar.set(blah, blahVal) is not updating the first params (Calendar.YEAR), it update the value which is internally maintain by the calendar, for example if you give cal.set(Calendar.YEAR, 2001) Calendar.YEAR is a constant which is index of an array. that array contain the specified value. that value is update dramatically.
downvote count: 0

http://stackoverflow.com/comment/42310237
comment on: http://stackoverflow.com/q/26876303
score: 0
type: Comment
type: QuestionComment
has text: public class Demo { public static void SavingsAccount() { BankAccount acc = new BankAccount(0, 0.5); int hi = acc.makeDeposit(100); }

http://stackoverflow.com/a/26942532
has body: The uiautomator test case doesn't need runners unlike junit test. You can write test code (in android dev's example, LaunchSettings.java) and compile it, then put it to your device with your app. See the example test code. http://developer.android.com/tools/testing/testing_ui.html#sample
has comment: http://stackoverflow.com/comment/42428534
type: Answer
answers question: http://stackoverflow.com/q/26942440
has comment: http://stackoverflow.com/comment/42428756
score: 0

http://stackoverflow.com/comment/42366106
comment on: http://stackoverflow.com/q/26908043
type: Comment
type: QuestionComment
has text: Please show some code.
score: 3

abstract-factory
tags question: http://stackoverflow.com/q/26890747
tag name: abstract-factory
type: Tag

http://stackoverflow.com/comment/42238771
type: Comment
comment on: http://stackoverflow.com/q/26836512
score: 0
has text: But I want to switch jpanels at the click of a button. How do I do that?
type: QuestionComment

http://stackoverflow.com/comment/42356186
comment on: http://stackoverflow.com/q/26902103
score: 0
type: Comment
type: QuestionComment
has text: Are you taking mobile network (gprs, 3g, 4g etc.) into consideration?

list
type: Tag
tags question: http://stackoverflow.com/q/26987807
tags question: http://stackoverflow.com/q/26837386
tags question: http://stackoverflow.com/q/26866152
tags question: http://stackoverflow.com/q/26946214
tags question: http://stackoverflow.com/q/26855439
tags question: http://stackoverflow.com/q/26936988
tags question: http://stackoverflow.com/q/26847008
tags question: http://stackoverflow.com/q/26987665
tags question: http://stackoverflow.com/q/26905537
tags question: http://stackoverflow.com/q/26876835
tag name: list
tags question: http://stackoverflow.com/q/26908428
tags question: http://stackoverflow.com/q/26847696
tags question: http://stackoverflow.com/q/26966410
tags question: http://stackoverflow.com/q/26893748
tags question: http://stackoverflow.com/q/26910117
tags question: http://stackoverflow.com/q/26988573
tags question: http://stackoverflow.com/q/26838183
tags question: http://stackoverflow.com/q/26946866
tags question: http://stackoverflow.com/q/26976920
tags question: http://stackoverflow.com/q/26968002
tags question: http://stackoverflow.com/q/26967466
tags question: http://stackoverflow.com/q/26985762
tags question: http://stackoverflow.com/q/26942318
tags question: http://stackoverflow.com/q/26980938
tags question: http://stackoverflow.com/q/26841806
tags question: http://stackoverflow.com/q/26905477
tags question: http://stackoverflow.com/q/26847198
tags question: http://stackoverflow.com/q/26990642
tags question: http://stackoverflow.com/q/26930527
tags question: http://stackoverflow.com/q/26969236
tags question: http://stackoverflow.com/q/26936096
tags question: http://stackoverflow.com/q/26849245
tags question: http://stackoverflow.com/q/26876390
tags question: http://stackoverflow.com/q/26940368

http://stackoverflow.com/comment/42334826
has text: I'd suggest - at a minimum - posting the entire method and the entire error you're getting.
comment on: http://stackoverflow.com/q/26890151
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26837473
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26836638
has body: There are two approaches by implementing comparator or comparable. For your requirement I would suggest you can implements Comparable in your ContactVO class. And override compareTo method. private class ContactsVO implements Comparable&lt;ContactsVO&gt; { private Integer number; // Remaining attributes and their getter setter. public Integer getNumber() { return number; } public void setNumber(Integer number) { this.number = number; } @Override public int compareTo(ContactsVO compareWith) { if (this.getNumber() &gt; compareWith.getNumber()) return 1; else if (this.getNumber() &lt; compareWith.getNumber()) return -1; else return 0; } } If comparing attribute (in our case is number) implements Comparable then we can rewrite compareTo method as @Override public int compareTo(ContactsVO compareWith) { return this.getNumber().compareTo(compareWith.getNumber()); } Note: Some basic data types such as Integer, String implements Comparable.

http://stackoverflow.com/comment/42318253
score: 0
type: AnswerComment
type: Comment
has text: Hi, thank you for your answer,, What if I want to get the buttontext from the clicked button? can it pass through?
comment on: http://stackoverflow.com/a/26880546

http://stackoverflow.com/a/26833714
upvote count: 4
has comment: http://stackoverflow.com/comment/42234193
score: 4
has comment: http://stackoverflow.com/comment/42233798
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26833662
has comment: http://stackoverflow.com/comment/42241988
has body: We can simply use the recursion to get the possibilities by recursively selecting one element and then applying the recursion to the sub set of that array. this is an example for numbers 1 to 3

http://stackoverflow.com/comment/42299550
has text: Ah, I didn't realize you could write `ArrayList<Integer>::new`. That simplifies my Supplier a bit in my code. +1, thanks.
comment on: http://stackoverflow.com/a/26854666
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26923463
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26924149
has body: Been trying everything to show the menu item search (searchWidget) in the actionbar. I have a navigationdrawer, which doesn't hide the actionbar items at any time. But still the search item is always at the overflow, even when having a large screen device. I have tried using always in the showAsAction in the menu item, and even putting the menu item as visible in the onPrepareOptionsMenu method, and calling it when the drawer opens and closes to see if something changed, and still nothing. I won't post code now, just wondering if someone had the same problem. If necessary I will post code of course.
tagged with: navigation-drawer
type: Question
has answer: http://stackoverflow.com/a/26924149
has title: Show menu item icons in actionbar while having navigation drawer
upvote count: 1
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-actionbar

http://stackoverflow.com/a/26848755
has comment: http://stackoverflow.com/comment/42260552
accepted answer of: http://stackoverflow.com/q/26848653
has comment: http://stackoverflow.com/comment/42260414
has comment: http://stackoverflow.com/comment/42260201
has comment: http://stackoverflow.com/comment/42260253
score: 0
has body: A few issues: 1. current.setNext(current.next); You're not advancing the index thus you basically set the reference to itself. 2. Why are you calling if(contains(item)) and then look for the item again? I'd just do it in one go. 3. for(int i = 0; i&lt;size; i++){ if((current.getData()).equals(item)){ index = i; //this will be the index of the item to be removed } current = current.next; } If you found the node you're still calling current = current.next;, so current will point to the node after the one you want to get. I assume you want to add a break; in the condition block. 4. for(int i = index; i &lt;= size; index++){ You should increment i and not index, otherwise the loop itself would never terminate. 5. After your edit you have this: for(int i = index; i &lt;= size; index++){ if(i &lt; size){ current.setData(current.next.getData()); current = current.next; } ... Here you have one iteration too much. Assume the list A, B, C again. size is 3 here and when removing B you get index = 1. Now you iterate over i = 1; i &lt;= 3; i++. (I assume you fixed no. 4 here) So after the first iteration current will point to C and i will be 2. Thus you're executing the if-block again and call current.next.getData() which I assume will result in the NPE, since C doesn't have a next node.
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26848653
has comment: http://stackoverflow.com/comment/42260358

http://stackoverflow.com/comment/42327020
type: AnswerComment
comment on: http://stackoverflow.com/a/26881940
score: 0
type: Comment
has text: But I cannot see, why this affects my problem. a is the copy of the reference to my array (to be sorted). left and right are references to copies of the divided array. merge merges these arrays to a longer array and the reference a is assigned to this return value. I cannot see, why thats a problem

http://stackoverflow.com/a/45702904
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/26936848
has body: Try This - Add Tomcat at run time
type: Answer
has comment: http://stackoverflow.com/comment/78364394
score: 0

http://stackoverflow.com/comment/42494189
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26974875
has text: Well, attributes in `HttpSession` are basically a `Map<String, Object>` associated to an unique id per client. In [`HttpSessionListener#sessionCreated`](https://docs.oracle.com/javaee/7/api/javax/servlet/http/HttpSessionListener.html#sessionCreated(javax.servlet.http.HttpSessionEvent)), you can load the values related to the specific client.

http://stackoverflow.com/q/26978891
possible better answer: http://stackoverflow.com/a/27001446
tagged with: maven
type: AnsweredQuestion
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/27001907
tagged with: maven-assembly-plugin
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42533078
downvote count: 0
has title: Maven assembly -- how to create the project JAR with version included, but the artifact tar.gz file without?
has body: Using Maven I want to create 1) a JAR file for my current project with the current version included in the file name, myproject-version.jar, and 2) an overall artifact in tar.gzip format containing the project's JAR file and all dependency JARs in a lib directory and various driver scripts in a bin directory, but without the version number or an arbitrary ID in the name. I have this working somewhat using the assembly plugin, in that if I use the below pom.xml and assembly.xml then when I run 'mvn package' I can get a tar.gzip file with the JARs and scripts included as desired, however I don't seem to be able to get the naming/versioning correct -- either I get both the project's JAR file and the tar.gzip file with the version number or not depending on the build/finalName used. How can I specify these separately, and is it impossible to build the final artifact without an ID appended to the artifact name? For example I'd like to have my project's JAR file be named myproject-0.0.1-SNAPSHOT.jar and the overall "uber" artifact be named myproject.tar.gz (no version number or additional ID appended to the name). Is this possible? My current pom.xml and asssembly.xml are included below. pom.xml: 4.0.0 mygroup myproject jar 0.0.1-SNAPSHOT myproject http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 4.11 test joda-time joda-time 2.3 ${project.artifactId}-${project.version} maven-assembly-plugin 2.4.1 src/main/maven/assembly.xml make-assembly package single assembly.xml: bin tar.gz src/main/python bin indices_processor.py concat_timeslices.py target lib *.jar lib true runtime false Thanks in advance for any suggestions.
score: 3
has answer: http://stackoverflow.com/a/27001446
has answer: http://stackoverflow.com/a/27001907
favorite count: 0

http://stackoverflow.com/comment/42464231
type: QuestionComment
comment on: http://stackoverflow.com/q/26951327
score: 0
has text: Had to remove the last part of the question(s) as asking for refs/tutorials etc. is explicitly off-topic.
type: Comment

http://stackoverflow.com/a/66969042
has body: As most synchronisation errors between IntelliJ (IDE) and development environments. Specially if you have automated tests or build that pass green all the way through. Invalidate Cache and Restart solved my problem.
upvote count: 4
downvote count: 0
score: 4
type: Answer
answers question: http://stackoverflow.com/q/26889970

http://stackoverflow.com/comment/42292249
has text: As I said '../conf/attribute-r.xml', .. for one level above 'others' so cwd is now IdPServer, then reference conf/attribute-r.xml from there.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26862513
score: 0

http://stackoverflow.com/comment/42403520
score: 0
type: Comment
has text: Quite simple, but remember that this is `C#`, not `Javascript`
comment on: http://stackoverflow.com/a/26928825
type: AnswerComment

http://stackoverflow.com/comment/42303676
has text: And what is the purpose of this temporary List? Remove that `templist` completely and you have the exact same functionality.
comment on: http://stackoverflow.com/a/26872553
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26906964
has body: How can I make an array given the dimensions introduced by user?? For example, if you introduced 5(the dimensions) inside of that array we need an array of 4 dimensions, inside of it 3 dimensions and etc... Please help!
tagged with: java
has comment: http://stackoverflow.com/comment/42364244
has comment: http://stackoverflow.com/comment/42364669
has comment: http://stackoverflow.com/comment/42364501
has answer: http://stackoverflow.com/a/26907162
accepted answer: http://stackoverflow.com/a/26907245
has comment: http://stackoverflow.com/comment/42364322
tagged with: arrays
has comment: http://stackoverflow.com/comment/42364777
has comment: http://stackoverflow.com/comment/42364330
downvote count: 0
possible better answer: http://stackoverflow.com/a/26907162
type: AnsweredQuestion
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42364557
has title: Multidimensional Array given the dimensions
tagged with: multidimensional-array
type: Question
has comment: http://stackoverflow.com/comment/42364649
answer count: 2
has answer: http://stackoverflow.com/a/26907245
upvote count: 1

http://stackoverflow.com/comment/42435511
comment on: http://stackoverflow.com/a/26945697
type: Comment
score: 1
type: AnswerComment
has text: @Ferenc: You can have jOOQ generate all those POJOs / VOs / DTOs for you: http://www.jooq.org/doc/latest/manual/code-generation/codegen-pojos/

http://stackoverflow.com/a/26980918
type: Answer
has body: As suggested in the comment by Louis, one way to handle it in Java 8 is to simply cast uint64_t to jlong in the C++ side, then use the set of unsigned operation provided by Java 8 such as Long.compareUnsigned() to do the necessary operation: public static int compareUnsigned(long x, long y) Compares two long values numerically treating the values as unsigned. Google Guava's unsigned libraries can also achieve this in case Java 8 is not used.
accepted answer of: http://stackoverflow.com/q/26963813
answers question: http://stackoverflow.com/q/26963813
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42311804
type: QuestionComment
comment on: http://stackoverflow.com/q/26877243
score: 0
has text: In fact, it is mostly because I parse those dates to order the items of a ListView, and I can notice performance issues slowing down the display.
type: Comment

http://stackoverflow.com/comment/42312470
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26877611
has text: Perhaps you are calling this method when there is only one card, and then calling again when there are two cards? Resetting handTotal at the start of this method would solve that problem (and is probably a good idea, given that this method is supposed to calculate the total).
score: 0

http://stackoverflow.com/a/26901904
has comment: http://stackoverflow.com/comment/42356143
answers question: http://stackoverflow.com/q/26901788
upvote count: 1
has body: Serialization is expensive because it needs to analize object's class. Cloning is always faster.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/26902941
upvote count: 0
type: UnansweredQuestion
has body: I need help on using bubble sort and sorting it whether ascending or descending :( int[] number = {12, 5, 6, 14, 18}; int[] number = new int[5]; String[] mark = new String[10]; String evenOrOdd = ""; String output = ""; JTextArea textArea = new JTextArea(12,30); for(int i = 0; i &lt; number.length; i++) { number[i] = Integer.parseInt(JOptionPane.showInputDialog("Enter a number")); if (number[i] % 2 == 0) { evenOrOdd = "even"; } else { evenOrOdd = "odd "; } mark[i] = ""; for(int j = 0; j &lt; number[i]; j++) { mark[i] = mark[i] + "*"; } output = output + number[i] + "\t"; output = output + evenOrOdd + "\t"; output = output + mark[i] + "\n"; } textArea.setText("numbers\ttype\tgraph\n" + output); JOptionPane.showMessageDialog(null, textArea, "OUTPUT", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } } } The code is missing the bubble sorting and I don't where to put it. Can someone please help me? It doesn't need the user to input anything,
tagged with: numbers
has answer: http://stackoverflow.com/a/26903552
tagged with: java
tagged with: descendant
type: Question
score: -2
tagged with: sorting
has comment: http://stackoverflow.com/comment/42357993
has comment: http://stackoverflow.com/comment/42357581
has comment: http://stackoverflow.com/comment/42358016
has comment: http://stackoverflow.com/comment/42359796
downvote count: 2
answer count: 1
has title: How can to code sorting numbers (ascending/descending) via bubble sorting?
favorite count: 0

http://stackoverflow.com/q/26858419
has comment: http://stackoverflow.com/comment/42278198
has comment: http://stackoverflow.com/comment/42278645
favorite count: 0
linked to: http://stackoverflow.com/q/13037654
has comment: http://stackoverflow.com/comment/42278408
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25255811
has comment: http://stackoverflow.com/comment/42278258
has body: can anyone tell how to subtract string "after" from "today" to get days difference. import java.text.*; import java.util.*; public class Main { public static void main(String args[]){ SimpleDateFormat sdf=new SimpleDateFormat("yyyy/MM/dd"); Calendar cal=Calendar.getInstance(); String today=sdf.format(cal.getTime()); System.out.println(today); cal.add(Calendar.DATE, 20); String After=sdf.format(cal.getTime()); System.out.println(After); } }
linked to: http://stackoverflow.com/q/1555262
answer count: 4
has answer: http://stackoverflow.com/a/26858535
has answer: http://stackoverflow.com/a/26858467
has comment: http://stackoverflow.com/comment/42278329
has comment: http://stackoverflow.com/comment/42278550
has answer: http://stackoverflow.com/a/26860648
tagged with: date-difference
tagged with: java
has comment: http://stackoverflow.com/comment/42278274
tagged with: date
linked to: http://stackoverflow.com/q/12851934
has answer: http://stackoverflow.com/a/26858678
has comment: http://stackoverflow.com/comment/42278718
has comment: http://stackoverflow.com/comment/42278430
type: Question
has title: Subtracting dates and get difference in days.How to subtract them?
has comment: http://stackoverflow.com/comment/42278455
has comment: http://stackoverflow.com/comment/42278450
duplicate of: http://stackoverflow.com/q/1555262
has comment: http://stackoverflow.com/comment/42278367
score: 0
upvote count: 1
downvote count: 1

oracle-database
tags question: http://stackoverflow.com/q/26911601
tags question: http://stackoverflow.com/q/26836648
tags question: http://stackoverflow.com/q/26865654
tags question: http://stackoverflow.com/q/26899702
tag name: oracle-database
tags question: http://stackoverflow.com/q/26937144
tags question: http://stackoverflow.com/q/26976704
tags question: http://stackoverflow.com/q/26880655
tags question: http://stackoverflow.com/q/26960325
tags question: http://stackoverflow.com/q/26931194
tags question: http://stackoverflow.com/q/26972869
type: Tag
tags question: http://stackoverflow.com/q/26864627
tags question: http://stackoverflow.com/q/26873970
tags question: http://stackoverflow.com/q/26872164
tags question: http://stackoverflow.com/q/26836197
tags question: http://stackoverflow.com/q/26882021
tags question: http://stackoverflow.com/q/26906102
tags question: http://stackoverflow.com/q/26884486
tags question: http://stackoverflow.com/q/26843500
tags question: http://stackoverflow.com/q/26889015
tags question: http://stackoverflow.com/q/26929148
tags question: http://stackoverflow.com/q/26981796
tags question: http://stackoverflow.com/q/26964702
tags question: http://stackoverflow.com/q/26991296
tags question: http://stackoverflow.com/q/26928563
tags question: http://stackoverflow.com/q/26839207
tags question: http://stackoverflow.com/q/26885040
tags question: http://stackoverflow.com/q/26933727
tags question: http://stackoverflow.com/q/26913374
tags question: http://stackoverflow.com/q/26874630
tags question: http://stackoverflow.com/q/26974559
tags question: http://stackoverflow.com/q/26835548
tags question: http://stackoverflow.com/q/26939050
tags question: http://stackoverflow.com/q/26932038
tags question: http://stackoverflow.com/q/26854151
tags question: http://stackoverflow.com/q/26974366
tags question: http://stackoverflow.com/q/26910840

http://stackoverflow.com/q/26860358
score: 0
has answer: http://stackoverflow.com/a/26860563
tagged with: parsing
has answer: http://stackoverflow.com/a/26860503
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42281477
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2
has title: JSON Object extract value
has body: I have this code that return a response from an API provider in the format of JSON Object. Below is the code: public class Authentication { public static void main(String[] args) { try { URL url = new URL ("https://xxxxx.com"); String encoding = "xxxxxxxxx"; HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("POST"); connection.setDoOutput(true); connection.setRequestProperty ("Authorization", "Basic " + encoding); InputStream content = (InputStream)connection.getInputStream(); BufferedReader in = new BufferedReader (new InputStreamReader (content)); String line; while ((line = in.readLine()) != null) { System.out.println(line); } } catch(Exception e) { e.printStackTrace(); } } } The above code will return a response like this: { "accessToken": "0.AQAAAUmdztB3AAAAAAAEkvg", "tokenType": "Bearer", "expiresIn": 300 } So here is the problem, I'm trying to get the value of accessToken only so that i can use it to make an api call. I've tried this: String loudScreaming = JSONML.toJSONObject("accessToken").getString("accessToken"); But it will return null. I've read about Jackson but don't have any idea on how to do it. Please guide me. Thanks in advance.
tagged with: jackson

http://stackoverflow.com/q/26916239
has comment: http://stackoverflow.com/comment/42381363
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42381585
tagged with: jpa
has comment: http://stackoverflow.com/comment/42381450
has comment: http://stackoverflow.com/comment/42381307
score: 0
has comment: http://stackoverflow.com/comment/42381635
has title: JPA with hibernate provider many-to-many fetch mode
has comment: http://stackoverflow.com/comment/42382103
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42381412
type: Question
has body: I have 2 JPA entities User and Course: @Entity public class User { @Id @GeneratedValue private Integer id; @ManyToMany @JoinTable(name="UserCourse") private Set&lt;Course&gt; courses; // getters and setters } @Entity @Cacheable public class Course { @Id @GeneratedValue private Integer id; // getters and setters } Course is cacheable. hibernate.max_fetch_depth is set to 0. What I need is when I iterate through a user's courses, hibernate should fire a simple SELECT query to fetch courses from join-table UserCourse and load Course entity from L2 cache. But instead, hibernate always seem to be firing a join-query between UserCourse and Course. So the question is - In case of ManyToMany association, is there a way to force hibernate to fire a simple non-join SELECT on join-table and fetch the related cacheable entity from L2 cache?

http://stackoverflow.com/q/26877810
has comment: http://stackoverflow.com/comment/42312725
has body: Solution: Restarting my PC fixed the problem. Apparently Eclipse was getting confused with both: import java.util.Map; import java.util.Map.Entry; Imports are: import java.awt.Color; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Map; import java.util.Map.Entry; import java.util.TreeMap; import javax.activation.DataHandler; import javax.swing.JOptionPane; import javax.swing.JProgressBar; import javax.swing.JTextArea; import dms.model.DATA_FOR_ALL; import dms.model.ReportProblemFile; import dms.model.ReportUserActions; import dms.model.SendEmail; import dms.view.MainFrameWithListeners; My Map is: private TreeMap&lt;Integer,StoreProblem&gt; local_copy_of_store_problems_map = new TreeMap&lt;Integer,StoreProblem&gt;(); I want to understand why my code will iterate through this: (size is 79) for (Map.Entry&lt;Integer, StoreProblem&gt; entry : this.local_copy_of_store_problems_map.entrySet()) { System.out.println("Key: " + entry.getKey() + ". Value: " + entry.getValue()); } But NOT this:(size is 79) for(Entry&lt;Integer, StoreProblem&gt; queue : this.local_copy_of_store_problems_map.entrySet()){ System.out.println("Key: " + queue.getKey() + ". Value: " + queue.getValue()); } In fact, it only printed out key 0... What is the difference here? : for (Map.Entry&lt;Integer, StoreProblem&gt; entry : for(Entry&lt;Integer, StoreProblem&gt; queue :
score: -3
has comment: http://stackoverflow.com/comment/42312962
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42312973
has comment: http://stackoverflow.com/comment/42312935
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42312797
has comment: http://stackoverflow.com/comment/42312867
tagged with: loops
has comment: http://stackoverflow.com/comment/42313068
has comment: http://stackoverflow.com/comment/42312733
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/42312871
has comment: http://stackoverflow.com/comment/42312717
has comment: http://stackoverflow.com/comment/42312798
has answer: http://stackoverflow.com/a/26878127
tagged with: treemap
has comment: http://stackoverflow.com/comment/42312901
has comment: http://stackoverflow.com/comment/42312748
answer count: 2
has answer: http://stackoverflow.com/a/26877937
has comment: http://stackoverflow.com/comment/42312974
has comment: http://stackoverflow.com/comment/42312927
has comment: http://stackoverflow.com/comment/42313046
upvote count: 0
has comment: http://stackoverflow.com/comment/42312830
has comment: http://stackoverflow.com/comment/42312857
has comment: http://stackoverflow.com/comment/42313065
has comment: http://stackoverflow.com/comment/42312823
has title: Java would not Iterate Treemap using Entry inside try block
favorite count: 0
possible better answer: http://stackoverflow.com/a/26877937
has comment: http://stackoverflow.com/comment/42312965
has comment: http://stackoverflow.com/comment/42312843
accepted answer: http://stackoverflow.com/a/26878127

http://stackoverflow.com/a/31891805
has comment: http://stackoverflow.com/comment/129291931
has comment: http://stackoverflow.com/comment/120040288
type: Answer
has comment: http://stackoverflow.com/comment/92783383
has comment: http://stackoverflow.com/comment/136008199
downvote count: 4
has comment: http://stackoverflow.com/comment/77785053
has body: I had this same issue when creating a Spring Boot application using their @SpringBootApplication annotation. This annotation represents @Configuration, @EnableAutoConfiguration and @ComponentScan according to the spring reference. As expected, the new annotation worked properly and my application ran smoothly but, Intellij kept complaining about unfulfilled @Autowire dependencies. As soon as I changed back to using @Configuration, @EnableAutoConfiguration and @ComponentScan separately, the errors ceased. It seems Intellij 14.0.3 (and most likely, earlier versions too) is not yet configured to recognise the @SpringBootApplication annotation. For now, if the errors disturb you that much, then revert back to those three separate annotations. Otherwise, ignore Intellij...your dependency resolution is correctly configured, since your test passes. Always remember... Man is always greater than machine.
has comment: http://stackoverflow.com/comment/112737963
has comment: http://stackoverflow.com/comment/132440697
has comment: http://stackoverflow.com/comment/137420815
has comment: http://stackoverflow.com/comment/134312466
has comment: http://stackoverflow.com/comment/80146388
has comment: http://stackoverflow.com/comment/93462472
score: 303
has comment: http://stackoverflow.com/comment/77786386
has comment: http://stackoverflow.com/comment/134782172
answers question: http://stackoverflow.com/q/26889970
has comment: http://stackoverflow.com/comment/115521576
has comment: http://stackoverflow.com/comment/121189461
has comment: http://stackoverflow.com/comment/127589602
has comment: http://stackoverflow.com/comment/113646039
accepted answer of: http://stackoverflow.com/q/26889970
has comment: http://stackoverflow.com/comment/115071279
type: AcceptedAnswer
upvote count: 307
has comment: http://stackoverflow.com/comment/120324543
has comment: http://stackoverflow.com/comment/92967484
has comment: http://stackoverflow.com/comment/120760033
has comment: http://stackoverflow.com/comment/77032686
has comment: http://stackoverflow.com/comment/77584871
has comment: http://stackoverflow.com/comment/135367125
has comment: http://stackoverflow.com/comment/127129522

http://stackoverflow.com/q/26916598
has comment: http://stackoverflow.com/comment/42381877
has answer: http://stackoverflow.com/a/26937282
has answer: http://stackoverflow.com/a/38411248
has answer: http://stackoverflow.com/a/40302911
has answer: http://stackoverflow.com/a/45355027
has answer: http://stackoverflow.com/a/44898744
tagged with: spring
tagged with: properties
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/44898744
tagged with: annotations
has comment: http://stackoverflow.com/comment/42381994
has answer: http://stackoverflow.com/a/76340782
type: Question
answer count: 8
accepted answer: http://stackoverflow.com/a/26937282
tagged with: java
has answer: http://stackoverflow.com/a/70044733
downvote count: 0
score: 72
favorite count: 0
has title: How to correctly specify a default value in the Spring @Value annotation?
has body: Initially, I have the following spec: @Value("#{props.isFPL}") private boolean isFPL=false; This works fine correctly getting the value from the property file: isFPL = true However, the following expression with default results in the error: @Value("#{props.isFPL:false}") private boolean isFPL=false; Expression parsing failed; nested exception is org.springframework.expression.spel.SpelParseException: EL1041E:(pos 28): After parsing a valid expression, there is still more data in the expression: 'colon(:)' I also tried to use $ instead of #. @Value("${props.isFPL:true}") private boolean isFPL=false; Then the default value in annotation works fine but I did not get the correct value from the Properties file:
upvote count: 72
has answer: http://stackoverflow.com/a/63591277
has comment: http://stackoverflow.com/comment/42382416

http://stackoverflow.com/q/26883688
has answer: http://stackoverflow.com/a/26883934
downvote count: 0
has body: i've little problem with conception how to implement this project , cause i don't know how to send to client/server in one moment video/sound/msg , how to filtrate this stream ? If someone have any idea how to solve this problem i would be thankful. Thanks anyway.
accepted answer: http://stackoverflow.com/a/26883934
answer count: 1
has title: Java - Building communicator what includes video/sound/picture/msg
has comment: http://stackoverflow.com/comment/42323389
favorite count: 0
upvote count: 2
tagged with: sockets
tagged with: multithreading
type: AnsweredQuestion
score: 2
tagged with: video
tagged with: audio
tagged with: java
type: Question

http://stackoverflow.com/comment/42291846
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26866152
has text: Integer[] intlist instead of int[] intlist

http://stackoverflow.com/a/26948399
downvote count: 0
answers question: http://stackoverflow.com/q/26939585
type: Answer
has comment: http://stackoverflow.com/comment/42439209
has comment: http://stackoverflow.com/comment/42438907
has body: I think you will have to add below initbinder inside your controller,which will convert to the required format. @InitBinder public void initBinder(WebDataBinder binder) { CustomDateEditor editor = new CustomDateEditor(new SimpleDateFormat("dd-MMMM-yy"), true); binder.registerCustomEditor(Date.class, editor); } Also use below annotation for date field in Student class. @DateTimeFormat(pattern = "dd-MMMM-yy") private Date dateOfBirth; @DateTimeFormat(pattern = "dd-MMMM-yy") private Date dateOfJoining;
upvote count: 1
has comment: http://stackoverflow.com/comment/42438883
score: 1

http://stackoverflow.com/a/27223071
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/26983709
has body: I had the same problem ones. And I Found that going into the Jar file(s) and opening up the Manifest file, and then removing the Sealed: true line entirely fixed my problem. And just so you know there would be no need to re package or something if you open the jar file with e.g. Winrar and then editing the file while it is in the jar. You probably only need to go into the lwjgl jar files. Hope it works out for you!
accepted answer of: http://stackoverflow.com/q/26983709

http://stackoverflow.com/q/26833662
has answer: http://stackoverflow.com/a/26833724
tagged with: int
downvote count: 4
has comment: http://stackoverflow.com/comment/106051052
has comment: http://stackoverflow.com/comment/42267381
has comment: http://stackoverflow.com/comment/42243060
tagged with: permutation
favorite count: 0
answer count: 4
has answer: http://stackoverflow.com/a/26833700
has body: I have to write a program that gives all permutatioms of a number. For example, the user enters the number 4. I have to return all possible combinations of the numbers 1,2,3,4. I am having an issue with a good method for getting all of the permutations. I have it so my program puts the number 1-n in an array. However, I cannot think of a good way of getting permutation. I know I need to use recursion, but my issue is a way to get the permutations in the first place. I know switching the number around is probably the best way to go, but what is the best method for doing that?
upvote count: 3
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42234043
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26834372
has answer: http://stackoverflow.com/a/26833714
tagged with: algorithm
has title: Algorithm for finding all permutations of a number
score: -1

http://stackoverflow.com/comment/42403497
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26928825
has text: This code would not compile. You need to use the equality operator (==) like this: `if(randomint == lastvariableoffarray)`
type: AnswerComment

http://stackoverflow.com/q/26980788
tagged with: java
tagged with: command-line-interface
has answer: http://stackoverflow.com/a/26981476
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2011664
type: Question
tagged with: arguments
has comment: http://stackoverflow.com/comment/42495769
has body: I'm a noobie to Java and I had some questions, I think they may be easy (duh) answers to you experts but for me, I couldn't figure out the answer. What is the point of Java programs, all I am making in my class now are simple read text files, have user input some stuff on the command line and the program prints out something. Like, it's cool and all that I can make a program do this but what does this all lead up to? Say, I create a java program that converts celcius to fahrenheit and I want to have someone use it. Would I be able to get someone to use it that has no knowledge of Java, that is to say, giving it to my mom and she can run it from her computer without using Eclipse? How do I have someone who has no knowledge of coding run my program? And my last question is, what is the point of command line arguments? Instead of putting them in the arguments, why not just have it in the code itself? Is it because if the code is big, it might be hard to find it? And if I download code that requires argument input, is it possible to download the code with the arguments set in Eclipse or would I have to manually do it? Thanks, sorry for the long paragraph, but just wanted to put my thoughts down.
has answer: http://stackoverflow.com/a/26980972
has answer: http://stackoverflow.com/a/26981399
score: 0
answer count: 3
has title: Java Command Line Arguments - Why?

http://stackoverflow.com/comment/42340248
type: Comment
type: QuestionComment
has text: This doesn't seem to be right. The second screenshot is missing the src folder. I suspect you are working on two entirely different folders.
comment on: http://stackoverflow.com/q/26892404
score: 0

http://stackoverflow.com/a/26975475
downvote count: 0
answers question: http://stackoverflow.com/q/26935862
accepted answer of: http://stackoverflow.com/q/26935862
type: Answer
score: 1
upvote count: 1
has body: You can't write out a set of Geometries and get a DBF file (as there are no attributes to put in it). You need to create a FeatureCollection and then pass that to a ShapeFileDatastore. You will need something like: public boolean writeFeatures( FeatureCollection&lt;SimpleFeatureType, SimpleFeature&gt; features) { if (shpDataStore == null) { throw new IllegalStateException( "Datastore can not be null when writing"); } SimpleFeatureType schema = features.getSchema(); GeometryDescriptor geom = schema .getGeometryDescriptor(); try { /* * Write the features to the shapefile */ Transaction transaction = new DefaultTransaction( "create"); String typeName = shpDataStore.getTypeNames()[0]; SimpleFeatureSource featureSource = shpDataStore .getFeatureSource(typeName); /* * The Shapefile format has a couple limitations: - "the_geom" is always * first, and used for the geometry attribute name - "the_geom" must be of * type Point, MultiPoint, MuiltiLineString, MultiPolygon - Attribute * names are limited in length - Not all data types are supported (example * Timestamp represented as Date) * * Because of this we have to rename the geometry element and then rebuild * the features to make sure that it is the first attribute. */ List&lt;AttributeDescriptor&gt; attributes = schema .getAttributeDescriptors(); GeometryType geomType = null; List&lt;AttributeDescriptor&gt; attribs = new ArrayList&lt;AttributeDescriptor&gt;(); for (AttributeDescriptor attrib : attributes) { AttributeType type = attrib.getType(); if (type instanceof GeometryType) { geomType = (GeometryType) type; } else { attribs.add(attrib); } } GeometryTypeImpl gt = new GeometryTypeImpl( new NameImpl("the_geom"), geomType.getBinding(), geomType.getCoordinateReferenceSystem(), geomType.isIdentified(), geomType.isAbstract(), geomType.getRestrictions(), geomType.getSuper(), geomType.getDescription()); GeometryDescriptor geomDesc = new GeometryDescriptorImpl( gt, new NameImpl("the_geom"), geom.getMinOccurs(), geom.getMaxOccu…
type: AcceptedAnswer

http://stackoverflow.com/q/26856664
has comment: http://stackoverflow.com/comment/42275285
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26856749
tagged with: java
downvote count: 2
tagged with: methods
type: Question
has body: I used this code to calculate the max value and the median element in an array of integers, but when I call the methods in my client class, both of these two methods produce an output of zero. The name of the array is "grades" and it is made of randomly generated integers import java.util.*; public class StudentGrades { private int [] grades; //Constructor public StudentGrades ( int students) { Random number = new Random(); grades = new int[students]; for (int i = 0 ; i &lt; students ; i++) { grades[i] = number.nextInt(99) + 1; } } double median; public void median() { Arrays.sort(grades) ; double median ; if (grades.length % 2 == 0) { int indexA = (grades.length - 1 ) /2; int indexB = (grades.length)/2; median = ((double) (grades[indexA] + grades[indexB]))/2; } else { int medIndex = (grades.length-1) / 2; median = grades[ medIndex ]; } } public double getMedian() { return median; } int max; public int getHighest() { for(int i = 0 ; i &lt; grades.length - 1 ; i++) { int max = 0; if(grades[i] &gt; max) { max = grades[i]; } } return max; } In my driver, I simply had to prove that the method worked correctly, so it's: System.out.println(" The highest grade is" + grades.getHighest()); System.out.println("The median grade is" + grades.getMedian());
has title: Finding the median and max value of an array in java
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/42275366
has comment: http://stackoverflow.com/comment/42275301
tagged with: median
answer count: 1
has comment: http://stackoverflow.com/comment/42275406
favorite count: 0
has answer: http://stackoverflow.com/a/26856749
has comment: http://stackoverflow.com/comment/42275521
score: -2
has comment: http://stackoverflow.com/comment/42275336

http://stackoverflow.com/q/26915025
score: 0
answer count: 3
upvote count: 1
has title: Algorithm to detect and combine overlapping / colliding circles
downvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/26915779
has comment: http://stackoverflow.com/comment/42379196
has answer: http://stackoverflow.com/a/26939911
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42378955
tagged with: 2d
tagged with: java
tagged with: collision-detection
has body: I'm trying to write a time efficient algorithm that can detect a group of overlapping circles and make a single circle in the "middle" of the group that will represent that group. The practical application of this is representing GPS locations over a map, put the conversion in to Cartesian co-ordinates is already handled so that's not relevant, the desired effect is that at different zoom levels clusters of close together points just appear as a single circle (that will have the number of points printed in the centre in the final version) In this example the circles just have a radius of 15 so the distance calculation (Pythagoras) is not being square rooted and compared to 225 for the collision detection. I was trying anything to shave off time, but the problem is this really needs to happen very quickly becasue it's a user facing bit of code that needs to be snappy and good looking. I've given this a go and I it works with small data sets pretty well. 2 big problems, it takes too long and it can run out of memory if all the points are on top of one another. The route I've taken is to calculate distance between each point in a first pass, and then take the shortest distance first and start to combine from there, anything that's been combined becomes ineligible for combination on that pass, and the whole list is passed back around to the distance calculations again until nothing changes. To be honest I think it needs a radical shift in approach and I think it's a little beyond me. I've re factored my code in to one class for ease of posting and generated random points to give an example. package mergepoints; import java.awt.Point; import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; public class Merger { public static void main(String[] args) { Merger m = new Merger(); m.subProcess(m.createRandomList()); } private List&lt;Plottable&gt; createRandomList() { List&lt;Plottable&gt; points = new A…
accepted answer: http://stackoverflow.com/a/26943153
type: Question
has answer: http://stackoverflow.com/a/26915779
has comment: http://stackoverflow.com/comment/42400551
tagged with: algorithm
has answer: http://stackoverflow.com/a/26943153
has comment: http://stackoverflow.com/comment/42379584

http://stackoverflow.com/comment/42507495
type: QuestionComment
comment on: http://stackoverflow.com/q/26987346
score: 0
has text: i have actually added these 3 jar files from android project properties , but seems like program is still not working
type: Comment

http://stackoverflow.com/a/52850937
downvote count: 1
score: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26857487
has body: I deleted the out folder and the problem was solved

http://stackoverflow.com/comment/42326691
has text: I edit my code and verify that the item is not null before returning it. It still crashed on the same issue :nullpointerexception
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26885693

http://stackoverflow.com/a/26888924
downvote count: 0
score: 1
has body: I can't think of any mainstream operating system that records who last modified a file in the file's intrinsic metadata. Certainly, none of the standard FileAttributeView subclasses expose this information. Many operating system provide fine-grained file system audit. If your application had sufficient privilege, it could (in theory) read the audit logs and search for the last change event for the file of interest. However, this would be non-portable, and VERY expensive. I would not view this as a practical solution.
upvote count: 1
answers question: http://stackoverflow.com/q/26888621
type: Answer

http://stackoverflow.com/q/26938642
has answer: http://stackoverflow.com/a/26944878
tagged with: spring-security
answer count: 2
tagged with: playframework
has title: Play Framework with Spring Security?
favorite count: 0
has comment: http://stackoverflow.com/comment/69609266
upvote count: 5
has answer: http://stackoverflow.com/a/31707237
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/69641493
tagged with: spring
downvote count: 0
tagged with: java
type: Question
has body: I'm new to the Play framework and want to implement some authentication for my webapp. I have already some experiences with Spring and Spring Security and want to use this, but I'm not sure if this makes sense, because the Spring Security is mainly for the ServletAPI. Does it makes sense to integrate Play with Spring Security? Thanks. After further searches I have found this post: https://groups.google.com/d/msg/play-framework/K7l6vHa0UUA/MYDlsaIfJEMJ It seems to be possible, but still a lot of Play specific implementations (filter, etc.) have to be done.
score: 5

grails
tags question: http://stackoverflow.com/q/26882311
tags question: http://stackoverflow.com/q/26906151
tags question: http://stackoverflow.com/q/26933458
type: Tag
tags question: http://stackoverflow.com/q/26909765
tags question: http://stackoverflow.com/q/26927167
tags question: http://stackoverflow.com/q/26850635
tags question: http://stackoverflow.com/q/26869265
tags question: http://stackoverflow.com/q/26894640
tags question: http://stackoverflow.com/q/26963433
tags question: http://stackoverflow.com/q/26886292
tag name: grails
tags question: http://stackoverflow.com/q/26858976

http://stackoverflow.com/comment/42333523
comment on: http://stackoverflow.com/q/26889642
score: 0
type: Comment
type: QuestionComment
has text: Where are you calling `createPage0`?

http://stackoverflow.com/comment/42379869
has text: Are you getting any sort of error when you try this on another machine? Can you post it here?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26915518

http://stackoverflow.com/comment/42488848
score: 4
type: QuestionComment
type: Comment
has text: Why are you calling `notify()` *and* `wait()` in a loop? It's quite possible that you want two monitors - one for "there's something to consume" and another for "there's a space to be filled".
comment on: http://stackoverflow.com/q/26977011

http://stackoverflow.com/q/26883002
accepted answer: http://stackoverflow.com/a/26883137
upvote count: 2
tagged with: java
score: -4
type: Question
type: AnsweredQuestion
has title: How can check a Software is instralled is install or not using java
answer count: 1
has answer: http://stackoverflow.com/a/26883137
favorite count: 0
tagged with: system
has body: In java I want to check whether a software is installed or not. If installed, show it. If uninstalled, then install it.
tagged with: windows
tagged with: system-information
downvote count: 6
tagged with: installation

http://stackoverflow.com/q/26960997
has answer: http://stackoverflow.com/a/26961117
upvote count: 18
has comment: http://stackoverflow.com/comment/42460579
answer count: 3
tagged with: bytearrayoutputstream
possible better answer: http://stackoverflow.com/a/26961089
linked to: http://stackoverflow.com/q/1264709
downvote count: 0
tagged with: wave
has answer: http://stackoverflow.com/a/26961089
accepted answer: http://stackoverflow.com/a/26961084
favorite count: 0
has comment: http://stackoverflow.com/comment/42461430
has body: I am trying to convert an OutputStream to a ByteArrayOutput Stream. I was unable to find any clear simple answers on how to do this. This question was asked in the title of the question on StackOverflow, but the body of the question aske how to change a ByteArrayStream to OuputStream. I have an OutputStream that is already created and this example given in the answer will not compile! That Question is Here I have an OutputStream that is already constructed and has a length of 44 bytes called waveHeader. I want to convert that to a ByteArrayOutputStream because I want to be able to change that into a byte[] with waveHeader.ToByteArray() for simplicity in later processes; Is there a simple type of casting or something that will allow this? If not then: Is there a way to construct a pointer to the data in the original OutputStream if it is not possible to convert it? How would someone go about accessing the data that is contained in the OutputStream? I am new to JAVA. This is just a hobby for me. Streams In VisualBasic .net where much easier!
tagged with: outputstream
has title: Convert OutputStream to ByteArrayOutputStream
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42460227
linked to: http://stackoverflow.com/q/5878632
type: Question
has answer: http://stackoverflow.com/a/26961084
has comment: http://stackoverflow.com/comment/42461451
tagged with: java
has comment: http://stackoverflow.com/comment/42460301
score: 18

http://stackoverflow.com/a/26945073
answers question: http://stackoverflow.com/q/26945016
has comment: http://stackoverflow.com/comment/42434320
downvote count: 0
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42434153
has comment: http://stackoverflow.com/comment/42433890
has comment: http://stackoverflow.com/comment/42434476
type: Answer
has body: Just add another input prompt an store it in new variables.Here is the improved code with all changes explained in the comments in the code: import java.util.Scanner; public class BillingSystem { public static void main(String[] args) { // declare variables String name,addr; int pread, cread,tel; //New variables here // input Scanner input = new Scanner (System.in); System.out.println("Enter The Customer Name"); name= input.nextLine(); //Scanner address = new Scanner (System.in); no need for this System.out.println("Address of The Customer"); addr= input.nextLine(); //Scanner telephone = new Scanner (System.in); no need for this System.out.println("Enter telephone number"); tel=input.nextInt(); //get integer input and store it in tel System.out.println("Enter Previous reading"); pread=input.nextInt(); //get integer input and store it in pread System.out.println("Enter Current reading"); cread=input.nextInt(); //get integer input and store it in cread } }
accepted answer of: http://stackoverflow.com/q/26945016
score: 1

http://stackoverflow.com/comment/42323247
has text: When you really need this, the usual approach is to specify `Class<T> clazz` as a method parameter. See `EnumSet`.
type: QuestionComment
comment on: http://stackoverflow.com/q/26883914
score: 1
type: Comment

http://stackoverflow.com/comment/42379464
score: 5
has text: It won't be *just* based on the hashcode. It will also be down to the implementation of `equals`. It sounds like you should be overriding `hashcode` and `equals` in `B` and `C` as well as `A`... and your `equals` method should probably be checking the results of `getClass()`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26915318

http://stackoverflow.com/comment/42435717
comment on: http://stackoverflow.com/q/26941844
score: 1
has text: From the SO guidelines: Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See also: http://stackoverflow.com/help/mcve
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42497786
comment on: http://stackoverflow.com/q/26981232
score: 0
type: QuestionComment
type: Comment
has text: @jtahlborn The FileChannel has a text file attached to it before reading into the bytebuffer

http://stackoverflow.com/comment/42232821
type: Comment
comment on: http://stackoverflow.com/a/26832573
score: 1
has text: Are you using the same java vm version to run jvisualvm and to run your application?
type: AnswerComment

http://stackoverflow.com/comment/42405077
comment on: http://stackoverflow.com/a/26929542
type: AnswerComment
has text: No, what I meant was I don't know how to use this method. Eg: `theTreeView.setSelectionModel(what-parameter-goes-here?);` and how do I call `setSelectedItem`? Thanks in advance.
score: 0
type: Comment

http://stackoverflow.com/comment/42459718
comment on: http://stackoverflow.com/q/26960611
score: 0
has text: @KristyWelsh What do you mean? New to all of this :S
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42529302
type: Comment
has text: This approach works, but is suboptimal; the ideal way to do so is within the Spring framework, if possible. But it's a fine suggestion, thanks for making it.
comment on: http://stackoverflow.com/a/26983082
type: AnswerComment
score: 0

button
tags question: http://stackoverflow.com/q/26972920
tags question: http://stackoverflow.com/q/26923062
tags question: http://stackoverflow.com/q/26900852
tags question: http://stackoverflow.com/q/26854771
tags question: http://stackoverflow.com/q/26873916
tags question: http://stackoverflow.com/q/26880389
tags question: http://stackoverflow.com/q/26945122
tags question: http://stackoverflow.com/q/26873189
type: Tag
tags question: http://stackoverflow.com/q/26982537
tags question: http://stackoverflow.com/q/26850828
tags question: http://stackoverflow.com/q/26891941
tags question: http://stackoverflow.com/q/26991207
tag name: button

http://stackoverflow.com/comment/42510811
score: 1
type: AnswerComment
type: Comment
has text: Is the "_id" always be the primary key on every table?
comment on: http://stackoverflow.com/a/26988857

http://stackoverflow.com/a/26911294
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26909856
score: 3
has comment: http://stackoverflow.com/comment/42372307
has comment: http://stackoverflow.com/comment/84852980
upvote count: 3
type: AcceptedAnswer
has body: You can override the @Override public void propertyChange(PropertyChangeEvent event) { ... extra here super.propertyChange(event); } method of FieldEditorPreferencePage to get the property change events (for all the fields).
has comment: http://stackoverflow.com/comment/84854719
type: Answer
answers question: http://stackoverflow.com/q/26909856

http://stackoverflow.com/a/26979877
has body: Your algorithm has linear time complexity. The recurrence relation is T(n) = 2 * T(n / 2) + O(1), so T(n) = O(n).
accepted answer of: http://stackoverflow.com/q/26979299
has comment: http://stackoverflow.com/comment/42494176
has comment: http://stackoverflow.com/comment/42494335
upvote count: 2
answers question: http://stackoverflow.com/q/26979299
has comment: http://stackoverflow.com/comment/42494297
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/42518017
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26989071
type: Comment
has text: so can you please guide me how can I achieve this condition. (item_id == 1 && name == "John") || (product_id == 234 && vendor !="youtube") && (date >="2014-11-01" && date <="2014-11-18") Inorder to statisfy this type of conditions I am using combination of bool +AND. what will be the reason behind for not to use bool + and combination?.

http://stackoverflow.com/a/26864478
answers question: http://stackoverflow.com/q/26864477
has comment: http://stackoverflow.com/comment/42288594
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42289074
type: Answer
accepted answer of: http://stackoverflow.com/q/26864477
has body: Comparison to check if its equals are not happens with the help of the equals() function. You need to override this method in your custom class. public boolean equals(Object obj) { } Please also make sure you override hashCode() method as well.

http://stackoverflow.com/q/26915409
answer count: 2
has comment: http://stackoverflow.com/comment/42380989
has comment: http://stackoverflow.com/comment/42382360
has comment: http://stackoverflow.com/comment/42384002
has comment: http://stackoverflow.com/comment/42382199
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42384423
type: Question
has answer: http://stackoverflow.com/a/26915538
has title: Hibernate - named query not known
has body: I have a weird problem. I googled many solutions in the internet, but no one was helpful. I have this simple method to get information from my database: SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory(); Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); Query query = session.getNamedQuery("User.findByHash"); query.setString("hash", hash); query.setDate("hash", new Date()); List<?> list = query.list(); User user = (User) list.get(0); session.getTransaction().commit(); And this returns me an error: Exception in thread "main" org.hibernate.MappingException: Named query not known: User.findByHash at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:93) at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1407) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:345) at com.sun.proxy.$Proxy0.getNamedQuery(Unknown Source) at wroproject.UserConnection._getUserByHash(UserConnection.java:44) at wroproject.UserConnection.(UserConnection.java:26) at wroproject.Main.main(Main.java:19) The top of the User.java file looks like this: @Entity @Table(name = "user", catalog = "wroproject", schema = "public") @XmlRootElement @NamedQueries({ @NamedQuery(name = "User.findAll", query = "SELECT u FROM User u"), @NamedQuery(name = "User.findById", query = "SELECT u FROM User u WHERE u.id = :id"), @NamedQuery(name = "User.findByPassword", query = "SELECT u FROM User u WHERE u.password = :password"), @NamedQuery(name = "User.findByHash", query = "SELECT \"user\".* FROM \"user\" LEFT JOIN session on \"user\".id = session.user_id WHERE session…
has answer: http://stackoverflow.com/a/26918328
score: 0

http://stackoverflow.com/q/26959468
type: Question
has title: How can I encapsulate Java into a DLL and then call the DLL from Excel VBA?
tagged with: dll
tagged with: java
accepted answer: http://stackoverflow.com/a/26959639
tagged with: encapsulation
has comment: http://stackoverflow.com/comment/42457831
score: 0
answer count: 1
tagged with: vba
linked to: http://stackoverflow.com/q/14967080
has body: I have a Java program and I need to acess it from Excel VBA. The way I want to do it is encapsulating the java to a DLL so then I can call it from VBA.
has answer: http://stackoverflow.com/a/26959639
type: AnsweredQuestion

multithreading
tags question: http://stackoverflow.com/q/26956009
tags question: http://stackoverflow.com/q/26895301
tags question: http://stackoverflow.com/q/26848719
tags question: http://stackoverflow.com/q/26990125
tags question: http://stackoverflow.com/q/26949611
tags question: http://stackoverflow.com/q/26970658
type: Tag
tags question: http://stackoverflow.com/q/26883688
tags question: http://stackoverflow.com/q/26878530
tags question: http://stackoverflow.com/q/26924747
tags question: http://stackoverflow.com/q/26889183
tags question: http://stackoverflow.com/q/26895123
tags question: http://stackoverflow.com/q/26965272
tags question: http://stackoverflow.com/q/26834078
tags question: http://stackoverflow.com/q/26911988
tags question: http://stackoverflow.com/q/26879384
tags question: http://stackoverflow.com/q/26835040
tags question: http://stackoverflow.com/q/26909528
tags question: http://stackoverflow.com/q/26932614
tags question: http://stackoverflow.com/q/26920606
tags question: http://stackoverflow.com/q/26872164
tags question: http://stackoverflow.com/q/26989470
tags question: http://stackoverflow.com/q/26957369
tags question: http://stackoverflow.com/q/26916392
tags question: http://stackoverflow.com/q/26935052
tags question: http://stackoverflow.com/q/26926588
tags question: http://stackoverflow.com/q/26963361
tags question: http://stackoverflow.com/q/26888513
tags question: http://stackoverflow.com/q/26945435
tags question: http://stackoverflow.com/q/26942576
tags question: http://stackoverflow.com/q/26862359
tags question: http://stackoverflow.com/q/26855424
tags question: http://stackoverflow.com/q/26857574
tags question: http://stackoverflow.com/q/26869265
tags question: http://stackoverflow.com/q/26931780
tags question: http://stackoverflow.com/q/26843287
tags question: http://stackoverflow.com/q/26863896
tags question: http://stackoverflow.com/q/26921142
tags question: http://stackoverflow.com/q/26915949
tags question: http://stackoverflow.com/q/26894831
tags question: http://stackoverflow.com/q/26988763
tags question: http://stackoverflow.com/q/26965788
tags question: http://stackoverflow.com/q/26929298
tags question: http://stackoverflow.com/q/26896316
tags question: http://stackoverflow.com/q/26870035
tags question: http://stackoverflow.com/q/26906523
tags question: http://stackoverflow.com/q/26881522
tags question: http://stackoverflow.com/q/26903853
tags question: http://stackoverflow.com/q/26858611
tags question: http://stackoverflow.com/q/26941294
tags question: http://stackoverflow.com/q/26841972
tags question: http://stackoverflow.com/q/26884604
tags question: http://stackoverflow.com/q/26964831
tags question: http://stackoverflow.com/q/26977011
tags question: http://stackoverflow.com/q/26950919
tags question: http://stackoverflow.com/q/26986783
tags question: http://stackoverflow.com/q/26962793
tags question: http://stackoverflow.com/q/26944700
tags question: http://stackoverflow.com/q/26956514
tags question: http://stackoverflow.com/q/26903688
tags question: http://stackoverflow.com/q/26873398
tags question: http://stackoverflow.com/q/26837507
tags question: http://stackoverflow.com/q/26962244
tags question: http://stackoverflow.com/q/26866470
tags question: http://stackoverflow.com/q/26945773
tags question: http://stackoverflow.com/q/26880660
tags question: http://stackoverflow.com/q/26892717
tags question: http://stackoverflow.com/q/26948519
tags question: http://stackoverflow.com/q/26938758
tags question: http://stackoverflow.com/q/26862195
tags question: http://stackoverflow.com/q/26975976
tags question: http://stackoverflow.com/q/26952986
tags question: http://stackoverflow.com/q/26862502
tags question: http://stackoverflow.com/q/26915079
tags question: http://stackoverflow.com/q/26873495
tags question: http://stackoverflow.com/q/26970827
tags question: http://stackoverflow.com/q/26900387
tags question: http://stackoverflow.com/q/26876347
tags question: http://stackoverflow.com/q/26891861
tags question: http://stackoverflow.com/q/26934461

http://stackoverflow.com/a/26891824
has comment: http://stackoverflow.com/comment/42338246
has body: final MyAdapterInterface ad = new MyAdapterInterface() { @Override public void updateEditText(int value) { EditText myEditText = (EditText)findViewById(R.id.edit1); myEditText.setText(value); } }; shouldn't take place inside your onCreate() method, but somewhere else in the class, as a normal method. And it should be written like that : public void updateEditText(int value) { EditText myEditText = (EditText)findViewById(R.id.edit1); myEditText.setText(value); }
answers question: http://stackoverflow.com/q/26891707
type: Answer
accepted answer of: http://stackoverflow.com/q/26891707
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42337718

http://stackoverflow.com/comment/42253673
type: QuestionComment
comment on: http://stackoverflow.com/q/26844049
score: 0
type: Comment
has text: does it work if you don't go crazy with the max heap flag? E.g. try -Xmx4g ? Maybe the amount of memory required is simply not available.

http://stackoverflow.com/q/26944185
tagged with: textbox
has answer: http://stackoverflow.com/a/26945173
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42431299
tagged with: netbeans
tagged with: numbers
possible better answer: http://stackoverflow.com/a/26944381
tagged with: java
has answer: http://stackoverflow.com/a/26944381
accepted answer: http://stackoverflow.com/a/26945173
has title: input in text field only number in java application
upvote count: 1
has body: DishFormPanelistIdLbl.setText("Panelist ID:"); DishFormPanelistIdTxt.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { DishFormPanelistIdTxtActionPerformed(evt); } }); I have here a text label and text field for ID i want to input only numbers in text how is it possible?been trying the sample program un net beans but they dont have such a solution for this problem any help is appreciated "Update" What i want here is when i type letter nothing will show but when number then it will show
has comment: http://stackoverflow.com/comment/42501014
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/42457863
type: AnswerComment
comment on: http://stackoverflow.com/a/26959556
has text: @KalaJ: "can I still specify the interval/how often it repeats" -- no. `setExact()` is like the old `set()`. It is a one-off event. That's why you have to call it on each event to set up the next event. "does it repeat indefinitely after that like setRepeating?" -- no. That's why you have to call it on each event to set up the next event. "Do I need to do anything else that's special?" -- you have to call it on each event to set up the next event.
type: Comment
score: 3

http://stackoverflow.com/q/26962727
has answer: http://stackoverflow.com/a/26962792
answer count: 3
tagged with: javac
has comment: http://stackoverflow.com/comment/42466781
possible better answer: http://stackoverflow.com/a/26962775
has answer: http://stackoverflow.com/a/26962775
score: 0
tagged with: file
has body: So I have a file tree in Linux that looks like this: ~/keyboard_warriors/ test/ ConfigTest.java ConfigParser.class ConfigParser.java The problem is that when I try to type in Terminal: javac ConfigTest.java I get the error: ConfigTest.java:2: error: package keyboard_warriors does not exist import keyboard_warriors.*; ^ This is really bugging me and I could not find any answers anywhere. If you could solve my problem, I would be a very happy person.
accepted answer: http://stackoverflow.com/a/28888975
type: AnsweredQuestion
tagged with: java
has title: Java error: package 'x' does not exist
has comment: http://stackoverflow.com/comment/42463502
type: Question
tagged with: java-package
has comment: http://stackoverflow.com/comment/42463485
tagged with: directory
has answer: http://stackoverflow.com/a/28888975

http://stackoverflow.com/comment/42268973
type: Comment
score: 0
type: AnswerComment
has text: @user3450277 It works perfectly with `Jane` and `F`. I've just edited my answer to show this.
comment on: http://stackoverflow.com/a/26852736

jsf-2.2
tags question: http://stackoverflow.com/q/26937482
tags question: http://stackoverflow.com/q/26980448
type: Tag
tag name: jsf-2.2

http://stackoverflow.com/comment/42504271
score: 1
has text: Welcome to SO, if you answered it yourself, feel free to post the solution to your own question - it helps build SO into a QA for every programming question.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26985357

http://stackoverflow.com/comment/42495183
score: 0
type: QuestionComment
has text: the textcolor is wrong. it should be black, not yellow. And it should say Hello, not My Text.
type: Comment
comment on: http://stackoverflow.com/q/26976135

http://stackoverflow.com/q/26851452
answer count: 1
tagged with: android
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26851819
accepted answer: http://stackoverflow.com/a/26851819
has title: Trying to have main menu and submenu classes
score: 0
has body: So my original problem was that in my manifest my menu wasent loading ie <action android:name="com.th3ramr0d.learnar670_1.MAINMENU" /> <category android:name="android.intent.category.DEFAULT" /> This was fixed by loading it at startup ie <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> So now my main menu works. However, the buttons inside MainMenu.xml will take you to another .xml file with more buttons. So now I have the same problem. I created another class called SubMenuChapter3 and put it in the manifest as such. <action android:name="com.th3ramr0d.learnar670_1.SUBMENUCHAPTER3" /> <category android:name="android.intent.category.DEFAULT" /> Now this doesnt work I am assuming for the same reason as before with mainmenu. Doesnt crash or give me errors. It just wont open the submenuchapter3 class. I forced the submenuchapter3 class to open by putting startActivity(new Intent("com.th3ramr0d.learnar670_1.SUBMENUCHAPTER3")); directly into the MainMenu class outside of an onclick just to see if it was working. When I do that it opens the chapter_3.xml like it is supposed to and the button works. Thanks for the help.

http://stackoverflow.com/comment/42493927
has text: Ok i solved it by adding my own animations . Removed the built in one
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26970000
type: Comment

http://stackoverflow.com/q/26981537
score: 2
answer count: 0
tagged with: java
type: Question
has body: I am attempting to modify an AD attribute via Java using the Spring framework Here is the error message I am getting: DAP: error code 65 - 0000207D: UpdErr: DSID-0315166D, problem 6002 (OBJ_CLASS_VIOLATION), data 589832 remaining name 'OU=Agents,OU=Customers,DC=zextdstest,DC=local' public void confirmAccount(User user) { Attribute attribute = new BasicAttribute(Constants.USER_ACCOUNT_CONTROL_ATTR, Constants.ACCOUNT_PROPERTIES.toString()); ModificationItem mod = new ModificationItem(DirContext.REPLACE_ATTRIBUTE, attribute); this.ldapTemplate.modifyAttributes(this.getBaseDistinguishedName(user), new ModificationItem[] { mod }); } When I modify other attributes it works fine. Just on this one it fails.
downvote count: 0
tagged with: active-directory
has title: Unable to modify AD attribute via java code in Eclipse / Spring
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/103199433
type: Comment
type: QuestionComment
score: 2
has text: You should change this line `loginValidator = objectMapper.readValue(result.getResponseAsString(), StatusResponses.class);` to `(res, ...)`
comment on: http://stackoverflow.com/q/26925058

http://stackoverflow.com/a/69207069
type: Answer
has body: an alternative :) enum numbers { zero, one, two, three, four, five, six, eight, nine } public static String parseNumbers(String text) { String out = &quot;&quot;; for(String s: text.split(&quot; &quot;)) { out += numbers.valueOf(s).ordinal(); } return out; }
score: 0
answers question: http://stackoverflow.com/q/26948858

http://stackoverflow.com/q/26874254
has comment: http://stackoverflow.com/comment/42307105
has answer: http://stackoverflow.com/a/26874888
has answer: http://stackoverflow.com/a/26874435
tagged with: decimal
tagged with: binary
has body: I wrote a program that convert a binary number to decimal number. When I run the program with some binary number, the program give me the decimal number but with an error message. my code: public class ohad { public static void main(String[] args) { String bin = "10011"; int length = bin.length(); int j = 0; int sum = 0; if (length != 0) { for (int i=0; i &lt; bin.length(); i++){ if (bin.charAt(i) == '0' || bin.charAt(i) == '1'){ for (int t = (length - 1); t &gt;= 0; t--){ String s = bin.charAt(j) + ""; sum = (int)(sum + (Integer.valueOf(s)) * (Math.pow(2, t))); j++; } System.out.println(sum); } else { System.out.println("illegal input."); } } } else { System.out.println("illegal input."); } } } error message: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 5 at java.lang.String.charAt(String.java:646) at ohad.main(ohad.java:15) I think it's something with my j index. What should I do?
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26874306
has title: Binary to decimal, error message
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26874503
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/26874633

http://stackoverflow.com/q/26894640
tagged with: grails
type: Question
score: 0
answer count: 1
has title: Grails @Autowire in Java class not working
tagged with: spring-data-neo4j
has body: I have some Java code that I want to turn into a Bean that can be used within Grails controllers &amp; services via dependency injection. The code is based on that here (which works fine when run as a standalone Java application). Specifically, I have: // WannabeABeanDB.java package hello; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Transaction; import org.neo4j.graphdb.factory.GraphDatabaseFactory; import org.neo4j.kernel.impl.util.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.neo4j.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.config.Neo4jConfiguration; import org.springframework.data.neo4j.core.GraphDatabase; import java.io.File; @Component @Configuration @EnableNeo4jRepositories(basePackages = "hello") public class WannabeABeanDB extends Neo4jConfiguration { public WannabeABeanDB() { setBasePackage("hello"); } @Bean GraphDatabaseService graphDatabaseService() { return new GraphDatabaseFactory().newEmbeddedDatabase("accessingdataneo4j.db"); } @Autowired PersonRepository personRepository; @Autowired GraphDatabase graphDatabase; public String testThatWeCanAccessDatabase() throws Exception { Person greg = new Person("Greg"); Transaction tx = graphDatabase.beginTx(); try { personRepository.save(greg); greg = personRepository.findByName("Greg").toString(); tx.success(); } finally { tx.close(); } return greg.name; } } // Person.java package hello; import java.util.HashSet; import java.util.Set; import org.neo4j.graphdb.Direction; import org.springframework.data.neo4j.annotation.Fetch; import org.springframework.data.neo4j.annotation.GraphId; import org.springframework.data.neo4j.annotation.NodeEntity; import org.springframework.data.neo4j.annotation.RelatedTo; @NodeEntity public class Person { @GraphId Long id; public String name; public Person() {…
tagged with: spring-data
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26897734
accepted answer: http://stackoverflow.com/a/26897734

http://stackoverflow.com/q/26854944
has comment: http://stackoverflow.com/comment/42272232
has comment: http://stackoverflow.com/comment/42272225
has comment: http://stackoverflow.com/comment/42272340
has body: I need to create a zip file on Java; I can use the File file = new File to create a file but how can I out it in a zip without using OutputStream? The code will be running in a place where I can't write anything so the OutputStream approach will not work for me.
downvote count: 3
has comment: http://stackoverflow.com/comment/42272207
answer count: 1
has title: how can I create a zip on java without using outputStream? (I don't want to write files into the computer)
has comment: http://stackoverflow.com/comment/42272634
has comment: http://stackoverflow.com/comment/42272211
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/26855028
upvote count: 0
has comment: http://stackoverflow.com/comment/42272272
tagged with: java
has comment: http://stackoverflow.com/comment/42272499
tagged with: file
type: Question

http://stackoverflow.com/q/26983944
has answer: http://stackoverflow.com/a/26986498
score: 1
tagged with: java
upvote count: 1
type: Question
has body: This code /** * Title: Histogram * * Description: Histogram Drawing Class * * Copyright: Copyright (c) 2009 * * Company: UMB * * @author Bob Wilson * @version 03/04/2011 */ public class Histogram { private int [] values; private int minIndex; private int maxIndex; private int maxLength; /** constructor for histogram drawing class * @param values: the array of integer values to draw * @param minIndex: the lowest index in the array for the range to draw * @param maxIndex: the highest index in the array for the range to draw * @param maxLength: the length of line to draw for the largest value */ public Histogram(int [] values, int minIndex, int maxIndex, int maxLength) { // initialize the values of the instance variables from the constructor parameters this.values = new int [maxIndex + 1]; // allocate memory for a copy of the values array this.minIndex = minIndex; this.maxIndex = maxIndex; this.maxLength = maxLength; // step 6: // find largest number in values array for scaling length of bars int maxValue = values[0]; for ( int a = 1; a < values.length; a++){ if (values[a] > maxValue){ maxValue = values[a]; } } for ( int b = 1; b < values.length; b++) { values [b] = (values [b] * maxLength) / maxValue; } // step 7: // copy data from values array to this.values array while scaling to maximum length of bars System.arraycopy(values,0,this.values,0,values.length); } /** draw a horizontal bar graph */ public void drawHor() { System.out.println(""); // step 8: // draw horizontal bar graph (one line per roll value) for(int n = minIndex; n <= maxIndex; n++) { if (n < 10){ System.out.print("Value " + n + ": "); } else { System.out.print("Value " + n + ": "); } for(int c = 1; c <= this.values[n]; c++) { System.out.print("*"); } System.out.println(" " + this.values[n]); } } /** draw a vertical bar graph */ public void drawVer() { System.out.println(""); // step 9: // draw vertical bar graph (one column per roll value) for(int n = maxLength; n >= 1; n--) { if (n < 10){ System.out.…
downvote count: 0
answer count: 1
tagged with: histogram
has title: Formatting Error when printing vertical histogram in java
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42504716
score: 0
type: AnswerComment
has text: Have you read the assignment? setComplete seems to be a function that should be implemented by you. It sets a task as complete, within the context of your program. That simple.
comment on: http://stackoverflow.com/a/26985412
type: Comment

http://stackoverflow.com/comment/42478186
type: Comment
comment on: http://stackoverflow.com/a/26949084
has text: When you say MQ configuration level is it qmgr init file (mq.ini) or the JMS JNDI bindings configuration? mq.ini works only for MQI (MQ Interface) applications. That's C/C++/COBOL using MQ native calls (like MQCONN, MQOPEN, MQPUT, MQPUT1 etc). JMS JNDI binding configuration file can be generated through JMSAdmin. http://www-01.ibm.com/support/docview.wss?uid=swg21614256
type: AnswerComment
score: 0

http://stackoverflow.com/q/26939140
tagged with: protocol-buffers
has comment: http://stackoverflow.com/comment/42422970
has comment: http://stackoverflow.com/comment/42422985
has comment: http://stackoverflow.com/comment/42423691
has comment: http://stackoverflow.com/comment/42423027
score: 2
has comment: http://stackoverflow.com/comment/42422858
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42422927
tagged with: java
has comment: http://stackoverflow.com/comment/42423113
has answer: http://stackoverflow.com/a/29627222
accepted answer: http://stackoverflow.com/a/29627222
possible better answer: http://stackoverflow.com/a/26939270
type: Question
answer count: 2
downvote count: 4
upvote count: 6
has comment: http://stackoverflow.com/comment/42422759
has comment: http://stackoverflow.com/comment/42423901
has body: i have a file "test.txt" containing multiple protobuf "TestMessage" messages written with testMessage.writeDelimitedTo(the-DataOutputStream-that uses a new FileOutputStream pointing to the file) per line. How do I read each line of test.txt and get back the protobuf per line? With a bufferedreader on a file containing strings, I would do: String strLine; // What is the alternative to String? while ((strLine = br.readLine()) != null) { System.out.println (strLine); TestMessage test = new TestMessage.builder(); test.parseDelimitedFrom(strLine); } What do I set the type to instead of "String" if I were to do this method? is this possible? Or can I not do this and each mressage must be written to a separate file? NOTE: Assume TestMessage is the only message.
has title: How to read multiple protobufs from one file in java?
has comment: http://stackoverflow.com/comment/42423009
has answer: http://stackoverflow.com/a/26939270
favorite count: 0

http://stackoverflow.com/a/26959172
has body: Use Java 8 Paths, Path, Files.readAllLines, and streams (the input is in /tmp/layout.txt): package stackoverflow; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; public class StackOverflow { public static void main(String[] args) throws IOException { Path layout = Paths.get("/tmp", "layout.txt"); List&lt;String&gt; lines = Files.readAllLines(layout); lines.remove(0); // Don't print the first line. lines.stream().forEach(System.out::println); } } If you can't use Java 8, use for (String line : lines) { System.out.println(line); } instead of lines.stream().forEach(System.out::println);
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26958949

http://stackoverflow.com/comment/42441129
type: QuestionComment
score: 2
has text: Post some [code](http://stackoverflow.com/help/mcve)
comment on: http://stackoverflow.com/q/26949880
type: Comment

http://stackoverflow.com/comment/42364492
comment on: http://stackoverflow.com/a/26905248
has text: Which version of Java? Can you try to write a small decompressor which just decompresses the file (without any processing)?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26912934
tagged with: java
has comment: http://stackoverflow.com/comment/42428097
type: Question
has comment: http://stackoverflow.com/comment/42375252
has comment: http://stackoverflow.com/comment/42430041
has comment: http://stackoverflow.com/comment/42447999
score: 0
has body: I've wrote a method in my implementation of my interface that takes a linked list in parameter and has to return an arraylist of all the items that exists already and weren't added to the class list. Here's the signature: public List&lt;T&gt; addBegining(ListeOfEmployees&lt;T&gt; list); My methode add's the elements in the linked list of the class in inverse. Lets say the parameter list: Employee1 Employee2 Employee3 Employee4 Employee5 Actual list in the class: Employee2 Employee4 Employee5 It's suppose to return an ArrayList in the same order of the parameter list: 1-Employee2 2-Employee4 3-Employee5 But it returns an ArrayList like this: 1-Employee5 2-Employee4 3-Employee2 I used a while() to cycle thru my parametered list but it goes from begining to end. I don't know how I can cycle thrue the parameterized list but from the end to the beginning. I cannot use a pointer at the end of the list for this method. I'm out of solutions here. Here's what i've done so far: public List&lt;T&gt; addBegining(ListeOfEmployees&lt;T&gt; list) { List&lt;T&gt; res = null; T return; Iterator&lt;T&gt; it = list.iterator(); while (it.hasNext() &amp;&amp; list != null) { return = it.next(); if (this.hasElement(return)) { if (res == null) { res = new ArrayList&lt;T&gt;(); } res.add(retour); } else { this.addBegining(retour); nbElm++; } } return res; }
has comment: http://stackoverflow.com/comment/42440025
type: UnansweredQuestion
has title: Linked list addBegnining with parameterized list
tagged with: linked-list
answer count: 0

http://stackoverflow.com/comment/42429709
has text: @Haritha_90 do you see the `Caused by...` in the stack trace? Will that help you find the problem?
comment on: http://stackoverflow.com/q/26943195
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42309154
type: QuestionComment
type: Comment
has text: If you have color images too, try to detect circles in HSV H channel. No idea what else to do, didnt find simple thresholds for the iris myself...
comment on: http://stackoverflow.com/q/26867276
score: 0

http://stackoverflow.com/comment/42340181
comment on: http://stackoverflow.com/a/26881624
type: Comment
score: 1
has text: That compatibility is the reason Java 8 introduced default methods for interfaces, which is why [List now has a sort method](https://docs.oracle.com/javase/8/docs/api/java/util/List.html#sort-java.util.Comparator-), which does in fact work on CopyOnWriteArrayLists.
type: AnswerComment

http://stackoverflow.com/a/26880773
type: Answer
answers question: http://stackoverflow.com/q/26880696
has body: the problem is this line: if (numberList[i] != numberList[i+1]) { If i is equals numberList.length the second condition is out of bounds. So you have to change: for (int i = 0; i &lt; numberList.length; i++) { TO: for (int i = 0; i &lt; numberList.length-1; i++) {
score: 0

http://stackoverflow.com/q/26942982
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/29157717
answer count: 1
score: 0
type: UnansweredQuestion
tagged with: maven
has title: Error While Building Hadoop 2.5
tagged with: java
has body: I am currently try to build hadoop 2.5 for windows 7 x64 Plateform. I am following instruction from https://wiki.apache.org/hadoop/Hadoop2OnWindows and have all dependencies mentioned in https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2.5/BUILDING.txt. I am getting a error for Apache Hadoop Common Project while building using following maven command mvn package -Pdist,native-win -DskipTests -Dtar. Following is error [INFO] [INFO] --- exec-maven-plugin:1.2:exec (compile-ms-native-dll) @ hadoop-common --- Build started 15-11-2014 11:08:28. Project "D:\hadoop-2.5.0-src\hadoop-common-project\hadoop-common\src\main\native\native.sln" on node 1 (default targets). ValidateSolutionConfiguration: Building solution configuration "Release|x64". Project "D:\hadoop-2.5.0-src\hadoop-common-project\hadoop-common\src\main\native\native.sln" (1) is building "D:\hadoop-2.5.0-src\hadoop-common-project\hadoop-common\src\main\native\native.vcxproj" (2) on node 1 (default targets). InitializeBuildStatus: Touching "..\..\..\target\native\Release\native.unsuccessfulbuild". ClCompile: C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\CL.exe /c /I..\winutils\include /I..\..\..\target\native\javah /I"C:\Progra~1\Java\jdk1.7.0_51\include" /I"C:\Progra~1\Java\jdk1.7.0_51\include\win32" /I.\src /Zi /nologo /W3 /WX- /O2 /Oi /GL /D WIN32 /D NDEBUG /D _WINDOWS /D _USRDLL /D NATIVE_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"..\..\..\target\native\Release\\" /Fd"..\..\..\target\native\Release\vcWindows7.1SDK.pdb" /Gd /TC /wd4244 /errorReport:queue src\org\apache\hadoop\io\compress\zlib\ZlibCompressor.c src\org\apache\hadoop\io\compress\zlib\ZlibDecompressor.c ZlibCompressor.c d:\hadoop-2.5.0-src\hadoop-common-project\hadoop-common\src\main\native\src\org\apache\hadoop\io\compress\zlib\org_apache_hadoop_io_compress_zlib.h(36): fatal error C1083: Cannot open include file: 'zlib.h': No such file or directory [D:…

http://stackoverflow.com/q/26852141
type: Question
tagged with: http://stackoverflow.com/tag/gif
tagged with: image
tagged with: draw
has comment: http://stackoverflow.com/comment/42267764
has title: Gif Image only playing once. Need it to replay each time
has body: I don't want to post the entire program on here because that would be too much, but I will post snippets of it and detail where they came from so you have an idea. Problem: For my class project, I am making a typical space invaders game. When a missile hits a ship an explosion gif is played. The gif only loops once (not continuous). The when the missile hits the alien craft, the gif plays just fine for the first spaceship. However, when I shoot a missile at the second or third,etc, ship the gif does not play again. I believe that it is just playing the last frame of the gif from what I have researched. Is there a way to either reload the gif image to play each time the missile is hits or is there another way to do this? Here is the link to the image: http://postimg.org/image/v2lljr7cb/ Here is some code: I have a class called Boom, where the explosion is happening. Here is the code in that class: public void draw(Graphics2D g2d) { g2d.drawImage(getEnemyImg(), x, y, null); } public Image getEnemyImg() { ImageIcon ic = new ImageIcon("src/Boom.gif"); return ic.getImage(); } I then have another class called GameFrame where everything happens. In it, there are these lines of code specially for the explosion. Here is the code from this class: static ArrayList&lt;Boom&gt; booms = new ArrayList&lt;Boom&gt;(); public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; ImageIcon ic = new ImageIcon("src/BackGround.jpg"); g2d.drawImage(ic.getImage(), 0, 0, null); player.draw(g2d); for (int i = 0; i &lt; booms.size(); i++) { Boom bm = booms.get(i); bm.draw(g2d); } Enemy e = new Enemy(200, 400); } @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub player.update(); for (int i = 0; i &lt; booms.size(); i++) { Boom bm = booms.get(i); bm.update(); } checkEnd(); repaint(); } public static void addBoom(Boom bm) { booms.add(bm); } public static void removeBoom(Boom bm) { booms.remove(bm); } public static ArrayList&lt;Boom&g…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42271032
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42267826
tagged with: reload

http://stackoverflow.com/q/26897911
tagged with: android
has body: I am trying to add a spinner to my layout via Eclipse. I have added an item in the .xml, but the item is not displaying in the graphical layout. All I get are green arrows. Here is what I'm seeing: Here is the .xml: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.gui_test.MainActivity$PlaceholderFragment" &gt; &lt;ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="400dp" android:layout_centerHorizontal="true" &gt; &lt;/ListView&gt; &lt;Button android:id="@+id/submitButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/listView1" android:layout_below="@+id/listView1" android:layout_marginTop="17dp" android:text="Submit" /&gt; &lt;Button android:id="@+id/refreshButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/submitButton" android:layout_alignBottom="@+id/submitButton" android:layout_alignLeft="@+id/listView1" android:text="Refresh" /&gt; &lt;Spinner android:id="@+id/spinner1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/submitButton" android:layout_alignRight="@+id/refreshButton" android:layout_below="@+id/listView1" android:layout_marginRight="5dp" android:layout_marginLeft="5dp"/&gt; &lt;/RelativeLayout&gt; I want the spinner to sit in between the "Refresh" and "Submit" buttons. How do I do this?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26898476
accepted answer: http://stackoverflow.com/a/26898476
tagged with: eclipse
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/42349851
has title: Android, Eclipse: Item in .xml Layout Not Displaying in Graphical Layout
has comment: http://stackoverflow.com/comment/42349667
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/42278260
type: Comment
type: QuestionComment
score: 0
has text: Could your crudService somehow mess things up? Can you debug what dates actually make it into JPA?
comment on: http://stackoverflow.com/q/26858335

http://stackoverflow.com/a/26943879
has body: If you're trying to make a new AreaCalculator object, you should write new AreaCalculator(myShapes); and you probably want to assign the result to a variable, so you can do more things to it later. AreaCalculator myCalculator = new AreaCalculator(myShapes);
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42430802
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26943866
has comment: http://stackoverflow.com/comment/42430752
has comment: http://stackoverflow.com/comment/42430722
upvote count: 2
answers question: http://stackoverflow.com/q/26943866

mousemotionlistener
type: Tag
tag name: mousemotionlistener
tags question: http://stackoverflow.com/q/26986219

http://stackoverflow.com/a/26952940
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26952751
has body: You need to place the files under src/main/resources to be packaged with the war. See the maven directory structure shown here: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html With a typical web-app with xml file, the xml file and views go under src/main/resources/webapp/WEB-INF folder. See this discussion: What is WEB-INF used for in a Java EE web application?
type: Answer
answers question: http://stackoverflow.com/q/26952751
downvote count: 0
has comment: http://stackoverflow.com/comment/43003256
score: 1

http://stackoverflow.com/a/29415095
upvote count: 2
has body: The problem is fixed in JRebel (I can not reproduce it with the current JRebel 6.1.1) - I guess it is fixed since 6.0.2 (23rd December 2014) Fixed an issue where Spring ResourceHttpRequestHandler could not serve resources outside of webroot. (JRebel Changelog https://zeroturnaround.com/software/jrebel/download/changelog/6-x/) For the one that are interested how they solved it: I can only guess because it is strange. Spring 4.1.6 (that is the version I used for the test) has the class org.springframework.web.servlet.resource.PathResourceResolver has the method checkResource(Resource resource, Resource location): protected boolean checkResource(Resource resource, Resource location) throws IOException { if (isResourceUnderLocation(resource, location)) { return true; } if (getAllowedLocations() != null) { for (Resource current : getAllowedLocations()) { if (isResourceUnderLocation(resource, current)) { return true; } } } return false; } The first if: isResourceUnderLocation... is the method that check whether or not the request is accessing a resource outside the configured resource folder isResourceUnderLocation(Resource resource, Resource location) { ... resourcePath = ((ServletContextResource) resource).getPath(); locationPath = StringUtils.cleanPath(((ServletContextResource) location).getPath()); ... if (!resourcePath.startsWith(locationPath)) { return false; } ... } When I use the debugger to check what is going on, while JRebel is active, then something strange happend: when the JVM hit the line if (isResourceUnderLocation(resource, location)) {, then the method isResourceUnderLocation gets not invoked! So I came to the conclusion that JRebel does some bytecode manipulation to prevent that the check (and the whole isResourceUnderLocation method) gets executed.
score: 2
accepted answer of: http://stackoverflow.com/q/26896900
answers question: http://stackoverflow.com/q/26896900
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42422547
type: AnswerComment
type: Comment
score: 1
has text: It means your callback is null here. You shouldn't define the callback here, you should define it from wherever you call getJSONObj (as I showed as an example in my answer).
comment on: http://stackoverflow.com/a/26938433

http://stackoverflow.com/comment/42454077
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26957240
has text: Post logcat of the stacktrace - if it's closing then you're almost certainly getting an exception somewhere.

http://stackoverflow.com/a/26981777
has body: getInstance() is a static method. You do not need an instance of Calendar to call the method. Static methods do not need instances of the class to call them. The static method creates an instance of a child class and returns it that is why it is possible. Example: //Class has static method print() Class object = new Class(); // I don't need to do this to call print object.print(); //Not needed but acceptable Class.print(); // I can directly call print() from the class without an instance because it is static
type: Answer
answers question: http://stackoverflow.com/q/26981649
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/26913049
score: -1
tagged with: date
type: Question
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android
tagged with: datetime
has title: How to parse Date coming from SQLite DB in java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26913213
downvote count: 1
has body: I am trying to parse date coming from db(2014-06-11 16:58:12.903) like following DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", new Locale("tr-TR")); String tarih = cursor.getString(cursor.getColumnIndex("Created"); tarih = tarih.replace("T", " "); Object.Created = dateFormat.parse(tarih); Also code in below returns "Fri Dec 04 16:58:12 EET 16" DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss", new Locale("tr-TR")); String tarih = cursor.getString(cursor.getColumnIndex(field.getName())); Object.Created = dateFormat.parse(tarih); This method returns me a date like "Wed Jun 11 16:58:12 EEST 2014" How can i get date like dd-MM-YYYY >11-06-2014
tagged with: java

http://stackoverflow.com/q/26954910
has comment: http://stackoverflow.com/comment/42450252
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42449696
has comment: http://stackoverflow.com/comment/42450274
has comment: http://stackoverflow.com/comment/42449746
answer count: 0
tagged with: java
tagged with: bcrypt
has comment: http://stackoverflow.com/comment/42449682
type: Question
has comment: http://stackoverflow.com/comment/42449612
has comment: http://stackoverflow.com/comment/42449661
tagged with: eclipse
score: 0
has title: can not use BCrypt in java Eclipse
tagged with: password-encryption
has body: I want to use bcrypt encryption for user password. I download bcrypt zip file bcrypt 1.1.zip and add it to my project build path in eclipse. Now when I want to use BCrypt in servlet it gives an error BCrypt can not be resolved. I dont know how to overcome this.Please explain me.
tagged with: jbcrypt

http://stackoverflow.com/q/26833468
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/26833491
answer count: 1
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26833491
has comment: http://stackoverflow.com/comment/42233321
has comment: http://stackoverflow.com/comment/42233414
has title: How do I initialize an array in Java?
has body: I am trying to declare an Array of Rectangles in java but I can't figure out how. Here is my code: private Rectangle rectArray[] = new Rectangle[9]; rectArray[0] = new Rectangle(0,0,0,0); I tried commenting out the second line and it works fine, but when I leave the second line in, it has the error: Syntax error on token ";" expected { It's not declaring the Array that's the problem; initializing it is the problem. How can I fix this error?
has comment: http://stackoverflow.com/comment/42233449
type: AnsweredQuestion

infinite-loop
tags question: http://stackoverflow.com/q/26900314
tags question: http://stackoverflow.com/q/26980389
type: Tag
tag name: infinite-loop
tags question: http://stackoverflow.com/q/26963766
tags question: http://stackoverflow.com/q/26979478
tags question: http://stackoverflow.com/q/26950920
tags question: http://stackoverflow.com/q/26956100

http://stackoverflow.com/q/26916323
tagged with: android-studio
upvote count: 3
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/45011745
type: Question
tagged with: java-native-interface
has title: Adding ".so" library to my android studio project
has answer: http://stackoverflow.com/a/28354549
has comment: http://stackoverflow.com/comment/45049861
answer count: 2
has comment: http://stackoverflow.com/comment/43603800
score: 2
has answer: http://stackoverflow.com/a/28371171
has body: I am having issues when i try to add a spatialite database to my android studio projet.I followed this tutorial https://www.gaia-gis.it/fossil/libspatialite/wiki?name=spatialite-android-tutorial , as mentioned i added two folders to my project : the native spatialite libraries: they are places in a folder named libs in my App directory and contains several folders for different platforms that hold the main library, called libspatialite.so the basic API classes, contained in the jsqlite package Despite this ,i am getting this error : 11-13 13:52:17.358 1853-1853/liara.geodatamining W/System.err﹕ Unable to load sqlite_jni: java.lang.UnsatisfiedLinkError: Couldn't load proj from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/liara.geodatamining-2.apk"],nativeLibraryDirectories=[/data/app-lib/liara.geodatamining-2, /system/lib]]]: findLibrary returned null 11-13 13:52:17.358 1853-1853/liara.geodatamining W/dalvikvm﹕ No implementation found for native Ljsqlite/Database;.internal_init:()V 11-13 13:52:17.358 1853-1853/liara.geodatamining W/dalvikvm﹕ Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Ljsqlite/Database; 11-13 13:52:17.358 1853-1853/liara.geodatamining W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2d19b20) 11-13 13:52:17.358 1853-1853/liara.geodatamining E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: liara.geodatamining, PID: 1853 java.lang.UnsatisfiedLinkError: Native method not found: jsqlite.Database.internal_init:()V at jsqlite.Database.internal_init(Native Method) at jsqlite.Database.&lt;clinit&gt;(Database.java:951) at liara.geodatamining.map.onCreate(map.java:116) at android.app.Activity.performCreate(Activity.java:5231) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) at android.app.ActivityThread.acc…
favorite count: 0
has comment: http://stackoverflow.com/comment/45052421
tagged with: spatialite
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/26969812
score: 2
tagged with: java
type: Question
downvote count: 0
has title: Why using of PowerMockRule for bootstrap tests affects tests which use PowerMockRunner for bootstrapping?
has body: I have several tests which are using PowerMockRule to bootstrap to avoid classloading issues, as it is recommended in documentation for PowerMockito: The main difference between the agent based bootstrapper and the classloading based bootstrapper is that you don't run into classloading issues when using XML frameworks etc. It's recommended to use this way of bootstrapping when using PowerMock for integration testing larger parts of a system. In the same package of tests I have tests which are using PowerMockRunner with @RunWith annotation. I have unexpected issue in these tests which looks like this: java.lang.VerifyError: Expecting a stackmap frame at branch target 12 Exception Details: Location: javax/xml/bind/JAXBContext.newInstance([Ljava/lang/Class;Ljava/util/Map;)Ljavax/xml/bind/JAXBContext; @1: ifnonnull Reason: Expected stackmap frame at this location. Bytecode: 0000000: 2ac7 000b bb00 3d59 b700 3ebf 2abe 0464 0000010: 3d1c 9b00 172a 1c32 c700 0bbb 003d 59b7 0000020: 003e bf84 02ff a7ff eb2a 2bb8 0040 b0 Why PowerMockRule affects tests which are using PowerMockRunner? If I remove the tests which are using PowerMockRule then all works fine.
favorite count: 0
answer count: 0
tagged with: powermock
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/26983212
has body: I'm writing a program that's supposed to simulate craps and after, as far as I know, making no major changes, the program appears to have stopped using the user input that I give it. Any idea why? UPDATE: the error only happens when the dice roll does not equal 7 or 11. import java.io.*; import java.util.*; public class Craps { public static void main(String[] args) { int bet=0; int availableMoney=1000; Scanner userInput=new Scanner(System.in); int diceValue=0; int die1=0; int die2=0; int numberTryingFor=0; Random diceNumber=new Random(); boolean isItTheBeginningOfTheRound=true; System.out.println("Welcome to craps!"); System.out.println("You have "+availableMoney+" dollars available."); while(availableMoney&gt;0){ //sets up round System.out.println("Please input a bet."); bet=userInput.nextInt(); die1=1+diceNumber.nextInt(6); die2=1+diceNumber.nextInt(6); diceValue=die1+die2; /*System.out.println(die1); System.out.println(die2); System.out.println(diceValue); System.out.println(availableMoney);*/ if(diceValue==7||diceValue==11&amp;&amp;isItTheBeginningOfTheRound){ availableMoney=availableMoney+bet; System.out.println("Your roll is "+diceValue); System.out.println("You win! You now have "+availableMoney+" dollars available."); }else if(diceValue==2||diceValue==3||diceValue==12&amp;&amp;isItTheBeginningOfTheRound){ availableMoney=availableMoney-bet; System.out.println("Your roll is "+diceValue); System.out.println("You lost. You now have "+availableMoney+" dollars available."); }else{ diceValue = tryForPoint(diceValue, numberTryingFor, diceNumber); if(diceValue==7&amp;&amp;!isItTheBeginningOfTheRound){ availableMoney=availableMoney-bet; System.out.println("Your roll is "+diceValue); System.out.println("Uh Oh! You lost. You now have "+availableMoney+"left."); }else{ availableMoney=availableMoney+bet; System.out.println("Your roll is "+diceValue); System.out.println("You won!You now have "+availableMoney); } } } System.out.println("You are out of money. You lose."); } …
tagged with: java
accepted answer: http://stackoverflow.com/a/26983364
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26983364
score: 0
has title: Unable to get program to use user input
type: AnsweredQuestion

http://stackoverflow.com/q/26920381
tagged with: ebean
has comment: http://stackoverflow.com/comment/42390188
type: AnsweredQuestion
tagged with: playframework-2.3
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42389170
has title: How to generate id's in sequence - Play Framework 2.3.4
has answer: http://stackoverflow.com/a/27040448
accepted answer: http://stackoverflow.com/a/27040448
has body: I have this class: @Entity public class Sale extends Model { // ... @Id @GeneratedValue private Long number; // ... } When I call save on the first sale, its number becomes 1, but when I call save on the second sale, its number becomes 33. How can I make the @Id numbers be generated in a sequence (1, 2, 3, 4, ...)?
type: Question
tagged with: jpa
upvote count: 2
tagged with: playframework
answer count: 1
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42389207

http://stackoverflow.com/comment/42513294
has text: Use the toolTip, Add the text to the toolTip.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26990660

http://stackoverflow.com/q/26979128
linked to: http://stackoverflow.com/q/26327274
has comment: http://stackoverflow.com/comment/42494011
upvote count: 2
has comment: http://stackoverflow.com/comment/42493970
tagged with: spring
type: Question
score: 2
type: AnsweredQuestion
has title: Commit transaction immideatly after method finished
has body: I have the following problem: I'm using Spring MVC 4.0.5 with Hibernate 4.3.5 and I'm trying to create a Restfull Web application. The problem is that I want to exclude some fields from getting serialized as JSON, depending on the method called in the controller using aspects. My problem now is that Hiberate does not commit the transaction immideatly after it returns from a method but just before serializing. Controller.java public class LoginController { /* * Autowire all the Services and stuff.. */ @RemoveAttribues({"fieldA","fieldB"}) @RequestMapping{....} public ResponseEntity login(@RequestBody user) { User updatedUser = userService.loginTheUser(user); return new ResponseEntity<>(updatedUser,HttpStatus.OK); } } Service.java public class UserService { @Transactional public User loginUser(User user) { user.setLoginToken("some generated token"); return userDao.update(user); //userDao just calls entityManager.merge(..) } } The advice of the aspect does the following: for every String find the corresponding setter and set the field to null This is done, like I said, to avoid serialization of data (for which Jackson 2 is used) The problem now is that only after the advice has finished the transaction is commited. Is there anything I can do to tell hibernate to commit immediatly or do I have to dig deeper and start handling the transactions myself (which I would like to avoid)? EDIT: I also have autocommit turned on true I think the problem lies in the fact that I use lazy loading (because each user may have a huge laod of other enities attached to him), so the transaction is not commited until I try to serialze the object.
tagged with: transactions
tagged with: java
tagged with: hibernate
answer count: 1
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/26982499
favorite count: 0
accepted answer: http://stackoverflow.com/a/26982499

http://stackoverflow.com/a/26834182
type: Answer
has body: Here you go! I have used a do-while loop for you to understand the use of that too. You should be easily able to switch it to a while loop if you prefer. Please try and understand the logic here, so you can reproduce it in the future. Assuming you are using Java to learn object-oriented programming, you may want to remove the static keyword from your isEven() method and understand the effect it has. I know you're still learning, but as Mike mentioned, avoid getting into the habit of commenting the way you are here. Write meaningful comments to explain a more high-level view of what you are trying to achieve. (Business value, if you will). Not trying to criticize here, I just hope you find the comments useful :-) Cheers import java.util.Scanner; public class Enter_Input { //create method isEven private static void isEven(int currentNumber) { if (currentNumber % 2 == 0) { System.out.println(currentNumber + " is even\n"); }//end if statement else { System.out.println(currentNumber + " is odd\n"); }// } public static void main(String[] args) { int number = 0; Scanner input = new Scanner(System.in); do { System.out.println("Enter number (-1 to quit): "); number = input.nextInt(); if (number == -1) { break; }//end if statement else { Enter_Input.isEven(number); }//end else statement } while (number &gt; 0); //end do while loop System.out.println("Program Terminated"); }//end main method }//end class
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26833839
answers question: http://stackoverflow.com/q/26833839
has comment: http://stackoverflow.com/comment/42272021
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26988770
answers question: http://stackoverflow.com/q/26988677
accepted answer of: http://stackoverflow.com/q/26988677
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42509939
has body: Using LTRIM(RTRIM()) would eliminate any white spaces. DELETE FROM Samba WHERE LTRIM(RTRIM(DOB)) = '1994-11-18' Hope this helps.
upvote count: 2
type: Answer

http://stackoverflow.com/comment/42402483
comment on: http://stackoverflow.com/q/26926503
score: 0
type: Comment
type: QuestionComment
has text: The whole point of persistence session is to make sure you have *only single* instance of specific entity. So testing locking within one session / transaction is not easy. You probably need to detach the entity at some point.

http://stackoverflow.com/comment/42397528
type: AnswerComment
type: Comment
has text: you do not handle the case where difficulty is not `R.id.radio_easy` or `R.id.radio_medium` or `R.id.radio_hard`
comment on: http://stackoverflow.com/a/26907793
score: 0

http://stackoverflow.com/q/26990618
has answer: http://stackoverflow.com/a/26993692
downvote count: 0
favorite count: 0
tagged with: linux
tagged with: io
has comment: http://stackoverflow.com/comment/42512984
has body: I am creating temporary files in my application using java.io.File.createTempFile(). While creating file, I have called deleteOnExit() for that File object. This code is used in many scenarios in my application. Sometimes, the size of temp files is too large and so I have to delete it immediately after my job is completed. So I am calling File.delete() for some objects. Now the problem is, when I delete the file using delete() function, the reference pointer is open for this deleted file(because of it being temp file(My opinion)). Because of this, I am facing memory leakage issue. (Correct me if I am wrong on my above hypothesis) I am facing high disk utilization on my environment, I found a discrepancy of over 30GB in the output of the 'df' and 'du' command ('df' looks at the stat of the FS itself whereas 'du' ignores deleted file descriptors). If I remove deleteOnExit(), I will have to take care of deleting all the objects manually. Doing this, my pointers are still remaining open(Used lsof +al1 on linux to see open files) Why is this happening? If I remove delete(), then I will have to wait until VM stops to get tempFiles deleted(which is a very rare case in Production Server). (Huge Space Utilization) Is there any Solution on how I can remove file from deleteOnExit() list if I am manually deleting the file?
upvote count: 3
type: UnansweredQuestion
tagged with: java
tagged with: file
has title: File deleteOnExit() function keeps Reference Pointer open even after the file is deleted
type: Question
score: 3
has answer: http://stackoverflow.com/a/26997598
linked to: http://stackoverflow.com/q/26754424
has comment: http://stackoverflow.com/comment/42514684
answer count: 3
has answer: http://stackoverflow.com/a/41744062

http://stackoverflow.com/a/26938855
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26938694
has body: In the the official Java documentation, Float.SIZE is defined as: The number of bits used to represent a float value. Since glVertexAttribPointer() expects the stride and offset arguments in bytes, you will have to divide this by 8, and use (Float.SIZE / 8) instead.
has comment: http://stackoverflow.com/comment/42421919

http://stackoverflow.com/q/26891248
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26891463
accepted answer: http://stackoverflow.com/a/26891463
has answer: http://stackoverflow.com/a/26893675
tagged with: java
has title: Posting/clicking buttons java
score: -1
linked to: http://stackoverflow.com/q/4205980
answer count: 2
has body: i have some basic knowledge of java (made little programs to help everyday life) Now the thing is i want to make a program that posts offers on a site every 2-3 minutes. I have never done anything with java related to the internet and web pages and even after browsing the internet i am clueless. How would i go about setting up a connection to a certain page click a certain button on that page and then fill in 3 boxes with information and post the offer? Here is what i have to click: Here is the form i have to fill in:
favorite count: 0
possible better answer: http://stackoverflow.com/a/26893675
downvote count: 1
upvote count: 0

http://stackoverflow.com/q/26882594
linked to: http://stackoverflow.com/q/13891186
upvote count: 6
has comment: http://stackoverflow.com/comment/42321236
has body: I have a static singleton class that extends my User object: public class TestSingleton extends User{ private static TestSingleton singletonInstance; private TestSingleton() { } public static TestSingleton getObj() { if (singletonInstance == null) { singletonInstance = new TestSingleton(); } return singletonInstance; } } The purpose of the singleton is to avoid create new instance any time i want to use my User object in different activities: TestSingleton test = new TestSingleton(); test.doSomthing(); And to write it on one line and create instance only one time in my app life cycle: TestSingleton.getObj().doSomthing(); My question is: Is this use of static Singleton create memory leak and hold reference to any activity I use the singleton? Is it safe to use? or there is a better solution?
has comment: http://stackoverflow.com/comment/42320912
tagged with: java
has answer: http://stackoverflow.com/a/26882852
has answer: http://stackoverflow.com/a/26882791
answer count: 4
has answer: http://stackoverflow.com/a/26882718
downvote count: 0
has answer: http://stackoverflow.com/a/26882720
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42321085
score: 6
has comment: http://stackoverflow.com/comment/42320940
has comment: http://stackoverflow.com/comment/42321130
has title: Static singleton class memory leak in android
favorite count: 0
type: Question
tagged with: android
tagged with: memory-leaks
has comment: http://stackoverflow.com/comment/42320941
has comment: http://stackoverflow.com/comment/42320963

http://stackoverflow.com/a/26854275
accepted answer of: http://stackoverflow.com/q/26854186
type: Answer
answers question: http://stackoverflow.com/q/26854186
has comment: http://stackoverflow.com/comment/42313430
score: 1
has body: It not not advisable to use the clone method (in case someone suggests that). You are correct that a good way to do it is by providing a copy constructor which takes in an instance to copy. This is what Joshua Bloch recommends in his popular book Effective Java.
type: AcceptedAnswer
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42310172

http://stackoverflow.com/a/26990123
answers question: http://stackoverflow.com/q/26989943
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42511961
has body: For "22 23 29 1 " i.e Integers with a space try following code: String ret="22 23 29 1 "; ret=ret.trim(); String tok[]=ret.split(" "); for(String s:tok) { System.out.println(s); } Output : 22 23 29 1 If you require you can parse string to integer using Integer.parseInt() .
has comment: http://stackoverflow.com/comment/42512050
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26989943
has comment: http://stackoverflow.com/comment/42516597
score: 3
has comment: http://stackoverflow.com/comment/42512101
has comment: http://stackoverflow.com/comment/42518572

http://stackoverflow.com/comment/42305070
type: Comment
type: QuestionComment
has text: Yes, kiruwka, it's correct
comment on: http://stackoverflow.com/q/26873105
score: 0

http://stackoverflow.com/comment/42322163
type: Comment
comment on: http://stackoverflow.com/a/26883290
type: AnswerComment
has text: @Ishkafel there could be 3 kind of class
score: 0

http://stackoverflow.com/a/26900782
accepted answer of: http://stackoverflow.com/q/26900724
answers question: http://stackoverflow.com/q/26900724
type: AcceptedAnswer
type: Answer
has body: Add the Restraunts to a List Group them together (by their type) using a Map Use Collections.shuffle to randomise the List and select the first one Take a look at Collections Trail How to Use Buttons, Check Boxes, and Radio Buttons How to Write an Action Listeners for more details Oh, and you might like to gave a look at How to Use CardLayout
score: 0

http://stackoverflow.com/a/26918596
score: 3
answers question: http://stackoverflow.com/q/26849323
downvote count: 0
has comment: http://stackoverflow.com/comment/49962089
type: Answer
has body: Ok, I figured it out. If someone is looking for the same, here is the process to do it: 1. Generate validation data from PAN: - Get PAN Digits from Start Position to Length, and add Pad characters to the right, until it was 16 digits in length. 2. Encrypt validation data with pdk key using DES, 3DES or AES algorithm. This will generate an encrypted code. 3. Decimalize encrypted code using decimalization table. 4. Convert to Hex String, and get the first n digits (n = pin length). This will generate intermediate Pin. 5. Finally, Modulo Subtract intermediate pin with customer pin. This generates the Offset. Hope this helps. - Thanks!
upvote count: 3

http://stackoverflow.com/q/26859490
answer count: 4
type: UnansweredQuestion
has title: rm -rf doesnt work with home tilde in java runtime
has answer: http://stackoverflow.com/a/26859558
has comment: http://stackoverflow.com/comment/42279880
duplicate of: http://stackoverflow.com/q/7163364
has comment: http://stackoverflow.com/comment/42279857
tagged with: rm
tagged with: java
has answer: http://stackoverflow.com/a/26859644
score: 4
has body: This is my code to delete a folder , this below code wont delete the Downloads directory under home folder. import java.io.IOException; public class tester1{ public static void main(String[] args) throws IOException { System.out.println("here going to delete stuff..!!"); Runtime.getRuntime().exec("rm -rf ~/Downloads/2"); //deleteFile(); System.out.println("Deleted ..!!"); } } However if I give the complete home path, this works : import java.io.IOException; public class tester1{ public static void main(String[] args) throws IOException { System.out.println("here going to delete stuff..!!"); Runtime.getRuntime().exec("rm -rf /home/rah/Downloads/2"); //deleteFile(); System.out.println("Deleted ..!!"); } } Can anybody tell me what am I doing wrong.?
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/26859534
downvote count: 0
has answer: http://stackoverflow.com/a/26859680
favorite count: 0
linked to: http://stackoverflow.com/q/7163364

http://stackoverflow.com/q/26898391
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26899553
type: Question
score: 0
has title: Java program unintentionally requires pressing enter twice
answer count: 1
has comment: http://stackoverflow.com/comment/42350082
tagged with: java
has body: I'm making a simple simulation of a slot machine and after working on it for a while, I've gotten it to work for the most part. The only issue is when I ask the user to enter how much money they would like to bet, the program only proceeds when they press enter twice. I have no idea what's causing this and I feel like it's a really easy fix, so any help possible would be very highly appreciated! Here's the program: import java.util.*; import java.text.DecimalFormat; public class SlotMachineSimulation { public static void main(String[] args) { Random randomN = new Random(); DecimalFormat money = new DecimalFormat("$###,###,###,##0.00"); Scanner kb = new Scanner(System.in); String fruit1 = "abcd"; String fruit2 = "abcd"; String fruit3 = "abcd"; int slot1 = 0; int slot2 = 0; int slot3 = 0; double finalMoney = 0; double factor = 0; String aaa = "y"; while(aaa.equalsIgnoreCase("y")) { System.out.print("Enter the amount you would like to bet: "); int bet = kb.nextInt(); factor = 0; for (int i = 1; i &lt;= 3; i++) { final int maxRandom = 6; int slot = randomN.nextInt(maxRandom); int iteration = i; if(iteration == 1) { slot1 = slot; switch (slot) { case 0: fruit1 = "cherries"; break; case 1: fruit1 = "oranges"; break; case 2: fruit1 = "plums"; break; case 3: fruit1 = "bells"; break; case 4: fruit1 = "melons"; break; case 5: fruit1 = "bars"; break; } } else if(iteration == 2) { slot2 = slot; switch(slot) { case 0: fruit2 = "cherries"; break; case 1: fruit2 = "oranges"; break; case 2: fruit2 = "plums"; break; case 3: fruit2 = "bells"; break; case 4: fruit2 = "melons"; break; case 5: fruit2 = "bars"; break; } } else if(iteration == 3) { slot3 = slot; switch(slot) { case 0: fruit3 = "cherries"; break; case 1: fruit3 = "oranges"; break; case 2: fruit3 = "plums"; break; case 3: fruit3 = "bells"; break; case 4: fruit3 = "melons"; break; case 5: fruit3 = "bars"; break; } System.out.println("-" + fruit1 + "--" + fruit2 + "--" + fruit3 + "-"); if(slot1 == slot2 || slot1 == slot3 || s…
has answer: http://stackoverflow.com/a/26899553

http://stackoverflow.com/comment/42423298
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26939086
has text: I am a beginner in Java CV.Here is what I did. I downloaded the JavaCV 0.9 and Open CV 2.4.9. I extracted both in my C:\\ What are the steps after this?

http://stackoverflow.com/comment/42482314
type: QuestionComment
score: 0
type: Comment
has text: How do I do this? Remembering that I did not instantiate any thread, everything is done by TimerConfig
comment on: http://stackoverflow.com/q/26972945

http://stackoverflow.com/a/27154599
has body: I decided to package the keystore in a jar and access it with JNLP. I wrote a sample program to test it. The code is available on GitHub https://github.com/KiranMohan/corba-javaws-ssl
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/26925353
answers question: http://stackoverflow.com/q/26925353

http://stackoverflow.com/q/26891271
has comment: http://stackoverflow.com/comment/42336561
possible better answer: http://stackoverflow.com/a/26891565
has title: How to place a condition in a different method that compares elements that will decide to do a task or not?
favorite count: 0
has answer: http://stackoverflow.com/a/26893040
has comment: http://stackoverflow.com/comment/42343704
has comment: http://stackoverflow.com/comment/42336666
upvote count: 1
has comment: http://stackoverflow.com/comment/42340245
has comment: http://stackoverflow.com/comment/42340039
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26891565
tagged with: loops
tagged with: methods
type: Question
answer count: 2
tagged with: if-statement
tagged with: arrays
has body: I have an array that consists of numbers that are in an order that is not decided by me. For example: 1,2,3,4,5,6,7,8,9,10 I have written this code in different methods, and I want to add code that would now take pos1 and pos2 and compare them, and only switch position if the statement that pos2 is less than pos1. comparing it through from pos1 to pos2; pos2 to pos3; pos3 to pos4; etc. Code: static void nameSwitch( int[] array, int pos1, int pos2 ) { int temp = array[pos1]; array[pos1] = array[pos2]; array[pos2] = temp; } static void firstNameToLast() { int [] values = {1,2,3,4,5,6,7,8,9,10}; int i; for(i = 0; i &lt; values.length; i+=2) { swap(values, i, i+1); } System.out.println( + Arrays.toString(values)); } static void goingThrough( int[] nums) { //comparing pos1 and pos2, etc area of confusion System.out.println( + Arrays.toString( nums ) ); } after going through the last loop, I want the output to be, 1,2,3,4,5,6,7,8,,9,10 to stay the same, but if i had numbers such as, 2,4,1,6,8,1,3. i want pos1 to be compared to pos2, and if pos2 is less than pos1, then switch there position.
downvote count: 0
has comment: http://stackoverflow.com/comment/42336492
accepted answer: http://stackoverflow.com/a/26893040

http://stackoverflow.com/q/26860654
has comment: http://stackoverflow.com/comment/42282919
score: 0
downvote count: 2
has comment: http://stackoverflow.com/comment/42282452
has comment: http://stackoverflow.com/comment/42283818
accepted answer: http://stackoverflow.com/a/26861786
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42282613
has comment: http://stackoverflow.com/comment/42283188
tagged with: java
tagged with: loops
tagged with: methods
has comment: http://stackoverflow.com/comment/42282941
has comment: http://stackoverflow.com/comment/42281964
has comment: http://stackoverflow.com/comment/42283850
has body: Background Information: I am writing a program where I am supposed to graph a data set, which is stored in the following file (input file), called "names.txt", using the class DrawingPanel. This java file allows you to create a panel of a given size, and draw shapes and lines in this panel. The problems I am encountering with my program are unrelated to the specifications and understandings of the class methods. The data set that I am supposed to graph using this java file is configured in the following way: [name] [gender] [ranking] [ranking] [ranking] [ranking]....etc for a total of 14 rankings. Example: Jane F 98 108 128 116 48 55 47 39 67 202 312 345 436 384 General goal of program: The user is supposed to input the name and gender they would like to see graphed. The data is then graphed, rankings representing the y axis and time representing the x axis. My main problem is drawing the lines that compose the graph. The lines of these graphs are drawn with the method: g.drawLine(x1, y1, x2, y2) with g representing a Graphics object. Two points are necessary as two endpoints are necessary to create a line. This for loop is responsible for printing the lines. for (int j = 0; j &lt; SECTION_WIDTH * DECADES; j += SECTION_WIDTH){ g.setColor(Color.BLACK); g.drawLine(j, yCoordinate, i + intervalIncrease, yCoordinate2); g.setColor(Color.RED); intervalIncrease += SECTION_WIDTH; g.drawString(intervalLabel, intervalIncrease , yCoordinate); } } SUMMARY OF PROBLEM: The for loop above is the cause of the bugs in my program. The problem is the incorrect printing of the lines that compose the graph. This is caused by incorrect for loop iterations and conditions, which are complicated by the awkward location of the for loop and the fact that two calls of everything are necessary to correctly run the program. Despite guessing-and-checking for several hours, I cannot figure out how to manipulate the loops to make it work. It is complicated because the drawString method is dependent …
type: Question
tagged with: for-loop
answer count: 1
tagged with: iteration
favorite count: 0
has title: JAVA: Confusion with correct for-loop iteration?
has comment: http://stackoverflow.com/comment/42281952
has answer: http://stackoverflow.com/a/26861786
has comment: http://stackoverflow.com/comment/42284383
has comment: http://stackoverflow.com/comment/42282433
upvote count: 2

http://stackoverflow.com/comment/42429272
type: QuestionComment
has text: Relating to the first question: You can include them as method calls: http://stackoverflow.com/questions/7554570/how-to-represent-listeners-in-uml-sequence-diagram
score: 0
comment on: http://stackoverflow.com/q/26942372
type: Comment

http://stackoverflow.com/comment/42329108
type: Comment
type: QuestionComment
has text: It's possible that a similarly messy setup has been handled before, but how would that help with your mess? Asking for a generic, configurable solution that can be applied to any mess is hoping for very much (and asking in the wrong forum).
score: 0
comment on: http://stackoverflow.com/q/26885608

http://stackoverflow.com/comment/42344410
score: 0
type: QuestionComment
has text: I am using an applet because the professor requires me too. Also BlueJ is just an IDE to help make coding with Java easier. Do you have any idea why this is going on though? Also I am not sure why it is downvoted, since it is a valid question, and the tags are correct.
comment on: http://stackoverflow.com/q/26895319
type: Comment

http://stackoverflow.com/comment/42395943
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26882825
has text: Edit your question to show how you did that, you may have missed something there

http://stackoverflow.com/comment/42501146
has text: @evarias Look at the my second version, notice the else requires updating `origChars`; and `reverse()` can't take arguments.
comment on: http://stackoverflow.com/a/26983495
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26869974
tagged with: cmake
answer count: 1
has comment: http://stackoverflow.com/comment/42299840
tagged with: java
has comment: http://stackoverflow.com/comment/42299291
tagged with: eclipse
has answer: http://stackoverflow.com/a/26872696
type: UnansweredQuestion
has title: Java with CMake and Eclipse
type: Question
tagged with: c++
has comment: http://stackoverflow.com/comment/42298814
has body: I am trying to use CMake for a Java project on Windows. Generating a Makefile project it already fails with: The C compiler "C:/cygwin/bin/cc.exe" is not able to compile a simple test program. Why does it need the C compiler at all? Do I have to change the default programming language of CMake (if this is even possible)? Is there a better way than generating a Makefile based project for Eclipse? For example if I want to use "add_test" in CMake. Does Eclipse recognize this as Unit Tests?
score: 0

http://stackoverflow.com/comment/42312739
comment on: http://stackoverflow.com/a/26877824
has text: Alright, I don't get that error now, but everything comes out as 0.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/31882623
has body: I have encountered this issue recently, and yes you are right. Picasso is a good library for showing images from sdcard but it has some issues regarding cache if you are fetching images online that is why you see a place holder image while scrolling. I tried different things and the issue was not resolved. There is an alternate library i.e. "AQuery" which is very good for fetching and caching images from network. http://code.google.com/p/android-query/ The main advantages of AQuery/Android Query is that you can clear the cache, no lag while scrolling and quite effective for caching images and not showing place holder images while scrolling. I resolved my issue by removing picaaso and using Aquery. Its just a one line replacement and you are done with your issue. (new AQuery(mContext)).id(exploreViewHolder.getvProfilePic()).image(item.getUserProfilePicUrl().trim(), true, true, device_width, R.drawable.profile_background, aquery.getCachedImage(R.drawable.profile_background),0); Besides you can easily shift from picasso to AQuery as there is no such thing which is available in picasso but not in AQuery and the syntax is almost the same. So I would recommend you to use AQuery, until this is fixed by picasso.
answers question: http://stackoverflow.com/q/26856487
downvote count: 0
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/q/26837506
type: Question
has comment: http://stackoverflow.com/comment/42240281
has comment: http://stackoverflow.com/comment/42240308
score: 0
tagged with: byte
has title: Java byte array - How can I manipulate the next n bits?
tagged with: bit
answer count: 0
type: UnansweredQuestion
has body: I am working on algorithm that manipulates bytes, but not necessarily a value that is divisible by 8. The code puts a number in the first 32 bits that represents the length of a code. It then iterates through a collection which contains sets of numbers and characters. The number is put in the next n bits, represented by the code_length, and the char is put in the following 16 bits. How can I go about manipulating the bits? byte[] result = new byte[numbits/8]; result[0] = (byte) (code_length &gt;&gt; 24); result[1] = (byte) (code_length &gt;&gt; 16); result[2] = (byte) (code_length&gt;&gt; 8); result[3] = (byte) (code_length); while(iterator.hasNext()) { String next = iterator.next(); // The string is {code}:{char}, i.e. 4:c String values = next.split(":"); int code = Interger.parseInt(values[0]); //Put code in the next code_length bits of result //Put values[1] in the next 16 bits of result }
tagged with: java
tagged with: bit-manipulation

http://stackoverflow.com/comment/42289055
has text: It is needed, as I will be posting code online, and can only be read from the one file
type: QuestionComment
comment on: http://stackoverflow.com/q/26864449
score: 0
type: Comment

http://stackoverflow.com/comment/42378291
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26914446
score: 0
has text: "only returns true"? that cannot be what's happening...

http://stackoverflow.com/q/26835040
downvote count: 1
has answer: http://stackoverflow.com/a/26835060
favorite count: 0
has body: After seaching a lot and not finding a concrete answer If I have two threads started: Thread t1 = new Thread(); Thread t2 = new Thread(); t1.start(); t2.start(); After starting the threads I need the main thread to wait for these two thread to finish before printing the final result How can I make the main thread wait for both t1 and t2? A plain wait() would be enough?
answer count: 4
has answer: http://stackoverflow.com/a/26835058
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26835051
accepted answer: http://stackoverflow.com/a/26835051
tagged with: java
tagged with: multithreading
type: Question
has answer: http://stackoverflow.com/a/26835052
has title: Main thread wait for other threads
upvote count: 3
possible better answer: http://stackoverflow.com/a/26835060

http://stackoverflow.com/q/26863738
has answer: http://stackoverflow.com/a/26863967
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42287288
has comment: http://stackoverflow.com/comment/42287844
has comment: http://stackoverflow.com/comment/42287925
has title: Splitting and Parsing formula String
downvote count: 1
has comment: http://stackoverflow.com/comment/42287628
score: 2
tagged with: java
type: Question
has body: I have below formula (Trig01:BAO)/(((Trig01:COUNT*86400)-Trig01:UPI-Trig01:SOS)*2000) I want to split and get output of staring values which are before colon only, Final output need as - { "BAO","COUNT","UPI","SOS" } Thanks in advance,
tagged with: split
has comment: http://stackoverflow.com/comment/42287807
has comment: http://stackoverflow.com/comment/42287165
upvote count: 3
answer count: 3
tagged with: string
has comment: http://stackoverflow.com/comment/42287403
has answer: http://stackoverflow.com/a/26864004
has answer: http://stackoverflow.com/a/26864057
favorite count: 0

http://stackoverflow.com/q/26854068
downvote count: 0
score: 1
tagged with: design-patterns
type: Question
tagged with: java
has body: I am creating my website using spring. I am thinking of implementing a good design pattern for logging data for each page hit. These logs are very crucial for identifying the user pattern etc. There is a set of common parameters that I need to log for each page hit but apart from common parameters, each page have a different parameter to be logged. I am thinking of what design pattern should I implement for achieving this? I thought of using stratergy Pattern but I didn't actually like it much. For eg. parameter A,B,C are common and in addition to these my Search page logs F,G,H Browse page logs I,J,K public interface CommonParameters { void logCommonParameters(String a, String b, String c); } public interface SearPageParameters inherits CommonParameters { void logSearchParameters(String F, String G, String H); } public interface BrowsePageParameters inherits CommonParameters { void logBrowsePageParameters(String I, String J, String K); } public class LogHelper { CommonParameters commonParameters; } But this requires classes to implement BrowsePageParameters so that I can instantiate it in LogHelper. I don't want to create a class for each Page. Any suggestions on what design pattern should I follow for this?
has title: Design pattern for page logging
has answer: http://stackoverflow.com/a/26854112
accepted answer: http://stackoverflow.com/a/26854112
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion

http://stackoverflow.com/q/26986962
answer count: 1
accepted answer: http://stackoverflow.com/a/26997725
has comment: http://stackoverflow.com/comment/42506988
tagged with: apache-poi
has body: I have an excel sheet from where I am reading excel cel values and importing to DB Using Apache POI : if (row.getCell(8) != null) { setActualDeparture(DateUtil.getJavaDate(row.getCell(8).getNumericCellValue())); } The excel sheet has null on Cell 8 , so it should not import anything . but it takes dates like 1899-12-31T00:00:00 What could be the issue ?
tagged with: excel
has comment: http://stackoverflow.com/comment/42507062
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42506965
tagged with: java
has comment: http://stackoverflow.com/comment/42522016
has comment: http://stackoverflow.com/comment/42506954
type: Question
has answer: http://stackoverflow.com/a/26997725
has comment: http://stackoverflow.com/comment/42507044
has comment: http://stackoverflow.com/comment/42506945
has comment: http://stackoverflow.com/comment/42506999
has comment: http://stackoverflow.com/comment/42507074
score: 0
has title: Importing null date from Excel

http://stackoverflow.com/comment/42285839
has text: I didn't know you could specify the type using ```this.<Foo>```. Learned something new today, thanks!
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26861752
type: Comment

http://stackoverflow.com/q/26837386
possible better answer: http://stackoverflow.com/a/26837534
downvote count: 0
has answer: http://stackoverflow.com/a/26837663
answer count: 3
favorite count: 0
has body: I was told to not do the below code and check using &amp;&amp; condition to make sure the resultCode is not one of the following. But I don't understand why this is won't work. It seems like it should. HttpStatus returns an int. The resp.getResultCode() returns a Long. if(!Arrays.asList(HttpStatus.NO_CONTENT.value(), HttpStatus.GONE.value(), HttpStatus.OK.value()) .contains(resp.getResultCode())){ // Do things } Whats wrong with the above? Thanks in advance.
accepted answer: http://stackoverflow.com/a/26837656
has answer: http://stackoverflow.com/a/26837534
upvote count: 2
tagged with: boxing
has title: check if int in list of specified enum values using Arrays.asList
type: AnsweredQuestion
score: 2
tagged with: list
tagged with: enums
has answer: http://stackoverflow.com/a/26837656
tagged with: java
type: Question

tinkerpop
tags question: http://stackoverflow.com/q/26880067
type: Tag
tag name: tinkerpop
tags question: http://stackoverflow.com/q/26841807

http://stackoverflow.com/comment/42351126
score: 0
comment on: http://stackoverflow.com/q/26899106
type: Comment
type: QuestionComment
has text: add some debug statements into your code to verify that the correct code is being called when expected

http://stackoverflow.com/comment/42270486
comment on: http://stackoverflow.com/q/26853969
type: QuestionComment
has text: How about storing the data as a class then accessing the class when you need the data?
score: 0
type: Comment

http://stackoverflow.com/comment/42444955
comment on: http://stackoverflow.com/q/26952158
has text: Are they using Java 1.4? Because autoboxing was added in Java 5.
type: QuestionComment
type: Comment
score: 3

http://stackoverflow.com/q/26858184
type: Question
tagged with: camelcasing
score: 0
has comment: http://stackoverflow.com/comment/42278156
answer count: 1
has body: I got the code to remove the spaces in between the words but cant get it to capitalize beginning of each word. can any find what the problem is. it needs to be in camelcase. Orginal question is - Write a Java program that will read a text file containing unknown lines of strings, turn the whole file into camelCase, and finally save the camelCase into another text file. package p3; import java.io.File; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class CamelCase { public static void main(String[] args) throws IOException { String Str = null; File file = new File("txt.txt"); if(!file.exists()) { System.out.println("The file does not exist."); System.exit(0); } Scanner filescanner = new Scanner(file); while (filescanner.hasNext()) { Str= filescanner.nextLine(); System.out.println(Str); } filescanner.close(); char[] characters = Str.toCharArray(); boolean capitalizeWord = true; for (int i = 0; i &lt; characters.length; i++) { char c = characters[i]; if (Character.isWhitespace(c)) { capitalizeWord = true; } else if (capitalizeWord) { capitalizeWord = false; characters[i] = Character.toUpperCase(c); } String capsandnospace = Str.replaceAll("\\s",""); FileWriter fw = new FileWriter("CamelCase.txt"); PrintWriter pw= new PrintWriter("CamelCase.txt"); pw.println(capsandnospace); pw.close(); }
has answer: http://stackoverflow.com/a/26858256
has title: Convert text file to camel case then save it
tagged with: converters
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/26888203
answers question: http://stackoverflow.com/q/26886387
score: 0
has comment: http://stackoverflow.com/comment/42355818
has body: The first approach leads to recreating the prepared statement for every call, so there is no need for a prepared statement. The second can be precompiled and reused. That's the main difference: Your second approach allows you for reusing the query object and omitt the query parsing. EDITED: Sorry, read too fast. Binding many parameters obviously is more inefficient than binding one.
type: Answer
has comment: http://stackoverflow.com/comment/42369040
has comment: http://stackoverflow.com/comment/42376469

http://stackoverflow.com/q/26889162
has answer: http://stackoverflow.com/a/26892450
accepted answer: http://stackoverflow.com/a/26892450
has title: Gradle custom builds
has body: I have a project with several modules with sources in different folders. I want to put the builds of those independent modules as tasks of the gradle build script. /. /abc/MyTest.java /lib/&lt;empty&gt; /build.gradle build.gradle: apply plugin: "java" dependencies { compile "javax.jms:jms:1.1" } defaultTasks 'compileIt' task compileIt (type: JavaCompile) { source = files("abc/MyTest.java") classpath = files("lib") destinationDir = file('classes') } MyTest.java: package abc; public class MyTest { public static void main(String[] argv) throws javax.jms.JMSException { throw new javax.jms.JMSException("JMS test!"); } } Running gradle I got the following error: C:\Develop\Java\....\MyTest.java:3: error: package javax.jms does not exist public static void main(String[] argv) throws javax.jms.JMSException It seems the dependencies are not used whatsoever. Putting "&lt;&lt;" into the task task compileIt (type: JavaCompile) &lt;&lt; { I got: C:\Develop\Java\.....&gt;gradle :compileIt UP-TO-DATE BUILD SUCCESSFUL Total time: 4.296 secs but nothing is done so far... Where is the problem? Thank you very much!
tagged with: java
has comment: http://stackoverflow.com/comment/42334068
tagged with: gradle
has comment: http://stackoverflow.com/comment/42336033
type: Question
has comment: http://stackoverflow.com/comment/42337286
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42338721
upvote count: 2
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/42371281
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26910554
has text: host is the gmail server i am trying to use both gmail ids

http://stackoverflow.com/a/26833673
score: 0
answers question: http://stackoverflow.com/q/26833587
has body: you can check what Keppil said by looking at the values of car in the debugger
type: Answer

http://stackoverflow.com/comment/42424051
type: Comment
type: QuestionComment
has text: You can do it in both ways, but I think the first option will be easier. Send entire structure in JSON (both state codes and county codes), print only state codes at the main page and then show list of county codes for specific code in an overlay.
score: 0
comment on: http://stackoverflow.com/q/26939576

http://stackoverflow.com/comment/42280034
has text: okey try to replace this instead of that. http ://localhost:8080/xyz/api let me know if it works
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26858630
type: Comment

http://stackoverflow.com/comment/42396747
type: AnswerComment
type: Comment
has text: sir i got it and i used now request.getRequestDispatcher("/AssignProject.jsp").forward(request, response); in this case now its not blank but answer is same using ur suggestion values with array in same row but i found solution my own and I have given here..
comment on: http://stackoverflow.com/a/26924052
score: 0

http://stackoverflow.com/q/26874513
has title: Design pattern for encapsulating custom filter in java
tagged with: java
possible better answer: http://stackoverflow.com/a/26874739
has answer: http://stackoverflow.com/a/26874650
has answer: http://stackoverflow.com/a/26874739
type: AnsweredQuestion
type: Question
has body: I am designing a module, which gets large amount of data in JSON format in a queue. Now a user can provide a filter, and the module should be able to return all the elements which matches with filter condition. The data is in a key value format, in that I dont know the name of the fields beforehand, but its the part of the data itself. Something like this - metrics-list - metrics: [ { key: name, actual-metrics-values: { String : Float } } ] Now I am planning the filter object should have the following sort of structure - Class Filter { String Name; String filterCondition; Metrics[] apply(); } the big problem is how to store the filterCondition, such that I can just apply it over the data set and get the metrics which matches the conditions. An example would be - I get data like this - metrics: [ { key: blah1 actual-metrics-values: { a : 10.0, b : 5.0 } }, { key: blah2 actual-metrics-values: { a : 7.0, b : 3.0 } } ] and the filter is something like- a > 7.0 &amp;&amp; b &lt;= 7.0 which should return blah1 as the only matching metric.
accepted answer: http://stackoverflow.com/a/26874650
has comment: http://stackoverflow.com/comment/42306841
score: 0
answer count: 2
tagged with: design-patterns

http://stackoverflow.com/a/27073979
answers question: http://stackoverflow.com/q/26851468
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The solution was in this answer: https://stackoverflow.com/a/22547808/130228 . Turns out, javac executes ~/Library/Java/Extensions/tools.jar if it finds one. So delete ~/Library/Java/Extensions and you'll be fine. Thanks to https://stackoverflow.com/users/3439760/user3439760 for discovering the answer and to Franco Azabache for finding the link for me.
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26851468

http://stackoverflow.com/comment/42495134
type: QuestionComment
comment on: http://stackoverflow.com/q/26980347
has text: I think that if Collections.sort had tried to use add(int index,E element) it would have given me an error.
type: Comment
score: 0

http://stackoverflow.com/comment/42364772
comment on: http://stackoverflow.com/a/26907068
type: AnswerComment
has text: @RedBaron you can use out.println() for printing in the browser
score: 0
type: Comment

http://stackoverflow.com/comment/42307195
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26873339
type: AnswerComment
has text: I did add an mvce. Check my main post

http://stackoverflow.com/q/26915079
has comment: http://stackoverflow.com/comment/42379428
tagged with: java
possible better answer: http://stackoverflow.com/a/54140147
tagged with: concurrency
has answer: http://stackoverflow.com/a/54140147
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/26920728
downvote count: 0
has body: I have the following code: public class Cache { private final Map map = new ConcurrentHashMap(); public Object get(Object key) { Object value = map.get(key); if (value == null) { value = new SomeObject(); map.put(key, value); } return value; } } My question is: The put and get methods of the map are thread safe, but since the whole block in not synchronized - could multiple threads add a the same key twice?
has title: Cache using ConcurrentHashMap
favorite count: 0
accepted answer: http://stackoverflow.com/a/26915137
answer count: 4
upvote count: 13
has answer: http://stackoverflow.com/a/26916234
tagged with: multithreading
score: 13
tagged with: collections
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26915137

http://stackoverflow.com/q/26894577
favorite count: 0
tagged with: 3-tier
tagged with: n-tier-architecture
upvote count: 2
accepted answer: http://stackoverflow.com/a/26908990
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26898984
tagged with: java
has answer: http://stackoverflow.com/a/26908990
type: Question
has body: I am starting project which will use 3-tier architecture with REST API. I would like to split each layer into separate module, so I definitely need at least 3 modules: REST BLL DAL What is the best approach to make dependencies between them: 1) REST depends on BLL BLL depends on DAL DAL depends on nothing 2) REST depends on nothing BLL depends on REST DAL depends on BLL 3) REST depends on REST-BLL-Interfaces REST-BLL-Interfaces depends on nothing BLL depends on REST-BLL-Interfaces and DAL-BLL-Interfaces DAL-BLL-Interfaces depenends on nothing DAL depends on DAL-BLL-Interfaces Third approach seems to be the most compatible with Dependency Inversion Principle but requires more modules. How would You name those two additional modules?
answer count: 2
has answer: http://stackoverflow.com/a/26898984
has title: How to organize dependencies in 3-tier architecture
downvote count: 0

http://stackoverflow.com/q/26942896
tagged with: android
tagged with: maven
has answer: http://stackoverflow.com/a/27619704
tagged with: android-studio
score: 0
has answer: http://stackoverflow.com/a/26942993
tagged with: java
tagged with: gradle
has body: I've fairly new to android studio. I've been trying to add an external library (Crouton) to my project but when i try to sync, i keep getting this error Error:(30, 0) Plugin with id 'android-maven' not found. This is the build.gradle for the Crouton library buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.13.+' } } apply plugin: 'com.android.library' apply plugin: 'android-maven' apply plugin: 'signing' Thanks for your help.
accepted answer: http://stackoverflow.com/a/26942993
type: AnsweredQuestion
has title: Android Studio Adding External Library (android-maven error)
type: Question
possible better answer: http://stackoverflow.com/a/27619704
answer count: 2

cider
tag name: cider
type: Tag
tags question: http://stackoverflow.com/q/26921923

http://stackoverflow.com/comment/42349154
type: Comment
type: QuestionComment
has text: Are you sure the PCM file is little-endian?
score: 0
comment on: http://stackoverflow.com/q/26886862

http://stackoverflow.com/q/26871255
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/52172099
has title: Inherit from a custom control using fxml
type: Question
tagged with: scenebuilder
upvote count: 3
has body: The project I am working on is using the JavaFx framework, and therefore we are using fxml files and Scene Builder. I have made a custom control for our application following examples I have found on the web, and it works beautifully. However, we are going to have multiple custom controls with common base functionality. I would like to therefore, inherit the base functionality into a custom control. What I am trying to do is to create a custom control that extends a custom root control class. This is what the CustomControl.fxml file looks like: &lt;?import com.custom.CustomRootControl ?&gt; &lt;fx:root type="CustomRootControl" xmlns:fx="http://javafx.com/fxml"&gt; /* Add children here... */ &lt;/fx:root&gt; Right now my CustomRootControl class looks like this: public class CustomRootClass extends Pane { /* Customization to be performed */ } It is skin and bones, and I don't expect to see much in Scene Builder when I open CustomControl.fxml, but the fxml file won't open in Scene Builder. Instead, I get the following error message: java.io.IOException: javafx.fxml.LoadException: &lt;path_to_CustomControl.fxml&gt; ... Caused by: javafx.fxml.LoadException: &lt;path_to_CustomControl.fxml&gt; ... Caused by: java.lang.ClassNotFoundException: com.custom.CustomRootControl at java.lang.ClassLoader.findClass(ClassLoader.java:530) ... Is there a way to do what I am trying to do? And if so, how do I go about doing it?
downvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26871521
accepted answer: http://stackoverflow.com/a/26871521
score: 2
type: AnsweredQuestion
tagged with: fxml

http://stackoverflow.com/q/26905138
possible better answer: http://stackoverflow.com/a/26905180
tagged with: android
has answer: http://stackoverflow.com/a/26920747
has answer: http://stackoverflow.com/a/26905180
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26905367
has body: I have a flow in my application like this: For new users: Splash Screen --> Login Activity --> Home Activity For already registered users: Splash Screen --> Home Activity Basically the Splash Screen has an if else to decide which activity to go to. Once a first time user logs in, his status is saved in a preference variable for the splash screen to decide next time not to open the login activity. Now the situation is that. If a new user logs in and goes to the home activity, and then logs out. He is redirected to the Login screen which is pretty much what should happen. But, in case an existing user opens the app, he is shown the Splash screen and directly moved to the Home Activity. Now if the user logs out, he gets out of the app. This happens because the Login Activity does not have any instance created and thus finishing the Home Activity finishes the whole app. Logout actually finishes the Home Activity, naturally the last active activity should open up. Which is not happening. What I want to do is that, I want to implement a logic which will check that the Login Activity is available or not. If its available then finish() will be called else the Login Activity will be called via intent. Please tell me how to achieve this. P.S: My app uses a custom theme with a customized action bar. If I call finish and Intent together or I use flags to clear existing activities then there is a weird transition effect which shows the black standard action bar for a split second thus creating a bad user experience.
tagged with: java
type: Question
tagged with: activity-lifecycle
has answer: http://stackoverflow.com/a/26905648
score: 0
has answer: http://stackoverflow.com/a/26905367
has title: Check whether an activity is active or not from a different activity
tagged with: android-activity
has answer: http://stackoverflow.com/a/26905506
tagged with: activity-finish
answer count: 5

http://stackoverflow.com/q/26896658
has comment: http://stackoverflow.com/comment/42346768
has title: Illegal Start of Type and ";" Expected
has body: I'm trying to write a program here and I first started off with 23 errors, I managed to get it down to 7 errors but have no idea how to get rid of them at all. The error messages are as follows: Exercise1Lab5.java:58: error: illegal start of type else ^ Exercise1Lab5.java:58: error: ';' expected else ^ Exercise1Lab5.java:59: error: illegal start of type System.out.println("\nYou Are Either Too Old or Too Young!"); ^ Exercise1Lab5.java:59: error: ';' expected System.out.println("\nYou Are Either Too Old or Too Young!"); ^ Exercise1Lab5.java:59: error: invalid method declaration; return type required System.out.println("\nYou Are Either Too Old or Too Young!"); ^ Exercise1Lab5.java:59: error: illegal start of type System.out.println("\nYou Are Either Too Old or Too Young!"); ^ Exercise1Lab5.java:65: error: class, interface, or enum expected } ^ 7 errors My Code Is: /** * @(#)Exercise1Lab5.java * * * @author * @version 1.00 2014/11/3 */ import java.util.Scanner; public class Exercise1Lab5 { public static void main(String[] args) { Scanner input = new Scanner(System.in); float age, height, weight; String genderAns, recordAns, certAns, courseAns; char y, n, m, f; System.out.print("\nPlease Enter Your Age: "); age = input.nextFloat(); if(age&gt;=18 &amp;&amp; age&lt;35){ System.out.print("\nPlease Enter Your Height: "); height = input.nextFloat(); if(height&gt;=1.6){ System.out.print("\nPlease Enter Your Weight In 'KG': "); weight = input.nextFloat(); if(weight&gt;=100){ System.out.print("\nPlease Enter Your Gender &lt;m or f&gt;?: "); genderAns = input.nextLine(); if(((genderAns.equals('m')) &amp;&amp; (weight&lt;100) &amp;&amp; (height&gt;=1.85)) || ((genderAns.equals('f')) &amp;&amp; (weight&lt;100) &amp;&amp; (height&gt;=1.6))){ System.out.print("\nDo You Have A Criminal Record &lt;y or n&gt;?: "); recordAns = input.nextLine(); if(recordAns.equals('n')) System.out.print("\nDid You Receive At Least A D Grade In Pass Irish In The Leaving Cert &lt;y or n&gt;?: "); certAn…
has answer: http://stackoverflow.com/a/26896693
answer count: 2
has comment: http://stackoverflow.com/comment/42346811
has comment: http://stackoverflow.com/comment/42347083
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26896735
has comment: http://stackoverflow.com/comment/42392137
has comment: http://stackoverflow.com/comment/42346714
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42346992
type: Question
tagged with: syntax-error
has comment: http://stackoverflow.com/comment/42346647
tagged with: if-statement

http://stackoverflow.com/q/26959443
has answer: http://stackoverflow.com/a/26959876
accepted answer: http://stackoverflow.com/a/26959876
has comment: http://stackoverflow.com/comment/42457365
has title: static instances vs enums
type: Question
tagged with: enums
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42459166
linked to: http://stackoverflow.com/q/9254637
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26959637
has body: I'm a intermediate java programmer who has run into a conundrum. I'm trying to decide what strategy to use when using fixed in-parameters to certain methods. e.g. I want to do this: void aMethod (int i, Color color) where Color is my own creation. They way I see it, I can either create an enum Color. I know how to do that. I can also do this: public class Color{ public static Color blue = new Color(23, 22, 21); public static Color red = new Color(12, 32 ,10); private int a; private int b; private int c; private Color(int a, int b, int c){ this.a = a; this.b = b; this.c = c; } methods... The thing is, that after trying both I can do exactly the same thing with them. The only difference is that I feel that my class example is more easily understood, I know exactly what it does. Even though I can write a multifunctional enum, I'm not absolutely sure what variables are static, public, private, etc, nor what kind of memory it will use. It's a little messy. So, my question to you is, should I go with classes like the above, instead of enums? Are there some things I don't know that might add to Enums' case?
favorite count: 0
tagged with: static
has answer: http://stackoverflow.com/a/26959763
type: AnsweredQuestion
downvote count: 0
linked to: http://stackoverflow.com/q/9969690
has answer: http://stackoverflow.com/a/26959637

http://stackoverflow.com/comment/42463256
score: 0
comment on: http://stackoverflow.com/a/26879165
type: AnswerComment
type: Comment
has text: Just by declaring it. `Car` extends `MotorVehicle` so you can declare that field straight out. Any properties declared in `MotorVehicle` will carry over to `Car` and can be just used directly. If you declare the field in the subclass `Car` it will replace the properties however. So if you had `int serialNumber` in `MotorVehicle` you have to use `int serialNumber` in `Car` if not declared but if in `Car` you declare `String serialNumber` then you can use strings for any `Car` because it has had the integer requirement written over for just `Car` cases.

r.java-file
tags question: http://stackoverflow.com/q/26888762
type: Tag
tags question: http://stackoverflow.com/q/26937588
tags question: http://stackoverflow.com/q/26876037
tag name: r.java-file
tags question: http://stackoverflow.com/q/26857383

http://stackoverflow.com/comment/42420513
type: Comment
score: 0
type: AnswerComment
has text: @MadProgrammer see description under the image I posted. the red panel, named `square`, must be square and have a circle in the middle. it is contained in `upperPanel` (blue panel), which vertical dimension is 3 times greater than `lowerPanel`'s (green panel).
comment on: http://stackoverflow.com/a/26923195

http://stackoverflow.com/a/26914655
upvote count: 3
answers question: http://stackoverflow.com/q/26914623
downvote count: 0
type: Answer
has body: You have not actually declared anything as in or out. DataInputStream in = DataOutputStream out =
score: 3

http://stackoverflow.com/q/26940080
accepted answer: http://stackoverflow.com/a/28629212
answer count: 3
has title: Will Deployment Rule Sets Allow JNLP To Run Without Signing Jars?
possible better answer: http://stackoverflow.com/a/26951948
has answer: http://stackoverflow.com/a/26951948
upvote count: 1
has answer: http://stackoverflow.com/a/31565774
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/28629212
tagged with: java
has body: When I run my JNLP it keeps failing with "com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: http://......" My JNLP is generated on the fly by a class and ends up looking like this at the top: &lt;jnlp spec="1.0+" codebase="http://myhost.com:8080/webstart" href="jnlp?app=com.mycompany.LaunchWebstart"&gt; I created a very broad ruleset.xml &lt;ruleset version="1.0+"&gt; &lt;rule&gt; &lt;id /&gt; &lt;action permission="run" /&gt; &lt;/rule&gt; &lt;/ruleset&gt; Added it to a jar jar -cf DeploymentRuleSet.jar ruleset.xml Signed it with my company keystore jarsigner DeploymentRuleSet.jar &lt;alias&gt; -keystore &lt;path-to-keystore&gt; -sigfile filesig -storetype &lt;store-type&gt; Then copied it to %SYSTEMROOT%\Sun\Java\Deployment According to the docs I should be able to run without signing my jars so why am I getting this error? permission - Action taken. The following values are valid: run - The following types of RIAs are allowed to run without prompts: Signed with a valid certificate from a trusted certificate authority Signed with an expired certificate Self-signed Unsigned Missing required JAR file manifest attributes There are ~250(!) so I'd rather not be signing them all the time as it slows down my build process considerably. Using JRE version 1.7.0_71-b14.
type: Question
downvote count: 0
tagged with: java-web-start
favorite count: 0
tagged with: security

http://stackoverflow.com/comment/42444762
comment on: http://stackoverflow.com/q/26952057
type: Comment
type: QuestionComment
score: 1
has text: Consider that your code was not written in a cross platform way. For example, have you hard coded any `\r\n`? Also, have you considered that your code may actually have bugs?

http://stackoverflow.com/q/26900282
type: AnsweredQuestion
score: 0
tagged with: maven
tagged with: unit-testing
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42377523
has comment: http://stackoverflow.com/comment/42370591
tagged with: apache-camel
has answer: http://stackoverflow.com/a/26912827
has comment: http://stackoverflow.com/comment/42374911
answer count: 1
has title: Not getting value from the bean in unit test
has comment: http://stackoverflow.com/comment/42374300
has body: I have a camel route that looks like this: &lt;camel:camelContext id="context" xmlns="http://camel.apache.org/schema/spring"&gt; &lt;propertyPlaceholder id="camelContextProperties" location="ref:lefrogen"/&gt; &lt;contextScan/&gt; &lt;template id="producerTemplate"/&gt; &lt;route id="chibzo"&gt; &lt;from uri="activemq:queueName"/&gt; &lt;to uri="seda:internal?multipleConsumers=true"/&gt; &lt;/route&gt; &lt;route id="chon"&gt; &lt;from uri="seda:internal?multipleConsumers=true"/&gt; &lt;bean ref="beanName"/&gt; &lt;to uri="seda:external?multipleConsumers=true"/&gt; &lt;/route&gt; &lt;/camel:camelContext&gt; The bean class is like this: @Component public class BeanName { private final static Logger LOGGER = Logger.getLogger(BeanName.class.getName()); public static String message =null; public static String map(String custom) { message = custom; return custom; } } I have written a unit test case which should call the map method, fetch the data from seda:external, and compare the values of map methos and the seda:external. Right now, I am having a problem where if I execute my test case using mvn test, I have a logger in my test class which prints out the value of the map method. The method is however returning null eventhough I am sending something to the queue. Here's the unit test: public class Test{ @EndpointInject ProducerTemplate producerTemplate; @Autowired BeanName beanName; @Test public void testName() throws Exception { producerTemplate.sendBody("seda:internal","Good bye"); String message = beanName.message; LOGGER.info("Printing" + message); } Can someone tell me why I am getting null ?
tagged with: spring
accepted answer: http://stackoverflow.com/a/26912827

http://stackoverflow.com/q/26855946
tagged with: desktop-application
tagged with: p2p
score: 0
has title: JXTA on internet
answer count: 1
tagged with: jxta
accepted answer: http://stackoverflow.com/a/27632926
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27632926
type: Question
has body: I am developping a JXTA based application in Java with JXSE. It work very well locally, but now i try to get this work on internet. For exemple, i have 2 computers on a local network. They will find each other immediatly, and the application will work. No problem. Now, i have these 2 computers, and 2 others computers on an other local network. As i understand it, i need, for minimum requierement, 2 public RendezVous peer (one on each local network) that will be connected. But i can't find how to deal with it. In my application, i use the setAutoStart method, that's mean the peer will be promoted to a RendezVous peer automatically if needed. So i think, it's impossible for 2 distant peer to discover each other without give then their public adresse. So i need to retrieve a valid tcp adress on a peer and give it to the others. If someone know how to do that, i will be very happy ! Edit: my config //Network setup try { manager = new NetworkManager(NetworkManager.ConfigMode.EDGE, peer_name, conf.toURI()); } catch (IOException e) { //chemin incorrect ? e.printStackTrace(); System.exit(-1); } try { NetworkConfigurator configurator = manager.getConfigurator(); configurator.setTcpPort(port); configurator.setTcpEnabled(true); configurator.setTcpIncoming(true); configurator.setTcpOutgoing(true); configurator.setUseMulticast(true); configurator.setPeerID(peer_id); } catch (IOException e) { // ? Si le dossier a bien été crée pas trop de raison d'avoir cette exception e.printStackTrace(); } // ..... some code ....... /// PeerGroup net_group = manager.startNetwork(); net_group.getRendezVousService().setAutoStart(true); So i would create a addRendezVous(URI uri) or addRendezVous(String uri) that work with net_group.getRendezVousService, but i don't really know how to find the URI or adress .. And my app :

http://stackoverflow.com/comment/42485825
score: 1
comment on: http://stackoverflow.com/q/26973680
type: Comment
type: QuestionComment
has text: I want same functionality in Java. Basically the first code which i have paste above is from Xamarin for Ios. So kindly if u know plx help me out here.

math
tags question: http://stackoverflow.com/q/26944558
tags question: http://stackoverflow.com/q/26852525
type: Tag
tags question: http://stackoverflow.com/q/26975233
tags question: http://stackoverflow.com/q/26847896
tags question: http://stackoverflow.com/q/26948858
tags question: http://stackoverflow.com/q/26925669
tags question: http://stackoverflow.com/q/26956642
tags question: http://stackoverflow.com/q/26895489
tags question: http://stackoverflow.com/q/26917629
tags question: http://stackoverflow.com/q/26837677
tags question: http://stackoverflow.com/q/26900861
tags question: http://stackoverflow.com/q/26885198
tags question: http://stackoverflow.com/q/26934967
tags question: http://stackoverflow.com/q/26933474
tags question: http://stackoverflow.com/q/26934805
tags question: http://stackoverflow.com/q/26876634
tags question: http://stackoverflow.com/q/26891789
tags question: http://stackoverflow.com/q/26970622
tags question: http://stackoverflow.com/q/26848726
tags question: http://stackoverflow.com/q/26880927
tag name: math

http://stackoverflow.com/comment/42238490
type: Comment
type: AnswerComment
has text: in the 2nd for inner loop, your condition is also incorrect, "stars >= (2 * row) - 1" will always evaluate to true if row = 1, no matter what value stars is
comment on: http://stackoverflow.com/a/26836380
score: 0

http://stackoverflow.com/q/26910933
has title: Google Cloud Endpoints on Managed VMs
score: 4
has answer: http://stackoverflow.com/a/27984305
possible better answer: http://stackoverflow.com/a/27947870
upvote count: 4
accepted answer: http://stackoverflow.com/a/27984305
has comment: http://stackoverflow.com/comment/42413531
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/35315447
favorite count: 0
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/42476157
has comment: http://stackoverflow.com/comment/42376083
has answer: http://stackoverflow.com/a/27947870
type: AnsweredQuestion
tagged with: google-cloud-endpoints
linked to: http://stackoverflow.com/q/17706437
tagged with: java
linked to: http://stackoverflow.com/q/33697803
has comment: http://stackoverflow.com/comment/43906464
has comment: http://stackoverflow.com/comment/42379277
type: Question
has body: We had working solution for Cloud Endpoints on standard AppEngine, but recently we switched to Managed VMs https://cloud.google.com/appengine/docs/java/managed-vms/ Everything seems to work the same, except Cloud Endpoints. I have the same results for production Managed VMs and local docker dev environment. Some suspicious lines from gcloud preview app run output: INFO: default: "POST /_ah/spi/BackendService.getApiConfigs HTTP/1.1" 404 29 INFO: default: "GET /_ah/api/discovery/v1/apis/admin/v1/rest?fields=servicePath%2Cresources%2Cparameters%2Cmethods&amp;pp=0 HTTP/1.1" 500 60 I can't find out if Google Cloud Endpoints are supported on Managed VMs at all? And if they are supported what should I do to fix this issue?
linked to: http://stackoverflow.com/q/15047744

http://stackoverflow.com/comment/42253126
type: Comment
type: QuestionComment
has text: I see the others have provided a built-in solution but you could add an onClick to the textviews to make them clickable, as long as your activity implements View.OnClickListener or you add a listener in code. Might be useful to know for other times.
comment on: http://stackoverflow.com/q/26844864
score: 0

http://stackoverflow.com/a/26967933
accepted answer of: http://stackoverflow.com/q/26859717
answers question: http://stackoverflow.com/q/26859717
has body: I added the following dependency in my pom javax.servlet servlet-api 2.5 provided Now I can add the HttpServletRequest parameter to my controller method and use it to retrieve the request. I thought that it would be a part of the spring-webmvc or the spring-web dependency Thanks for the help and guidance
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/a/26859550
has body: Just modified a bit private static void removeElementsFromSecond(Integer[] arr1, Integer[] arr2) { List list1 = Arrays.asList(arr1); Set&lt;Integer&gt; set1 = new LinkedHashSet&lt;Integer&gt;(list1); List list2 = Arrays.asList(arr2); Set&lt;Integer&gt; set2 = new LinkedHashSet&lt;Integer&gt;(list2); set2.removeAll(set1); Iterator itr = set2.iterator(); while (itr.hasNext()) { System.out.println(itr.next()); } } public static void main(String[] args) { Integer[] arr1 = { 1, 2, 3, 4, 5 }; Integer[] arr2 = { 0, 1, 2, 3, 4 }; removeElementsFromSecond(arr1, arr2); } Arrays.asList(arr) will give a list of int[] and not int. Instead you should use Wrapper classes than primitives
answers question: http://stackoverflow.com/q/26859011
score: 0
type: Answer

http://stackoverflow.com/q/26944033
type: Question
has comment: http://stackoverflow.com/comment/42431062
has answer: http://stackoverflow.com/a/26944088
has title: Implementing Random Int in Java
tagged with: int
tagged with: bluej
score: 0
answer count: 2
tagged with: random
has body: I am using Blue J for reference. What I need to do is after defining 2 constants, MIN = 60 and MAX = 180, which I already did, I am supposed to define the processtime as a random integer between 60 and 240, instead of the constant 120. Problem is that I am unsure how to do that. Here is the class, TicketCounter, in which that is supposed to be implemented in. public class TicketCounter { final static int PROCESS = 120; final static int MAX_CASHIERS = 10; final static int NUM_CUSTOMERS = 200; final static int ARR_TIME = 20; final static int MIN = 60; final static int MAX = 180; public static void main ( String[] args) { Customer customer; LinkedQueue&lt;Customer&gt; customerQueue = new LinkedQueue&lt;Customer&gt;(); int[] cashierTime = new int[MAX_CASHIERS]; int totalTime, averageTime, departs; System.out.printf("%-25.30s %-30.30s%n", "Number of Cashiers", "Average Time (in seconds)"); /** process the simulation for various number of cashiers */ for (int cashiers=0; cashiers &lt; MAX_CASHIERS; cashiers++) { /** set each cashiers time to zero initially*/ for (int count=0; count &lt; cashiers; count++) cashierTime[count] = 0; /** load customer queue */ for (int count=1; count &lt;= NUM_CUSTOMERS; count++) customerQueue.enqueue(new Customer(count*ARR_TIME)); totalTime = 0; /** process all customers in the queue */ while (!(customerQueue.isEmpty())) { for (int count=0; count &lt;= cashiers; count++) { if (!(customerQueue.isEmpty())) { customer = customerQueue.dequeue(); if (customer.getArrivalTime() &gt; cashierTime[count]) departs = customer.getArrivalTime() + PROCESS; else departs = cashierTime[count] + PROCESS; customer.setDepartureTime (departs); cashierTime[count] = departs; totalTime += customer.totalTime(); } } } /** output results for this simulation */ averageTime = totalTime / NUM_CUSTOMERS; System.out.printf("%10s %30s%n", (cashiers+1), averageTime); } } } Thank you in advance!
has comment: http://stackoverflow.com/comment/42431073
has comment: http://stackoverflow.com/comment/42431024
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26944076

http://stackoverflow.com/a/26982567
downvote count: 0
has body: When you need to access Activity's Context's method in another class, the easier way to do it is to send the Context as a parameter or directly in the construtor if it's not a static class. You can also send directly the Activity in it, that will let you check Activity.isFinishing() to avoid crashes if the Activity is trying to finish itself.
answers question: http://stackoverflow.com/q/26982184
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/42276070
type: AnswerComment
comment on: http://stackoverflow.com/a/26857027
type: Comment
has text: It's so because objects will be equal only when they reference to the same locations. You just set firstNumber=SecondNumber; ANd then try equating using the answer I mentioned,then you'll come to know why it's so...If you want the other thing,go with the first answer as mentioned to compare the elements of both the objects to equate them!
score: 1

http://stackoverflow.com/q/26847198
linked to: http://stackoverflow.com/q/8777257
score: 0
has comment: http://stackoverflow.com/comment/42257511
tagged with: contains
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/26847625
has comment: http://stackoverflow.com/comment/42257738
has title: contains method for list of array of bytes
has comment: http://stackoverflow.com/comment/42257814
favorite count: 0
has comment: http://stackoverflow.com/comment/42257707
accepted answer: http://stackoverflow.com/a/26847625
type: AnsweredQuestion
has body: so i have a list List&lt;byte[]&gt; lets say "fullList", whereby some other piece of code generates another List containing some byte[] partialList. so i use the .contain method which always fails for searching got byte[] in partialList from the fullList. Why is this?? List&lt;byte[]&gt; fullList = {some byte[] arrays added here..} List&lt;byte[]&gt; partialList = {some byte[] arrays added here..} byte[] toCheck = partialList.get(0); System.out.println("The check is "+ fullList.contains(tocheck));
tagged with: list
upvote count: 2
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42257570
type: Question
has comment: http://stackoverflow.com/comment/42257466

http://stackoverflow.com/q/26904714
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26906762
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26906762
type: AnsweredQuestion
has body: Here is my code: Composite outer = new Composite(parent, SWT.BORDER); outer.setBackground(new Color(null, 207, 255, 206)); // Green FormLayout formLayout = new FormLayout(); formLayout.marginHeight = 5; formLayout.marginWidth = 5; formLayout.spacing = 5; outer.setLayout(formLayout); //TOP Composite Top = new Composite(outer, SWT.BORDER); Top.setLayout(new GridLayout()); Top.setBackground(new Color(null, 232, 223, 255)); // Blue FormData fData = new FormData(); fData.top = new FormAttachment(0); fData.left = new FormAttachment(0); fData.right = new FormAttachment(100); // Locks on 10% of the view fData.bottom = new FormAttachment(20); Top.setLayoutData(fData); //BOTTOM Composite Bottom = new Composite(outer, SWT.BORDER); Bottom.setLayout(fillLayout); Bottom.setBackground(new Color(null, 255, 235, 223)); // Orange fData = new FormData(); fData.top = new FormAttachment(20); fData.left = new FormAttachment(0); fData.right = new FormAttachment(100); fData.bottom = new FormAttachment(100); Bottom.setLayoutData(fData); I just wanted to add widgets for example label images to the right of the "TOP" composite layout. Since i am new to swt, am facing difficulty to align all the label to right of it. How could i achieve this ?
upvote count: 2
score: 1
tagged with: java
tagged with: swt
has title: swt add widgets towards right in formLayout

http://stackoverflow.com/a/26928970
answers question: http://stackoverflow.com/q/26920583
has body: This can be many many things. First of all, check your imports and includes, the wrong name very probably comes from one of them. (Credit goes to Xstian). If it does, consider using the catalog file to fix it. Next, as the error points to two different places in a schema file, so I would also consider a possibility of an error in the schema. What do you have there? Can you show relevant schema fragments? Is it some public schema we could check. This might be a relevant issue. Ok, how would I address this. Disclaimer: I am the author of maven-jaxb2-plugin and also the author/lead dev of the OGC Schemas project which compiles a huge set of GIS schemas. I'd use my own plugin as it fixes a number of XJC issues outputs debug information on schema resolution Put all the schemas in src/main/resources Check all the imports and includes if everything correct In case of problems with schema locations in imports and includes, I'd write a catalog file which fixes/rewrites the invalid references I'd run the compilation with mvn -X clean install and check the log, specificaly the schema resolution part. In case of problems I'd either edit the catalog file, or, as the last measure patch the schemas (sometimes you really have to do this) For patching I'd create a separate "original" copy of schemas and apply a patch using the Maven patch plugin during the build. (Not just simply edit local copies.) I did all of this in the mentioned OGC Schemas Project. An example of how the schema resolution log may look like: REWRITE_SYSTEM: http://www.w3.org maven:org.hisrc.w3c:w3c-schemas:jar::!/w3c resolveSystem(http://schemas.opengis.net/gml/3.2.1/gml.xsd) Resolved system: http://schemas.opengis.net/gml/3.2.1/gml.xsd maven:org.jvnet.ogc:ogc-schemas:jar::!/ogc/gml/3.2.1/gml.xsd [DEBUG] Resolved dependency resource [Dependency {groupId=org.jvnet.ogc, artifactId=ogc-schemas, version=2.0.1-SNAPSHOT, type=jar, classifier=null, resource=ogc/gml/3.2.1/gml.xsd}] to resource URL [jar:file:/C:/Reposito…
score: 0
has comment: http://stackoverflow.com/comment/42416924
type: Answer
has comment: http://stackoverflow.com/comment/42416979
has comment: http://stackoverflow.com/comment/42413734
has comment: http://stackoverflow.com/comment/42415566

http://stackoverflow.com/q/26928554
tagged with: jdo
has title: Google App Engine JDO Issue
tagged with: gwt
tagged with: java
has comment: http://stackoverflow.com/comment/42429631
has comment: http://stackoverflow.com/comment/42417024
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42419852
answer count: 0
type: Question
tagged with: google-app-engine
tagged with: rpc
has body: I am trying to make the following class persistent, but get an UnexpectedException. I have omitted the latter portion of the class. package com.bingehopper.server; import java.util.Date; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.IdentityType; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import com.bingehopper.client.VenueDetails; import com.google.appengine.api.users.User; @PersistenceCapable(identityType = IdentityType.APPLICATION) public class Venue { @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Long id; @Persistent private User user; @Persistent private VenueDetails venue; @Persistent private Date createDate; public Venue() { this.createDate = new Date(); } public Venue(User user, VenueDetails venue) { this(); this.user = user; this.venue = venue; } } Here is the error log: com.google.appengine.tools.development.ApiProxyLocalImpl log SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract void com.bingehopper.client.VenueService.addVenue(com.bingehopper.client.VenueDetails) throws com.bingehopper.client.NotLoggedInException' threw an unexpected exception: java.lang.IllegalArgumentException: venue: com.bingehopper.client.VenueDetails is not a supported property type . VenueDetails is a class I created in my client package. Can I not use a VenueDetails object variable in my Venue class if I would like it to persist? Or is there a way to make it work? I have no prior experience with GWT and am not sure if I am approaching this the right way. Thank you for your help.
score: 0

http://stackoverflow.com/q/26921915
duplicate of: http://stackoverflow.com/q/4945178
tagged with: java
has comment: http://stackoverflow.com/comment/42391625
tagged with: eclipse
type: Question
tagged with: runtime
tagged with: eclipse-plugin
has title: Eclipse will not run, seems like Java issue
score: 0
has comment: http://stackoverflow.com/comment/42397270
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4945178
has body: I go to open Eclipse and it will not run, here is what it gives me, I could not copy and paste it: If it helps, I tried running a .jar that I just made on it, but it did not open and did not give any error message Any help is much appreciated.

http://stackoverflow.com/q/26833188
tagged with: http
type: AnsweredQuestion
has body: I am using this way of sending http get requests at the moment using HttpURLConnection. (http://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/) I was wondering how would I go about not receiving the response from the request or even acknowledge it at all and just needed the request to be fired off as fast as possible how could I achieve this? Thanks.
tagged with: java
accepted answer: http://stackoverflow.com/a/26833407
type: Question
tagged with: apache
downvote count: 0
answer count: 1
favorite count: 0
has title: Sending web request and not waiting for response
tagged with: web
score: 1
has answer: http://stackoverflow.com/a/26833407
upvote count: 1

http://stackoverflow.com/a/26970758
has body: jclouds does not provide a utility method for this but you can roll your own: String marker = null; while (true) { PageSet&lt;StorageMetadata&gt; set = blobStore.list(containerName, new ListContainerOptions().afterMarker(marker); for (StorageMetadata sm : set) { if (sm.getCreateDate() &lt; expiryDate) { blobStore.removeBlob(containerName, sm.getName()); } } marker = set.getNextMarker(); if (marker == null) { break; } }
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26968532
answers question: http://stackoverflow.com/q/26968532
type: Answer

http://stackoverflow.com/a/26950682
downvote count: 0
answers question: http://stackoverflow.com/q/26948430
type: Answer
accepted answer of: http://stackoverflow.com/q/26948430
upvote count: 1
has body: I would like to create a DatabaseAccessService interface and implement it. Something like this @Service public class DatabaseAccessServiceImpl implements DatabaseAccessService { @Autowired private RestTemplate restTemplate; public void storeData(Data data){ ... restTemplate.postForObject(...) ... } } From my point of view DAO's should only be used accessing to database via JDBC, JPA, etc. and not service call like REST or SOAP based WebServices.
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/42271644
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26854645
score: 5
has text: [whats the difference between `equals` and `==`](http://stackoverflow.com/questions/1643067/whats-the-difference-between-equals-and), [Difference between string object and string literal](http://stackoverflow.com/questions/3297867/difference-between-string-object-and-string-literal)

http://stackoverflow.com/q/26886860
has title: Opening a new window via my extension
type: UnansweredQuestion
has body: I am writing an extension that needs to open a page in a new popup window. However, whenever I try to open a window, the browser's popup blocker prevents the window from opening. I have the following code in my extension.js appAPI.ready(function($) { var win = window.open("http://google.com", "", "width=200, height=100"); });
has answer: http://stackoverflow.com/a/26906369
type: Question
tagged with: popupwindow
tagged with: crossrider
tagged with: cross-browser
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/26989398
has comment: http://stackoverflow.com/comment/42518698
answer count: 2
has comment: http://stackoverflow.com/comment/42519023
tagged with: jcheckbox
has answer: http://stackoverflow.com/a/26990841
possible better answer: http://stackoverflow.com/a/26989660
downvote count: 0
has body: I'm currently doing a form which involves text fields and checkboxes. I already linked the check box to the text field, which if the check box is SELECTED, the text field is enabled; while check box is DESELECTED, text field is disabled. My problem now is if users selects the check box and type some value into the text field and then deselect the check box again, my program would still read the input from the disabled text field. Is there any way to overcome this issue? Below is my coding: private void pnl1submitbtnActionPerformed(java.awt.event.ActionEvent evt) { moduleFunc moduleFunc; String module = moduletxtfield.getText(); double exam = Double.parseDouble(examtextfield.getText()); double ct = Double.parseDouble(cttextfield.getText()); double quiz = Double.parseDouble(quiztextfield.getText()); double assign = Double.parseDouble(asstextfield.getText()); try { if (module.trim().isEmpty()) { moduleerrorlbl.setText("Field cannot be empty"); } else if (!(exam+ct+quiz+assign == 100)) { markerrorlbl.setText("Total marks must be 100"); } else { markerrorlbl.setText(""); moduleerrorlbl.setText(""); } Thanks. EDITED: Thanks guys, I've figured out how it works. private void pnl1submitbtnActionPerformed(java.awt.event.ActionEvent evt) { moduleFunc moduleFunc; String module = moduletxtfield.getText(); double exam = 0.0, assign = 0.0, quiz = 0.0, ct = 0.0; try { if (module.trim().isEmpty()) { moduleerrorlbl.setText("Field cannot be empty"); } else if (OODJ.moduleRecord.containsKey(module)) { moduleerrorlbl.setText("Module already exists!"); } else { if (examchkbox.isSelected()) { exam = Double.parseDouble(examtextfield.getText()); } if(ctchkbox.isSelected()) { ct = Double.parseDouble(cttextfield.getText()); } if(quizchkbox.isSelected()) { quiz = Double.parseDouble(quiztextfield.getText()); } if(asschkbox.isSelected()) { assign = Double.parseDouble(asstextfield.getText()); } if (!(exam + ct + quiz + assign == 100)) { markerrorlbl.setText("Total marks must be 100"); } else { //…
favorite count: 0
score: 1
accepted answer: http://stackoverflow.com/a/26990841
has title: How to prevent reading input from text field if text field is disabled
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26989660
tagged with: jtextfield
type: Question

listview
tags question: http://stackoverflow.com/q/26955056
tags question: http://stackoverflow.com/q/26945918
tags question: http://stackoverflow.com/q/26897173
tags question: http://stackoverflow.com/q/26885875
tags question: http://stackoverflow.com/q/26923782
tag name: listview
tags question: http://stackoverflow.com/q/26916678
tags question: http://stackoverflow.com/q/26924654
tags question: http://stackoverflow.com/q/26964741
tags question: http://stackoverflow.com/q/26945247
tags question: http://stackoverflow.com/q/26886049
tags question: http://stackoverflow.com/q/26894217
tags question: http://stackoverflow.com/q/26945004
tags question: http://stackoverflow.com/q/26844864
tags question: http://stackoverflow.com/q/26862571
tags question: http://stackoverflow.com/q/26944152
tags question: http://stackoverflow.com/q/26853775
tags question: http://stackoverflow.com/q/26874731
tags question: http://stackoverflow.com/q/26840701
tags question: http://stackoverflow.com/q/26885693
tags question: http://stackoverflow.com/q/26911639
tags question: http://stackoverflow.com/q/26949006
tags question: http://stackoverflow.com/q/26947945
type: Tag
tags question: http://stackoverflow.com/q/26979793
tags question: http://stackoverflow.com/q/26849984
tags question: http://stackoverflow.com/q/26916599

http://stackoverflow.com/q/26922402
has answer: http://stackoverflow.com/a/26922449
accepted answer: http://stackoverflow.com/a/26922449
has body: String[] lines = ascii.getText().split("\\n"); for(int i = 0; i &lt; lines.length; i++){ System.out.println(lines[i]); if(lines[i] == "") System.out.println("abc"); } ascii is a JTextArea. This is a sample code I'm just testing it before I put it in my program. Right now it splits the lines from ascii into separate strings, and then displays them. It does that correctly and includes the empty lines which I want. Now I want to check if line is empty (it can contain only spaces). I've tried with combinations of if(lines[i] == "", " ", "\n"...) but none of those worked. Can anyone explain how to do it?
has comment: http://stackoverflow.com/comment/42392488
has comment: http://stackoverflow.com/comment/42392444
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42392483
tagged with: java
has comment: http://stackoverflow.com/comment/42392460
duplicate of: http://stackoverflow.com/q/513832
type: Question
tagged with: split
answer count: 1
has comment: http://stackoverflow.com/comment/42392401
has title: Java string.split("\\n")
score: 0
has comment: http://stackoverflow.com/comment/42392473
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/q/26856145
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42299965
tagged with: outputformat
type: Question
tagged with: hadoop
tagged with: reduce
tagged with: mapreduce
has title: Hadoop Custom Output format, when do all reducers end?
upvote count: 1
has answer: http://stackoverflow.com/a/26879337
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I'm building a custom output format for hadoop and was wondering if there is a way in the output format to know when all reducers (RecordWriters) are complete ? In order to know that one RecordWriter completed, the close method of RecordWriter can be used, but what about executing some cleanup when all of the RecordWriters complete ?
has comment: http://stackoverflow.com/comment/42277700
downvote count: 0

http://stackoverflow.com/comment/42356444
comment on: http://stackoverflow.com/a/26902092
has text: I'm not working in an Activity class, but a class I made to just read and write. What should I import?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26959392
score: 2
has body: Imagine I have a POJO like: public class Person() { private int id; private String name; public int getId() { return this.id; } public String getName() { return this.name; } } If I need to bind name member to JavaFX label using bind() method, I can't apply because I need and observable value. I know that I can use StringProperty instead String, but I need primitive types because I use Hibernate and I don't know if Hibernate could support properties from JavaFX to map data from DB. Which alternatives I have to bind from my pojo to a JavaFX control?
downvote count: 0
tagged with: binding
has title: JavaFX bind not property member to control
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26959613
favorite count: 0
type: Question
upvote count: 2
tagged with: properties
answer count: 1
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/26959613

http://stackoverflow.com/a/26894105
type: Answer
answers question: http://stackoverflow.com/q/26892835
upvote count: 2
has body: Stand on the shoulders of giants and use the libraries that are already available: Arrays.sort(myArray); int[] returnArray = new int(NUM_ITEMS_TO_RETURN); for (int i=0; i &lt; NUM_ITEMS_TO_RETURN; i++) { returnArray[i] = myArray[i]; } return returnArray; Obviously you have to do some error checking, for example that the initial array is larger or equal to the number of items you want returned, but that's trivial.
score: 2
downvote count: 0

http://stackoverflow.com/q/26849190
has answer: http://stackoverflow.com/a/26850297
has title: How to programmatically enable directory browsing for a particular path in Jetty 9.x?
type: Question
has body: Is it possible to programmatically enable directory browsing for a particular path in Jetty 9.x (and if "yes" -- how)?
answer count: 2
has answer: http://stackoverflow.com/a/26893574
tagged with: jetty-9
upvote count: 3
favorite count: 0
tagged with: jetty
possible better answer: http://stackoverflow.com/a/26893574
accepted answer: http://stackoverflow.com/a/26850297
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java

http://stackoverflow.com/a/26936140
downvote count: 0
answers question: http://stackoverflow.com/q/26936074
has comment: http://stackoverflow.com/comment/42486860
has body: System.out.println("Would you like to Enter another word? If so, press 1. If not press 2."); answer = input.nextInt(); input.nextLine(); I think if you take out the last line it will work properly Updated
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/a/26908113
accepted answer of: http://stackoverflow.com/q/26858270
answers question: http://stackoverflow.com/q/26858270
type: Answer
has body: This first approach makes no assumptions about the behaviour of the JDBC driver when handling batch INSERTs. It avoids potential INSERT errors by querying the table for any existing mail_id values in our current data set, makes note of the corresponding id value for those mail_id values that do exist, INSERTs the mail_id values that don't exist, and retrieves their (new) id values, and then inserts the rows in the other table (inv_table). try (Connection dbConn = DriverManager.getConnection(myConnectionString, "root", "usbw")) { dbConn.setAutoCommit(false); // test data and setup Long aid = 123L; List<MailidInvitation> invitationList = new ArrayList<MailidInvitation>(); invitationList.add(new MailidInvitation(13L)); invitationList.add(new MailidInvitation(11L)); invitationList.add(new MailidInvitation(12L)); // remove stuff from previous test run try (Statement s = dbConn.createStatement()) { s.executeUpdate("DELETE FROM mail_contacts WHERE mail_id IN (11,13)"); } try (PreparedStatement ps = dbConn.prepareStatement( "DELETE FROM inv_table WHERE aid=?")) { ps.setLong(1, aid); ps.executeUpdate(); } // real code starts here // // create a Map to hold `mail_id` and their corresponding `id` values Map<Long, Long> mailIdMap = new TreeMap<Long, Long>(); for (MailidInvitation a : invitationList) { // mail_id, id (id is null for now) mailIdMap.put(a.getId(), null); } // build an SQL statement to retrieve any existing values StringBuilder sb = new StringBuilder( "SELECT id, mail_id " + "FROM mail_contacts " + "WHERE mail_id IN ("); int n = 0; for (Map.Entry<Long, Long> entry : mailIdMap.entrySet()) { if (n++ > 0) sb.append(','); sb.append(entry.getKey()); } sb.append(')'); String sql = sb.toString(); // run the query and save the results (if any) to the Map try (Statement s = dbConn.createStatement()) { // System.out.println(sql); // try (ResultSet rs = s.executeQuery(sql)) { while (rs.next()) { mailIdMap.put(rs.getLong("mail_id"), rs.getLong("id")); } } } // System.out.print…
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42428096
type: Comment
comment on: http://stackoverflow.com/q/26942249
type: QuestionComment
score: 0
has text: You say `fundsDouble` is your running total, but you don't update it anywhere in your code. After you calculate the price of the item, you need to update `fundsDouble` with the new total.

http://stackoverflow.com/comment/42271908
score: 0
has text: You are using .equals with a String type. Simple use == for two enum type comparison
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26854770

http://stackoverflow.com/q/26977403
tagged with: syntax-error
tagged with: user-interface
downvote count: 0
favorite count: 0
type: Question
has title: Errors in my GUI with ActionListener
score: 1
has body: So, I am working on a project and my GUI seems to come up with 4 errors. These errors point to where I add my action listeners. I am unsure how to fix this issue. Here is my code: import javax.swing.*; import java.awt.*; public class GUIDisplay extends JFrame implements Display { //declearing global variables and J items. protected ReversiBoard board; protected JLabel rowL, colL, gameOverLabel1,gameOverLabel2,message1Label, message2Label; protected JTextField rowField, columnField; protected JButton moveButton, saveButton, startButton, quitButton; protected Canvas myCanvas; protected GUIDisplay myDisplay = new GUIDisplay(board); public GUIDisplay(ReversiBoard inBoard){ board = inBoard; } //Simple message public void displayMessage(String message){ message1Label = new JLabel(message); } //player status such as your turn public void displayStatus(Player inPlayer, String message){ message2Label = new JLabel(inPlayer.getName() + ", " + message); } //end game messages public void displayWinner(Player winner){ if (winner == null) { gameOverLabel1 = new JLabel("Tie Game!"); } else { gameOverLabel2 = new JLabel("Winner: " + winner); } } public void drawBoard(Graphics g){ //set controls the scale of the board int set = 60; int size = board.getSize(); //creating umbered lines for (int c = 1; c &lt;= size + 1; c++){ g.drawString("" + (c - 1), set/2, c*set + set/2); g.drawString("" + (c - 1), c * set + set/2, set/2); } //places pieces for(int c = 0; c &lt; size; c++) { for(int i = 0; i &lt; size; i++){ int p = board.getPiece(i, j).getType(); if (p != Piece.BLANK){ if (p == Piece.BLACKPIECE){ g.setColor(Color.BLACK); } else{ g.setColor(Color.WHITE); } g.fillOval(set + set * i + 10, set + set * c + 10, set - 20, set - 20); } } } } //gets the move public Move getMove(Player p){ int row, col; row = Integer.parseInt(rowField.getText()); col = Integer.parseInt(columnField.getText()); Move m = new Move(p, row, col); return m; } //Setting for graphics public void setGraphics(){ Contain…
upvote count: 1
has answer: http://stackoverflow.com/a/26977503
answer count: 1
tagged with: actionlistener
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42489538

http://stackoverflow.com/q/26898291
upvote count: 0
has answer: http://stackoverflow.com/a/26898311
tagged with: java
has body: This is the question that my CompSci teacher gave me, how do I exactly do the shift with only loops, no arrays? Question is below: The Caesar Cypher takes a String and coverts every letter to a letter a certain amount of letters over(called a shift), without messing with spaces,digits, or punctuations. For example: If a cypher had a shift of -2, then the cypher would do the following. Ex: Is it safe? Good Result: Gq gr qxdc? Emmb To easily understand the cypher, you can look at the following: abcdefghijklmnopqrstuvwxyz xyabcdefghijklmnopqrstuvwx The first row is the original code, the second row is the encrypted code. Write a program that will receive a sentence and the amount of the shift. Then print out the encrypted code, make sure you avoid any punctuations, spaces, and digits. I appreciate all help!!
type: Question
downvote count: 4
has title: Caesar Shift cipher Java program Solution needed:
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -4

http://stackoverflow.com/comment/42290589
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26865476
has text: Why shouldn't be null? You are sending only value of your input. To what it should be mapped?
type: Comment

http://stackoverflow.com/a/40393797
downvote count: 0
has body: This should work. package javaapplication32; import java.io.*; public class JavaApplication32 { public static void main(String[] args)throws Exception { try { DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("dec.dat"))); DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream("enc.dat"))); String enc=in.readUTF(); System.out.println(enc); } catch(EOFException e) { } } }
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26914623

http://stackoverflow.com/comment/109366050
type: Comment
type: QuestionComment
has text: @user3813777 did you solve your problem? If so please share the solution since I am facing the same problem as you did.
comment on: http://stackoverflow.com/q/26894863
score: 0

http://stackoverflow.com/a/26902230
answers question: http://stackoverflow.com/q/26901217
has body: check this solution, it works for any length of data public class ArrayTest { public static void main(String[] args) { int data[] = new int[] {10,20,30,40,50}; int length,limit1,limit2; length=data.length; if(length%2==0) { limit1=data.length/2; limit2=2; } else { limit1=data.length/2+1; limit2=2; } int data2[][] = new int[limit1][limit2]; int ctr=0; //stores data in 2d array for(int i=0;i&lt;limit1;i++) { for(int j=0;j&lt;limit2;j++) { if(ctr&lt;length) { data2[i][j] = data[ctr]; ctr++; } else { break; } } } ctr=0; //prints data from 2d array for(int i=0;i&lt;limit1;i++) { for(int j=0;j&lt;limit2;j++) { if(ctr&lt;length) { System.out.println(data2[i][j]); ctr++; } else { break; } } } } }
score: 0
type: Answer

http://stackoverflow.com/comment/42421793
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26938758
has text: Most of this question seems to be a homework assignment that is unrelated to the problem at hand. You should remove all that, since it is useless and will make people less likely to help you. (Pretty much all the text starting with "Problem").
type: Comment

http://stackoverflow.com/q/26934461
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26948214
has title: Change CDI sessionscoped bean in a Runnable submitted to ManagedExecutorService from a different thread throws a ContextNotActiveException
favorite count: 0
tagged with: cdi
type: UnansweredQuestion
tagged with: multithreading
has body: I have the following method called in a REST service which needs to return immediatly: @Inject private ScheduleManager scheduleManager; @Resource(name = "DefaultManagedExecutorService") ManagedExecutorService executor; public String solveSchedule(@PathParam("conferenceId") Long conferenceId) { executor.submit(new SolverCallable()); return "Solved started."; } It submits this inner class to be executed on another thread private class SolverCallable implements Runnable { public void run() { Schedule bestSchedule = ...; // do some long computation scheduleManager.setSchedule(bestSchedule); // throws ContextNotActiveException } } How can I change the session scoped bean in the Runnable with the result of a long computation?
score: 2
tagged with: java
type: Question
upvote count: 2
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/42413595

http://stackoverflow.com/q/26875840
has answer: http://stackoverflow.com/a/26878143
tagged with: rest
type: Question
has comment: http://stackoverflow.com/comment/42313124
tagged with: cxf
upvote count: 2
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/26878095
tagged with: java
has body: i have resource with two methods: @GET @Path("/{date}") public Response getPartnerInteractionsByDate( @PathParam("partnerId") int partnerId, @PathParam("date") String date ); @GET @Path("/{interactionId}") public Response getPartnerInteraction( @PathParam("partnerId") int partnerId, @PathParam("interactionId") int interactionId ); how can I select one or another service? if I put "1" for interactionId, still the method with date gets executed. I am using apache cxf 3.0.1. Thank you
has comment: http://stackoverflow.com/comment/42313474
has comment: http://stackoverflow.com/comment/42313128
type: AnsweredQuestion
has title: Wrong rest service is selected
tagged with: uritemplate
tagged with: jax-rs
score: 1
has comment: http://stackoverflow.com/comment/42344970
possible better answer: http://stackoverflow.com/a/26878143
accepted answer: http://stackoverflow.com/a/26878095
favorite count: 0

http://stackoverflow.com/comment/106802733
type: AnswerComment
has text: I tried `command: [ "-jar DynamoDBLocal.jar -sharedDb" ]` and `command: [ "-sharedDb", "" ]`, but Gitlab CI says `2020-02-24T12:11:55.675930668Z Unrecognized option: -sharedDb 2020-02-24T12:11:55.675989051Z Error: Could not create the Java Virtual Machine. 2020-02-24T12:11:55.675994696Z Error: A fatal exception has occurred. Program will exit.` Also tried `command: [ "docker run -p 8000:8000 -v $(pwd)/local/dynamodb:/data/ amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb" ]` with no success. The only relevant link I found is https://forums.aws.amazon.com/thread.jspa?messageID=866259.
score: 0
comment on: http://stackoverflow.com/a/53583725
type: Comment

http://stackoverflow.com/q/26979293
accepted answer: http://stackoverflow.com/a/26979362
tagged with: methods
upvote count: 7
has title: Java: Call a base super class method while skipping intermediate inherited super classes
downvote count: 1
has comment: http://stackoverflow.com/comment/42493265
type: Question
tagged with: inheritance
has comment: http://stackoverflow.com/comment/42493106
linked to: http://stackoverflow.com/q/3456177
answer count: 3
has answer: http://stackoverflow.com/a/26979414
linked to: http://stackoverflow.com/q/22577261
favorite count: 0
possible better answer: http://stackoverflow.com/a/26979414
score: 6
has answer: http://stackoverflow.com/a/26979364
has body: Let say I have three classes: class A { public void method() { /* Code specific to A */ } } class B extends A { @Override public void method() { /*Code specific to B*/ super.method(); } } class C extends B { @Override public void method() { /* I want to use the code specific to A without using B */ } } The goal in this case is to use the code from A without using the code from B. I thought there was a way to do it by calling the super method, but this brings in the code from B as well. Is there a way to do this?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42493039
tagged with: java
duplicate of: http://stackoverflow.com/q/3456177
has answer: http://stackoverflow.com/a/26979362
has comment: http://stackoverflow.com/comment/42493528

http://stackoverflow.com/q/26927833
tagged with: drools-guvnor
type: Question
tagged with: drools
has title: Is it possible to clone a git repository using ssh/git protocol from KIE Drools Workbench
upvote count: 2
favorite count: 0
has body: I have a maven module on my git repo which contains rules files (.drl). I would like to clone this repository from KIE Drools Workbench. When I go to Authoring -> Administration -> Repositories -> Clone Repository and gave the git url using https protocol it is able to clone successfully. But if I try to clone using git or ssh protocol I am getting error message as: Can't clone repository. org.eclipse.jgit.errors.NotSupportedException:URI not supported: ssh:///github.com:sivaprasadreddy/myrep.git I have tried with the following git URLs and are NOT working: git://github.com:sivaprasadreddy/myrep.git ssh://github.com:sivaprasadreddy/myrep.git KIE Drools Workbench supports only https based cloning? Is there any other way to clone my git repo using ssh protocol from KIE Workbench?
type: UnansweredQuestion
tagged with: git
score: 2
tagged with: kie
answer count: 0
downvote count: 0
tagged with: java

content-management-system
tags question: http://stackoverflow.com/q/26931116
type: Tag
tag name: content-management-system

http://stackoverflow.com/q/26981514
type: Question
score: 0
has body: I'm using Elasticsearch for the first time, I'm sure this must be easy but so far a solution has eluded me using the Java API: I have an array of search terms, and I'd like to return hits matching any of these terms in a case insensitive way. This code works except it's case sensitive, but I'd like it to be case insensitive: String[] terms = {"orange", "peach"}; SearchResponse response = client.prepareSearch("orders") .setTypes("fruit") .setQuery( QueryBuilders.termsQuery("description", terms).minimumMatch(1) ) .setFrom(0).setSize(10) .setExplain(true) .execute() .actionGet(); for ( SearchHit hit : response.getHits()) { String source = hit.sourceAsString(); //only case sensitive matches found... }
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26981986
type: AnsweredQuestion
tagged with: elasticsearch
has answer: http://stackoverflow.com/a/26981986
has title: Using Elasticsearch Java API to match any of several words, case insensitive

http://stackoverflow.com/a/26944984
accepted answer of: http://stackoverflow.com/q/26944851
type: Answer
answers question: http://stackoverflow.com/q/26944851
downvote count: 0
score: 1
has body: On my device (HTC One M8) android.os.SystemClock is in /system/framework/framework3.jar. I believe framework is separated into multiple jars because of the 65k method limit on classes.dex. android.os.SystemClock may be in a different jar on different android devices. Steps I used to find where android.os.SystemClock was located: adb pull /system/framework/&lt;filename&gt;.jar I then decompiled classes.dex to a jar with DexToJar and viewed the packages inside the jar using JD-GUI (you could just open it as a ZIP file, jd-gui is not necessary and for windows only)
upvote count: 1
has comment: http://stackoverflow.com/comment/42441204
type: AcceptedAnswer

http://stackoverflow.com/q/26903472
has comment: http://stackoverflow.com/comment/42362481
has title: HTTP basic authentication and Spring security: custom failure response
tagged with: spring-security
tagged with: rest
has comment: http://stackoverflow.com/comment/42361000
type: UnansweredQuestion
tagged with: basic-authentication
has comment: http://stackoverflow.com/comment/42362328
tagged with: spring
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42406643
type: Question
has comment: http://stackoverflow.com/comment/42361590
has comment: http://stackoverflow.com/comment/42361330
has body: I'm trying to implement a Rest web service with Jersey, Spring and Spring security (3.2.5). I want the server to require the basic auth header for the request to the rest web service. If authentication succeeds, then jersey should handle the request. If it fails, I want to return an empty response with the status 403. Currently my configuration is the following: &lt;bean id="myAuthenticationEntryPoint" class="de.tuberlin.snet.baroudeur.Authentication.EntryPoint" /&gt; &lt;!-- HTTP basic authentication in Spring Security --&gt; &lt;security:http create-session="stateless" auto-config="false" disable-url-rewriting="true" entry-point-ref="myAuthenticationEntryPoint"&gt; &lt;security:intercept-url pattern="**" access="ROLE_USER" /&gt; &lt;security:http-basic /&gt; &lt;/security:http&gt; &lt;security:authentication-manager&gt; &lt;security:authentication-provider&gt; &lt;security:user-service&gt; &lt;security:user name="username" password="password" authorities="ROLE_USER" /&gt; &lt;/security:user-service&gt; &lt;/security:authentication-provider&gt; &lt;/security:authentication-manager&gt; and my EntryPoint: public class EntryPoint extends BasicAuthenticationEntryPoint { public void commence(ServletRequest request, ServletResponse response, AuthenticationException authException) throws IOException, ServletException { HttpServletResponse httpResponse = (HttpServletResponse) response; httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN); } } I tried a lot of things, like custom AuthenticationFailureHandler, or custom EntryPoint but nothing has worked so far. Thanks Edit: My current solution only returns a 401 response with the basic tomcat templates and the browser asks for the user credentials. When using the debugging mode, it seems that the commence() method of my custom entry point is never called, why is that?
score: 0

http://stackoverflow.com/comment/42481947
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26972192
has text: The NPE happens at the same line of code and the traces even match a few calls deep. That makes it highly likely to be the same bug. Feel free to disagree and to report this as a distinct problem (you may be right, after all).

http://stackoverflow.com/a/26951225
has body: The recommended approach is to override the paintComponent of your Board class and let the paint system handel it... See Painting in AWT and Swing and Perfoming Custom Painting for more details
has comment: http://stackoverflow.com/comment/42444636
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42454150
answers question: http://stackoverflow.com/q/26951055

http://stackoverflow.com/q/26975275
has comment: http://stackoverflow.com/comment/42486213
has comment: http://stackoverflow.com/comment/42485781
has answer: http://stackoverflow.com/a/26975733
accepted answer: http://stackoverflow.com/a/26975733
has comment: http://stackoverflow.com/comment/42486147
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42486449
downvote count: 0
tagged with: jpasswordfield
score: 1
tagged with: java
tagged with: swing
type: Question
has title: Fill a JPasswordField programmatically without creating a String object
has comment: http://stackoverflow.com/comment/42486293
upvote count: 1
has body: Is there a simple way to fill the document of a JPasswordField without creating a String object that contains the password? I was trying to create a "change password" dialog which takes in the old password and requires the new one to be entered twice (three password fields), where the old password may be known before hand, depending on how the user configured this (password may have been stored). So instead of requiring the user to enter the existing password each time the associated dialog is shown to her, I wanted to fill it out programmatically. Note that JPasswordField.setText(String) and the String constructor are not an option. I'd like to do this using a char array. I've been trying to abuse GapContent which seems to be used by PlainDocument, but it doesn't seem to work (the chars are in there but the field is corrupted): import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JFrame; import javax.swing.JPasswordField; import javax.swing.text.PlainDocument; import javax.swing.SwingUtilities; import javax.swing.text.GapContent; public class FillJPasswordField extends JFrame { private JPasswordField pass; public FillJPasswordField() { setLayout(new GridBagLayout()); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); char[] password = new char[]{'p', 'a', 's', 's', 'w', 'o', 'r', 'd'}; PlainDocument doc = new PlainDocument(new MyGapContent(password)); pass = new JPasswordField(doc, null, 20); // see if the password is in there System.out.println(new String(pass.getPassword())); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0d; gbc.insets = new Insets(10, 5, 10, 5); add(pass, gbc); pack(); setLocationRelativeTo(null); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new FillJPasswordField().setVisible(true); } }); } private class MyGapContent extends GapContent { p…
answer count: 1
has comment: http://stackoverflow.com/comment/42485971
has comment: http://stackoverflow.com/comment/42498354
favorite count: 0
linked to: http://stackoverflow.com/q/2860943

http://stackoverflow.com/a/26852121
score: 0
has body: Try this: public boolean testAdd() { Double firstPositiveNumber = 22.0; Double secondPositiveNumber = 33.0; calc.x = firstPositiveNumber; if (calc.x(secondPositiveNumber) == (firstPositiveNumber + secondPositiveNumber)) { System.out.println("[ OK ] Calculator can add positive numbers"); return true; } else { System.out.println("[FAIL] Calculator adds incorrectly"); return false; } Double firstNegativeNumber = -5.0; Double secondNegativeNumber = -6.0; calc.x = firstNegativeNumber; if (calc.x(secondNegativeNumber) == (firstNegativeNumber + secondNegativeNumber)) { System.out.println("[ OK ] Calculator can add a negative number"); return true; } else { System.out.println("[FAIL] Calculator adds with negative numbers incorrectly"); return false; } }
type: Answer
has comment: http://stackoverflow.com/comment/42266648
answers question: http://stackoverflow.com/q/26851973

http://stackoverflow.com/q/26988638
favorite count: 0
linked to: http://stackoverflow.com/q/25848746
has title: Starting Websphere from Eclipse hangs when security is enabled
has answer: http://stackoverflow.com/a/53485036
has answer: http://stackoverflow.com/a/42698378
has answer: http://stackoverflow.com/a/27024980
type: AnsweredQuestion
answer count: 9
has answer: http://stackoverflow.com/a/27005239
has answer: http://stackoverflow.com/a/39614154
upvote count: 7
type: Question
has answer: http://stackoverflow.com/a/77924188
has answer: http://stackoverflow.com/a/27013913
accepted answer: http://stackoverflow.com/a/27013913
score: 7
tagged with: java
tagged with: websphere-8
has answer: http://stackoverflow.com/a/48034576
tagged with: eclipse
has answer: http://stackoverflow.com/a/29055585
has body: I have a Websphere Application Server 8.0.0.6, which was installed as part of RAD. I need to run the server from an Eclipse Java EE Kepler or Luna. There is no problem when administrative security is disabled. However, once security is enabled, the server either doesn't start completely, or Ecplise is unable to to detect it. The progress bar stops at 23%. The last message logged is "Server server1 open for e-business". The status however is still "starting". After a while I get an error complaining that the server didn't start within 300 seconds. It then tries to stop the server, and remains in "stopping" indefinitely. The server is started, Eclipse just seems unable to see it. I can't access the admin console from within Eclipse (though I can with a browser), I can't publish or debug applications, and I can't stop the server from Eclipse. This happens with both Kepler and Luna. The server starts fine in RAD, or when started with the start script. I have checked start websphere server from RAD hangs at "Server server1 open for e-business" . There is a similar question: Websphere in RAD hangs on startup, but there was no solution. Update: The problem is the communication between Ecipse and Websphere, after Websphere has started (as wFateem also has pointed out). Eclipse makes SOAP calls to Websphere to check the status. If administrative security is disabled in WAS, it accepts SOAP calls in plain HTTP. Once security is enabled, only HTTPS is allowed. I checked communications between Eclipse and WAS using the TCP-Monitor built into Eclipse. With disabled security I can see the successful SOAP calls. After enabling security I expected to see just the binary SSL data. However, Eclipse was still trying to use HTTP, without any success of course. Eclipse has a setting for the WAS server to indicate that the server is secured, and which user and password to use for the calls. It even has a flag pertaining to the SSL communication ("automatically trust server certificate du…
tagged with: rad
linked to: http://stackoverflow.com/q/15493233
possible better answer: http://stackoverflow.com/a/39614154
downvote count: 0

http://stackoverflow.com/q/26956379
tagged with: java
tagged with: nodes
type: Question
tagged with: sorting
score: 0
answer count: 1
tagged with: polynomials
has body: I've been trying to figure out how link lists work but I'm having a hard time visualizing the concept. I know multiple algorithms but I can't figure out how to implement them. here's my code: public class LL { private ListNode front,last; public LL(){ front = null; last = null; } // //methods here... // public class ListNode{ public double coefficient; public int exponent; public ListNode next; public ListNode(){ this(0, 0, null); } public ListNode(double coefficient, int exponent, ListNode next){ this.coefficient = coefficient; this.exponent = exponent; this.next = next; } } } This is for storing data of Polynomials. I'm trying to get them to go in descending order. And eventually add up the coefficients of nodes with the same exponents. I think I'm going for bubble sort algorithm but I cannot figure out how I'll rearrange the links. I was also thinking of adding a remove() method and just remove one node and add it at the end until it's sorted. But that is very inefficient because I'll have to keep making new nodes each time. PS: I also have a Polynomial class that takes in a string and turns it into an LL. I don't think it's necessary to post it but if you need it I'll post it! Thanks!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26956419
has title: How should I implement sorting with my custom linked list?
tagged with: linked-list

http://stackoverflow.com/a/27618073
type: Answer
has comment: http://stackoverflow.com/comment/43689896
downvote count: 0
has body: The IANA definition of CET is that it follows the time-zone rules of Central Europe, which includes both winter and summer time. The rules can be seen here, which shows that "CET" is based on "C-Eur" which includes summer time. In java.time you can also see the full set of rules: ZoneId zone = ZoneId.of("CET"); System.out.println(zone); System.out.println(zone.getRules()); for (ZoneOffsetTransition trans : zone.getRules().getTransitions()) { System.out.println(trans); } for (ZoneOffsetTransitionRule rule : zone.getRules().getTransitionRules()) { System.out.println(rule); } which prints: CET ZoneRules[currentStandardOffset=+01:00] Transition[Gap at 1916-04-30T23:00+01:00 to +02:00] Transition[Overlap at 1916-10-01T01:00+02:00 to +01:00] Transition[Gap at 1917-04-16T02:00+01:00 to +02:00] Transition[Overlap at 1917-09-17T03:00+02:00 to +01:00] Transition[Gap at 1918-04-15T02:00+01:00 to +02:00] Transition[Overlap at 1918-09-16T03:00+02:00 to +01:00] Transition[Gap at 1940-04-01T02:00+01:00 to +02:00] Transition[Overlap at 1942-11-02T03:00+02:00 to +01:00] Transition[Gap at 1943-03-29T02:00+01:00 to +02:00] Transition[Overlap at 1943-10-04T03:00+02:00 to +01:00] Transition[Gap at 1944-04-03T02:00+01:00 to +02:00] Transition[Overlap at 1944-10-02T03:00+02:00 to +01:00] Transition[Gap at 1945-04-02T02:00+01:00 to +02:00] Transition[Overlap at 1945-09-16T03:00+02:00 to +01:00] Transition[Gap at 1977-04-03T02:00+01:00 to +02:00] Transition[Overlap at 1977-09-25T03:00+02:00 to +01:00] Transition[Gap at 1978-04-02T02:00+01:00 to +02:00] Transition[Overlap at 1978-10-01T03:00+02:00 to +01:00] Transition[Gap at 1979-04-01T02:00+01:00 to +02:00] Transition[Overlap at 1979-09-30T03:00+02:00 to +01:00] Transition[Gap at 1980-04-06T02:00+01:00 to +02:00] Transition[Overlap at 1980-09-28T03:00+02:00 to +01:00] Transition[Gap at 1981-03-29T02:00+01:00 to +02:00] Transition[Overlap at 1981-09-27T03:00+02:00 to +01:00] Transition[Gap at 1982-03-28T02:00+01:00 to +02:00] Transition[Ove…
score: 35
accepted answer of: http://stackoverflow.com/q/26886703
upvote count: 35
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26886703

http://stackoverflow.com/comment/42515143
type: QuestionComment
comment on: http://stackoverflow.com/q/26991896
score: 1
has text: possible duplicate of [iText and org.bouncycastle.asn1.ASN1Primitive not found](http://stackoverflow.com/questions/14042693/itext-and-org-bouncycastle-asn1-asn1primitive-not-found)
type: Comment

http://stackoverflow.com/a/26924171
has comment: http://stackoverflow.com/comment/42395300
has comment: http://stackoverflow.com/comment/42395290
has comment: http://stackoverflow.com/comment/42395330
answers question: http://stackoverflow.com/q/26924140
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26924140
has body: This is because BufferedWriter adds a layer of its own buffering on top of the stream it is wrapping, independently. When you flush the underlying stream, that's all you're doing. The BufferedWriter still has its buffers. You bypass those. When you flush the BufferedWriter, however, you take care of its additional layer of buffering, sending those out to the underlying stream. The BufferedWriter implementation of flush() also calls flush() on the underlying stream afterwards, so you get a full chain of [ flush higher level buffers to underlying stream ] => [ flush the underlying stream ]. You can see that behavior in the source for BufferedWriter#flush() (comments mine): public void flush() throws IOException { synchronized (lock) { flushBuffer(); // Flushes this BufferedWriters buffers to 'out'. out.flush(); // Now flushes 'out' (the stream it wraps). } } If you call the underlying stream's flush() directly, essentially you are skipping that BufferedWriter#flushBuffer() call in the above code snippet.
type: Answer
score: 2
downvote count: 0

inputmismatchexception
tags question: http://stackoverflow.com/q/26937669
type: Tag
tag name: inputmismatchexception

http://stackoverflow.com/comment/42356948
comment on: http://stackoverflow.com/q/26902338
has text: Do not provide the extension `.xml` Just use `getResources().getAssets().open("mytest");`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42447298
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26953503
type: Comment
has text: @Tom - What if you want 1%? Or 100%? Think about it.

http://stackoverflow.com/comment/42390935
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26917937
has text: No error it was just something I noticed but that seemed to fix it. Thanks.

http://stackoverflow.com/q/26842082
score: 1
tagged with: java
has title: override maven dependency with local library
has body: In my pom.xml I want to include org.springframework.data spring-data-rest-webmvc 2.2.1.RELEASE Unfortunately this library is not being pulled because it depends on: -> spring-data-rest-core 2.2.1 -> org.atteo.evo-inflector 1.2 -> org.atteo.parent 1.10 The last one (org.atteo.parent) has an issue fixed in 1.11 (@see: https://github.com/atteo/parent/commit/8f8db3004cb89d61b22e8348dcc4935a051b5529). What is the best way around this issue? I already tried to hack a little around (this means manually adding the org.atteo.parent dependency to the pom in a newer version, but this is neither elegant nor does it work).
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26842190
tagged with: spring-data-rest
accepted answer: http://stackoverflow.com/a/26842190
favorite count: 0
tagged with: maven
upvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/26838803
possible better answer: http://stackoverflow.com/a/43025494
has comment: http://stackoverflow.com/comment/42242453
accepted answer: http://stackoverflow.com/a/26845642
has title: Spring AMQP RabbitMQ implementing priority queue
tagged with: rabbitmq
tagged with: spring-rabbit
has comment: http://stackoverflow.com/comment/42242302
type: Question
has answer: http://stackoverflow.com/a/26845642
tagged with: java
score: 10
tagged with: apache-camel
answer count: 2
has answer: http://stackoverflow.com/a/43025494
tagged with: spring-amqp
has comment: http://stackoverflow.com/comment/42244050
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/63912973
upvote count: 10
has body: After Google for a few days, and i believe i am totally lost. I would like to implement a kind of priority queue that has about 3 queues: high priority queue (daily), that needs to be process first. mid priority queue (weekly), that will process if no items in queue #1. (it is ok message in this queue it never process at all) low priority queue (monthly), that will process if no items in queue #1 & #2. (it is ok message in this queue it never process at all) Initially I have the following flow, to have a consumer to consume messages from all three queues and checks whether there is any items in queue #1, #2 and #3. and then I realize that this is wrong because: I am totally lost with a question: "How do I know which queue it is coming from?". I'm already consuming a message regardless from any queue, So if I get an object from lower priority queue, am I gonna put it back to the queue if I discover there is a message at the higher priority queue? Following is my current configurations, which shows what an idiot I am. <?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:rabbit="http://www.springframework.org/schema/rabbit" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.0.xsd"> <rabbit:connection-factory id="connectionFactory" host="localhost" /> <rabbit:template id="amqpTemplatead_daily" connection-factory="connectionFactory" exchange="" routing-key="daily_queue"/> <rabbit:template id="amqpTemplatead_weekly" connection-factory="connectionFactory" exchange="" routing-key="weekly_queue"/> <rabbit:template id="amqpTemplatead_monthly" connection-factory="connectionFactory" exchange="" routing-key="monthly_queue"/> <rabbit:admin connection-factory="connectionFactory" /> <rabbit:listene…
type: AnsweredQuestion

http://stackoverflow.com/a/26868757
has comment: http://stackoverflow.com/comment/42296659
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/119418778
type: Answer
has body: I think your dates are both not in daylight saving time, the pattern is mm/dd/yyyy, so your dates are 1st jan 2014 and 7th jan 2014. By the way: The constructor you use is deprecated! Date date = new Date("01/01/2014"); Date date2 = new Date("01/07/2014"); Date date3 = new Date("07/07/2014"); Calendar cal = Calendar.getInstance(Locale.UK); cal.setTime(date); System.out.println(date + " " + cal.getTimeZone().inDaylightTime(date)); cal.setTime(date2); System.out.println(date2 + " " + cal.getTimeZone().inDaylightTime(date2)); cal.setTime(date3); System.out.println(date3 + " " + cal.getTimeZone().inDaylightTime(date3)); This should give you a hint. At least you know if the date is in daylight saving time, how this time is called is a second problem, I don't think it's resolveable with standard-API. Have you tried looking at http://www.joda.org/joda-time/? It's an API for DateTime calculations.
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/42298854
has comment: http://stackoverflow.com/comment/42298510
answers question: http://stackoverflow.com/q/26867952
has comment: http://stackoverflow.com/comment/42296778
has comment: http://stackoverflow.com/comment/42297277
accepted answer of: http://stackoverflow.com/q/26867952
upvote count: 2

http://stackoverflow.com/q/26899485
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/26924401
type: AnsweredQuestion
has body: I've been wondering if it would be possible in a Bukkit plugin to create a RayCast system that I could use to, off a Vector, create a ray that I could, for instance, summon particles every so many blocks along it. I don't have much experience with math; I am only in eighth grade geometry and haven't gotten to trig yet. I didn't want to use player.getTargetBlock() and player.getLineOfSight() because they are deprecated and getLineOfSight() only gives me a List of Blocks, and I was looking for something that i could get a List of Locations or something like that and to be able to change the distance interval between each Location in the list. Thanks. I hope I can get a solution for this. I know people have done it before, but when I search up RayCast Algorithms, it mainly gives me ways to write a Doom-like game engine.
upvote count: 2
tagged with: java
tagged with: raycasting
downvote count: 2
tagged with: bukkit
has answer: http://stackoverflow.com/a/27071512
possible better answer: http://stackoverflow.com/a/26924401
has title: RayCast algorithm in Bukkit
type: Question
has comment: http://stackoverflow.com/comment/42353674
accepted answer: http://stackoverflow.com/a/27071512
tagged with: algorithm
score: 0

http://stackoverflow.com/q/26979822
type: AnsweredQuestion
downvote count: 2
upvote count: 7
has comment: http://stackoverflow.com/comment/42493972
type: Question
linked to: http://stackoverflow.com/q/2305973
has title: What is the difference between java.util.Date and java.sql.Date?
tagged with: java
duplicate of: http://stackoverflow.com/q/2305973
tagged with: date
has answer: http://stackoverflow.com/a/26979864
score: 5
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/50220808
has body: What is the difference between java.util.Date and java.sql.Date? Why can't we use java.util.Date instead of java.sql.Date?
accepted answer: http://stackoverflow.com/a/26979864
has comment: http://stackoverflow.com/comment/42494299

http://stackoverflow.com/a/26978511
upvote count: 1
type: Answer
has body: Following is faster String[] example = "1,2,3,4".split(","); Proof: Time taken to run first method 10000 times: 640 ms Time taken to run second method 10000 times: 531 ms Time taken to run first method 100000 times: 4144 ms Time taken to run second method 100000 times: 3763 ms
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26978319

http://stackoverflow.com/q/26936988
has answer: http://stackoverflow.com/a/26937065
has comment: http://stackoverflow.com/comment/42418233
has comment: http://stackoverflow.com/comment/42418255
type: AnsweredQuestion
tagged with: list
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/26937059
tagged with: nosuchelementexception
has body: I think I have a problem in my code, but I can't find why. When I'm using chemin.next() its working fine. But when I do new_chemin.addAll(chemin.next()); I have a NoSuchElementException public Zone cherche_chemin(List&lt;List&lt;Zone&gt;&gt; chemins, List&lt;Zone&gt; zones_exclues, Zone zone_arrivee) { boolean new_way = false; for (Iterator&lt;List&lt;Zone&gt;&gt; chemin = chemins.iterator(); chemin.hasNext();) { List&lt;Zone&gt; zones = chemin.next().get(chemins.size() - 1).getVoisinsAccessible(zones_exclues); for (Zone test_zone : zones) { new_way = true; if (test_zone == zone_arrivee) { return chemin.next().get(1); } else { List&lt;Zone&gt; new_chemin = new ArrayList&lt;&gt;(); enw_chemin.addAll(chemin.next()); // THIS LINE new_chemin.add(test_zone); chemins.add(new_chemin); zones_exclues.add(test_zone); } } chemin.remove(); } if (new_way) { return cherche_chemin(chemins, zones_exclues, zone_arrivee); } else { return null; } }
has answer: http://stackoverflow.com/a/26937059
has title: Copy List<Object> with "addAll" method NoSuchElementException
accepted answer: http://stackoverflow.com/a/26937065
tagged with: java
score: -1
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42418188
has comment: http://stackoverflow.com/comment/42419213

http://stackoverflow.com/comment/42337176
comment on: http://stackoverflow.com/q/26891621
score: 0
type: Comment
type: QuestionComment
has text: strcmp is string comparison ! its a c ! in java you can use .equals to test 2 strings

http://stackoverflow.com/comment/74408458
has text: @steve.westfall ahhh I see. Thanks for the reply. Unfortunately I'm trying to accomplish this by using the Internet and for any user to be able to navigate to my site and utilize smart card features with their own smart card. The more research I do, the closer I get to either a Native application, or a browser plugin
comment on: http://stackoverflow.com/a/26949730
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42325982
comment on: http://stackoverflow.com/q/26885557
has text: As for the NPE: _where_ do you get it? I mean which line - and please _don't_ just tell us the line number.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42348124
type: QuestionComment
has text: Thank you. I'm going to use lastIndexOf, but thanks nonetheless, I'll probably use your advice too sometime later.
score: 0
comment on: http://stackoverflow.com/q/26897397
type: Comment

http://stackoverflow.com/q/26858458
has body: I am using Java Utility Logging with java application project for exception handling. how to use different log files for class or package using Java Utility Logging? if it is possible with JUL then what kind of change are required in property file? Is there any other way to use this feature using JUL?
has title: how to use different log files for class or package using Java Utility Logging?
score: 0
has comment: http://stackoverflow.com/comment/42278413
linked to: http://stackoverflow.com/q/10630522
linked to: http://stackoverflow.com/q/9652032
tagged with: java
has comment: http://stackoverflow.com/comment/42278529
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42377670

http://stackoverflow.com/q/26890162
has comment: http://stackoverflow.com/comment/42335083
has comment: http://stackoverflow.com/comment/42334644
tagged with: http://stackoverflow.com/tag/html
has title: Showing results in another page if there is more than two records
accepted answer: http://stackoverflow.com/a/26892059
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42334945
type: Question
has comment: http://stackoverflow.com/comment/42335854
score: 0
has body: I have a small program which reads the file path from Server Directory and display it as a link to the report folder something like report1.html. Folder Structure ROOT&gt;REPORTS&gt;COMPANY_NAME&gt;January&gt;report1.html In My html Page it looks like this: Company Name -January( href to the report1.html) HTML which renders result #foreach( $reportGroup in ${orgReport.reportGroupList}) &lt;br&gt;&lt;tr&gt;${reportGroup.ReportGroupName}&lt;/tr&gt;&lt;br&gt; #foreach( $report in ${reportGroup.reportList}) &lt;tr&gt;&lt;a href="${report.ReportPath}"&gt;${report.reportId}&lt;/a&gt;&lt;/tr&gt;&lt;br&gt; #end #end &lt;/table&gt; How to display in another page if there is more than one href link.
has comment: http://stackoverflow.com/comment/42337928
has answer: http://stackoverflow.com/a/26892059
has comment: http://stackoverflow.com/comment/42335328
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/26869196
has answer: http://stackoverflow.com/a/26870453
tagged with: eclipse
tagged with: google-chrome
type: Question
has comment: http://stackoverflow.com/comment/42297551
answer count: 2
has comment: http://stackoverflow.com/comment/42298560
downvote count: 0
tagged with: jsp
has answer: http://stackoverflow.com/a/26870438
has comment: http://stackoverflow.com/comment/42297420
tagged with: http://stackoverflow.com/tag/html
linked to: http://stackoverflow.com/q/2204870
has body: I have been working on a dynamic web application and that requires to display a image on the jsp from my local files. Ant the program is running absolutely fine when I run it in eclipse but when I try the same in chrome it does not load the images. <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Image Processor Process Your Image <% String name = request.getParameter( "path" ); session.setAttribute( "path", name ); %>
favorite count: 0
has title: img tag image not loading in chrome
accepted answer: http://stackoverflow.com/a/26870438
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26870453
score: 1
tagged with: java

http://stackoverflow.com/a/26946381
has comment: http://stackoverflow.com/comment/42435403
has comment: http://stackoverflow.com/comment/42435299
answers question: http://stackoverflow.com/q/26946301
has body: The use Scanner class for input you must pass System.inas argument,then use&lt;object&gt;.nextLine()to accept String object then iterate from 1 to s.length()-1 with increment by 2. public static void main(String args[]){ Scanner in=new Scanner(System.in); System.out.println("Enter a sentence"); String s=in.nextLine(); for(int i=1;i&lt;s.length();i+=2) System.out.print(s.charAt(i)); //I assume the user understands the string begins with 1...s.length() }
score: -1
has comment: http://stackoverflow.com/comment/42435261
has comment: http://stackoverflow.com/comment/42435085
downvote count: 1
has comment: http://stackoverflow.com/comment/42435395
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/42435543

http://stackoverflow.com/a/26970464
answers question: http://stackoverflow.com/q/26969117
type: Answer
has body: You need to use layout manager. Without layout manager it will be difficult to resize components manually. Check these links Resize the components of the frame in full-screen mode &amp; Visual Guide to Layouts. IMHO what you need is either Grid Layout or Border Layout.
has comment: http://stackoverflow.com/comment/42484851
score: 0

http://stackoverflow.com/comment/65517238
has text: I've failed to use MemoryFile's FileDescriptor as the parameters for MediaPlayer setDataSource and SoundPool.load(), it always report the following errors: java.io.IOException: setDataSourceFD failed.: status=0x80000000
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/39057245

http://stackoverflow.com/a/26972468
has body: Looks like a bug in OkHttp, where were we're not throwing away the full response body on a 407. Open an issue on our GitHub issue tracker &amp; I'll take a look. If the proxy of interest is reachable by the public Internet, send it to me privately, jesse@swank.ca and I'll confirm this.
type: Answer
has comment: http://stackoverflow.com/comment/42511730
answers question: http://stackoverflow.com/q/26970670
has comment: http://stackoverflow.com/comment/42779129
score: 0

http://stackoverflow.com/a/26892472
downvote count: 0
answers question: http://stackoverflow.com/q/26886642
accepted answer of: http://stackoverflow.com/q/26886642
has comment: http://stackoverflow.com/comment/42356282
has body: UNION should already be eliminating duplicates. You could re-structure your query a little bit, and it should work. I only made the REFS CTE, in case your actual code was more complicated than that, as to reduce duplication: WITH REFS (NAME) AS ( SELECT NAME FROM REFERENCES WHERE TYPE = 'F' ) SELECT PF1 FROM RELATIONS WHERE PF1 NOT IN ( SELECT NAME FROM REFS ) UNION SELECT PF2 FROM RELATIONS WHERE PF2 NOT IN ( SELECT NAME FROM REFS ) I tested this on my DB2 for LUW 9.7, and it worked correctly for me.
upvote count: 2
type: AcceptedAnswer
type: Answer
score: 2

http://stackoverflow.com/comment/42327492
type: Comment
comment on: http://stackoverflow.com/q/26886477
has text: Object A doesn't know who method(int) is. . .
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42404943
score: 0
has text: If you change your line to `double[] d_Werte = new double[s_Werte.length];` it should at least do the same as your original code
comment on: http://stackoverflow.com/q/26929676
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26899951
type: Question
answer count: 2
has title: HttpURLConnection show progress
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/66989267
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26900244
score: 1
tagged with: java
tagged with: http
has body: I use HttpURLConnection to connect my Server.I want to show update proress. URL url = new URL(RequestURL); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.set...// many params. DataOutputStream dos = new DataOutputStream(conn.getOutputStream()); dos.write("http String"); // eg Content-Disposition: form-data...... InputStream is = new FileInputStream(file); // Take file to Stream. while(){ dos.write(fileString);// Take file Strean to memory.This place can take prograss,but just in momory,not post to server proress. } dos.flush(); InputStream input = conn.getInputStream(); // This place will post data to server,but i donot how to get progress. Please help me ,thanks.

http://stackoverflow.com/a/27098077
answers question: http://stackoverflow.com/q/26971599
accepted answer of: http://stackoverflow.com/q/26971599
score: 0
type: AcceptedAnswer
has body: The solution that I've come up with is an interesting one which is not related to this code! I've solved the problem by changing the glassfish server version from 2.1 to 3.1.2. Still I am confused why this feature not available in glassfish v2.1!
type: Answer

http://stackoverflow.com/q/26895534
score: 1
tagged with: java
tagged with: javafx
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26896038
accepted answer: http://stackoverflow.com/a/26896057
favorite count: 0
has answer: http://stackoverflow.com/a/26896057
possible better answer: http://stackoverflow.com/a/26896038
upvote count: 1
has title: JavaFX Split Menu Button Arrow Trigger Event
has body: I have a SplitMenuButton, and I can't seem to find a way to trigger an event when the user clicks the arrow next to the button. I would like the dropdown to fill with items from a database when the dropdown arrow is clicked. I am not sure which event can do that, and I can not find any info on this either.
type: AnsweredQuestion

http://stackoverflow.com/q/26949611
tagged with: java
tagged with: multithreading
has title: Background SwingWorker thread not executing a particular piece of code
tagged with: swing
type: Question
tagged with: debugging
tagged with: swingworker
possible better answer: http://stackoverflow.com/a/26951641
linked to: http://stackoverflow.com/q/10236995
has answer: http://stackoverflow.com/a/26985012
answer count: 3
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26951641
has answer: http://stackoverflow.com/a/26949629
accepted answer: http://stackoverflow.com/a/26949629
type: AnsweredQuestion
downvote count: 0
has body: I couldn't find a better way to express the problem in the title of the question, but hopefully you'll understand... I have the following code... [...] final JDialog waitingDialog = optionPane.createDialog(optionPane, "Processing in backgroung"); waitingDialog.setLocationRelativeTo(homeFrame); waitingDialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); SwingWorker&lt;Void, Void&gt; backgroundThread = new SwingWorker&lt;Void, Void&gt;() { @Override protected Void doInBackground() throws Exception { // Background processing is done here System.out.println("[DEBUG] -- Background processing has started"); MyCustomClass.initParameters(); System.out.println("DEBUG] -- initParameters() has finished. Starting main processing now..."); waitingDialog.setVisible(true); MyCustomClass.run(); return null; } // This is called when background thread above has completed @Override protected void done() { waitingDialog.dispose(); }; }; backgroundThread.execute(); [and does other things after this...] ... which executes just fine until it hits MyCustomClass.run(). When it is supposed to start such method, it simply doesn't do it. The application doesn't pause, stop or crash... it just keeps on waiting to continue after the background processing is done, which is not happening for some unknown reason. MyCustomClass.run() is a static method over at MyCustomClass. I suspected the problem could be with its name - run - so I changed it to some random thing like "doIt()", but the issue persisted. The very first line on the method is a simple System.out.println("I got here"), but not even that gets printed. I added breakpoints just before and right after the method invocation and tried debugging, but that didn't help either. Everything seemed fine and I couldn't find out the problem. Edit I ask: how do I make the dialog show only when I wanted it to show? In other words, the script is: show the "waiting" dialog when SwingWorker is started hide/stop/disable/dispose the dialog …
score: 1

http://stackoverflow.com/comment/42393481
type: AnswerComment
type: Comment
has text: @CreationEdge possible, I don't understand the part about loops ni the question.
comment on: http://stackoverflow.com/a/26922938
score: 0

http://stackoverflow.com/comment/42451966
has text: No, It is maven project, it has pom.xml
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26955833
score: 0

http://stackoverflow.com/a/26978705
downvote count: 0
has comment: http://stackoverflow.com/comment/42491981
has body: With an array and a loop and a boolean. Review your arrays... chances are... your teacher wouldn't have you create 150 integer variables. int[] integers = new int[150]; integers[0] = 1; // Set your like 150 variables like this integers[1] = 2; boolean isAllNotZero = false; for(int i = 0; i &lt; integers.length - 1; i++) { if(integers[i] != 0) { boolean isAllNotZero = true; } } if(isAllNotZero) { // Do something } else { // Do something else }
has comment: http://stackoverflow.com/comment/42492102
type: Answer
has comment: http://stackoverflow.com/comment/42492041
has comment: http://stackoverflow.com/comment/42512586
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26978601

http://stackoverflow.com/a/26858673
has body: I think adding @Temporal(TemporalType.TIMESTAMP) should solve this. Based on exception, that you received while trying Temporal There is an article, regarding using Java8 with JPA https://weblogs.java.net/blog/montanajava/archive/2014/06/17/using-java-8-datetime-classes-jpa Based on the article. You need to create AttributeConverter @Converter(autoApply = true) public class LocalDateTimePersistenceConverter implements AttributeConverter { @Override public java.sql.Timestamp convertToDatabaseColumn(LocalDateTime entityValue) { return Timestamp.valueOf(entityValue); } @Override public LocalDateTime convertToEntityAttribute(java.sql.Timestamp databaseValue) { return databaseValue.toLocalDateTime(); } } Here is a sample project https://bitbucket.org/montanajava/jpaattributeconverters
has comment: http://stackoverflow.com/comment/42313769
score: 0
answers question: http://stackoverflow.com/q/26858335
type: Answer

http://stackoverflow.com/comment/42498744
comment on: http://stackoverflow.com/q/26982184
score: 0
has text: Providing the fragmentManager as a parameter works. Thanks!
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26863183
score: 0
answers question: http://stackoverflow.com/q/26861904
type: Answer
has body: Here is the code that threw the exception: public FilePartSource(File file) throws FileNotFoundException { this.file = file; if (file != null) { if (!file.isFile()) { throw new FileNotFoundException("File is not a normal file."); } if (!file.canRead()) { throw new FileNotFoundException("File is not readable."); } this.fileName = file.getName(); } } As you can see, you get that exception with that message if you attempt to construct a multipart that contains something that is NOT a normal file. I expect that you have supplied the pathname of a directory, or the pathname for something that doesn't exist at all. (Those spaces in the pathname strings in your example code look mighty suspicious ...)

http://stackoverflow.com/q/26899936
favorite count: 0
has title: Pascal's Triangle Java
tagged with: multidimensional-array
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26900223
has body: This is my first time posting... I am working on making a method to create Pascal's Triangle. I can't seem to get it to initialize the proper values, although it was printing in the format it should have been. If someone could point me in the right direction, that'd be great... public static int[][] createPascalsTriangle(final int n) { if(n &lt; 0) throw new RuntimeException("Invalid Number."); int[][]pascal = new int [n][]; for(int x = 0; x &lt; pascal.length; x++) pascal[x] = new int[x + 1]; pascal[0][0] = 1; for(int i = 0; i &lt; pascal.length; i++) { for(int j = 1; j &lt; pascal[i].length - 1; j++) { if( i &gt; 0) { if(j==0 || j == (pascal[i].length)-1) pascal[i][j] = 1; else pascal[i][j] = pascal[i-1][j] + pascal[i-1][j-1]; } } } return pascal; }//end createPascalsTriangle `
type: Question
tagged with: arrays
upvote count: 2
answer count: 1

http://stackoverflow.com/comment/42428534
comment on: http://stackoverflow.com/a/26942532
score: 0
has text: is there way to debug ui test on intellij or idea? writting ui test in java is aimed to debug it
type: AnswerComment
type: Comment

nutiteq
tag name: nutiteq
type: Tag
tags question: http://stackoverflow.com/q/26845782

http://stackoverflow.com/q/26885984
accepted answer: http://stackoverflow.com/a/26886676
score: 0
answer count: 1
tagged with: searchview
tagged with: android
has comment: http://stackoverflow.com/comment/42327189
has comment: http://stackoverflow.com/comment/42326899
has answer: http://stackoverflow.com/a/26886676
type: AnsweredQuestion
has body: I'm trying to implement in my application, which is characterized by the navigation drawer, I would like to implement the search view. Unfortunately, I get a null value nell'oncreatemenu etc ... I do not understand where I am attaching a wrong image, the log cat and source code. Thank you in advance, sincerely the same code but with no navigation drawer tabs dell'actionbar worked great. I do not understand, I tried searching on the internet but nothing ... Source code: @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_action, menu); MenuItem searchItem = menu.findItem(R.id.action_search); SearchView searchView = (SearchView) MenuItemCompat.getActionView(searchItem); searchView.setOnQueryTextListener(this); //searchView.setQueryHint("Inserisci qualcosa da cercare"); return super.onCreateOptionsMenu(menu); } LogCat: 11-12 12:09:30.900 21373-21373/com.lillonet.megadownloaderpro E/﹕ Device driver API match Device driver API version: 23 User space API version: 23 11-12 12:09:30.900 21373-21373/com.lillonet.megadownloaderpro E/﹕ mali: REVISION=Linux-r3p2-01rel3 BUILD_DATE=Wed Oct 9 21:05:57 KST 2013 11-12 12:10:01.740 21373-21373/com.lillonet.megadownloaderpro E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at com.lillonet.megadownloaderpro.NavActivity.onCreateOptionsMenu(NavActivity.java:344) at android.app.Activity.onCreatePanelMenu(Activity.java:2578) at android.support.v4.app.FragmentActivity.onCreatePanelMenu(FragmentActivity.java:275) at android.support.v7.app.ActionBarActivity.superOnCreatePanelMenu(ActionBarActivity.java:276) at android.support.v7.app.ActionBarActivityDelegate$1.onCreatePanelMenu(ActionBarActivityDelegate.java:79) at android.support.v7.app.ActionBarActivityDelegateBase.preparePanel(ActionBarActivityDelegateBase.java:1056) at android.support.v7.app.ActionBarActivityDelegateBase.doInvalidatePanelMenu(ActionBarActivityDelegateBase.java:1259) at andr…
has comment: http://stackoverflow.com/comment/42326892
has title: SearchView and NavigationDrawer Android
tagged with: navigation-drawer
type: Question
has comment: http://stackoverflow.com/comment/42326660
tagged with: java

http://stackoverflow.com/q/26906102
tagged with: transactions
tagged with: java
tagged with: select
has comment: http://stackoverflow.com/comment/42368983
linked to: http://stackoverflow.com/q/13151701
has comment: http://stackoverflow.com/comment/42362800
type: Question
has comment: http://stackoverflow.com/comment/42364277
score: 0
has comment: http://stackoverflow.com/comment/42362899
tagged with: synchronization
has comment: http://stackoverflow.com/comment/42365974
has comment: http://stackoverflow.com/comment/42364172
type: UnansweredQuestion
tagged with: oracle-database
has title: How does SELECT FOR UPDATE works in Oracle?
has body: I am trying to do synchronization of transactions via DataBase. It's required, because i wand to synchronize transactions from two different systems (JVM's). I try to do it with SELECT FOR UPDATE statement. But i don't sure in which moment rows would be unlocked. There are two suggestions: Rows would be unlocked on transaction completed Rows would be unlocked on closing ResultSet Which of this two is right?
has comment: http://stackoverflow.com/comment/42369469
answer count: 0

http://stackoverflow.com/comment/42367376
type: AnswerComment
score: 0
type: Comment
has text: Thank you for your answer. I seem to have misinterpreted some of the tutorials and resources I consulted. using JAXB 2.0, the `ObjectFactory` just serves a declarative purpose and does not actually provide any functionality? That is, the signature of the methods and annotations are analysed but never actually called. I assume the recommended way to go is, hence, the `jaxb.index` file. I will try it later this week.
comment on: http://stackoverflow.com/a/26906371

http://stackoverflow.com/q/26965023
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26965067
answer count: 1
favorite count: 0
has title: Write a program reads in a series of passwords into an array&Store 10 passwords.After, have the reader enter a password & see if it is in the array.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26965067
upvote count: 1
downvote count: 1
type: Question
has body: import java.util.Scanner; public class Password { public static void main (String [] args) { {String [] myArray = new String[10]; int i; System.out.println("Enter a password: "); Scanner in = new Scanner(System.in); String myString = in.next(); //my arrays are here// myArray[0] = "password"; myArray[1] = "password1"; myArray[2] = "iloveyou"; myArray[3] = "abc123"; myArray[4] = "abc1234"; myArray[5] = "bears55"; myArray[6] = "shelby27"; myArray[7] = "Mjcheer38"; myArray[8] = "sillypineapple"; myArray[9] = "freshvase"; //not sure if this is where this for loop should go// for (i=0;i&lt;9;i++) { if (myString.equals(myArray[i])) { System.out.println("Password Accepted"); break; } else { System.out.println("Password Rejected"); break; } //I think my if statements are right....// } } } } The full question is: 6. Write a program reads in a series of passwords into an array. Store 10 passwords. After creating the password array, have the reader enter a password and see if it is in the array. If it is there, print “Valid password” and if it is not there, print “Invalid password”. I have no idea what I could be doing wrong. For the first password, it says accepted, but for the rest it says rejected. Can someone please point out where I have gone wrong. I cannot seem to figure it out.

http://stackoverflow.com/q/26883273
favorite count: 0
has title: Find index of first element of last group regex?
tagged with: regex
type: AnsweredQuestion
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/26883439
type: Question
has comment: http://stackoverflow.com/comment/42322026
tagged with: java
tagged with: regex-lookarounds
has comment: http://stackoverflow.com/comment/42322107
answer count: 1
downvote count: 0
has body: I have the following problem: I have a collection of strings who look kinda like this: "01100110011" "11100110010" "10001110000" Could there be written a regex that finds the index of the first one in the last group of ones? I am currently using hashmaps and lots of calculations related to lastindexof indexof etc. But at this point it's starting to look ridiculous.
accepted answer: http://stackoverflow.com/a/26883439
tagged with: string

http://stackoverflow.com/q/26964523
tagged with: jradiobutton
tagged with: swing
type: AnsweredQuestion
tagged with: radio-group
tagged with: java
type: Question
has title: multiple radio group give short cut key in keyboard for each radio button for each group java swing
has body: I have radio many radio group in my application and each group has many radio button i want to know how it is possible to assign one key board short cut or a combination of keyboard short cut for each button for example i want to put number 1 in first group first radio button so if i select the first group and press 1 in keyboard automatically first radio button will be selected. I am doing it now by tab, when i tab i select the focus radio button but it is not good when there are so many radio button because it takes time if i tab until the last radio button. How is this possible any suggestion is accepted
score: 0
tagged with: radio-button
has answer: http://stackoverflow.com/a/26964553
answer count: 1
accepted answer: http://stackoverflow.com/a/26964553

http://stackoverflow.com/a/66148530
type: Answer
answers question: http://stackoverflow.com/q/26955263
has body: Enter text using javascriptexecutor How to use Javascriptexecutor for entering text in an element which , I want to enter text in an Textbox which does not take the input through SendKeys​. I proceeded with using Javascriptexecutor to enter the text Example 2. Get/Retrieve text with JavascriptExecutor. In this example, we are accessing a website and trying to retrieve the text written on the login button using JavascriptExecutor How To Send Texts And Get Texts Using JavascriptExecutor?, So in such case, we use JavascriptExecutor of Selenium WebDriver library to handle Well, let's start with handling sending text data to the text area using If you still have any confusions please write in the comment below. This is another technique to send texts using JavascriptExecutor in Selenium WebDriver. Here is the sample code: ADA. WebElement webl = driver.findElement(By.xpath(“xpath_expression”));JavascriptExecutor js = (JavascriptExecutor)driver;js.executeScript(“arguments[0].value=’SynTest’;”, webl); 1.How to enter text using JavaScript in Selenium WebDriver, Following are the commands you can use to enter text using javascript. You don't need to use sendkeys always. Syntax: JavascriptExecutor jexe To enter text within a textbox identified through an xpath you can use the following notation: (JavascriptExecutor) driver.executeScript("document.evaluate(xpathExpresion, document, null, 9, null).singleNodeValue.innerHTML="+ DesiredText);
score: 0

http://stackoverflow.com/comment/42327349
score: 1
comment on: http://stackoverflow.com/a/26886170
type: AnswerComment
has text: @spb1994 Beware doing other people's intro to computer science homework.
type: Comment

http://stackoverflow.com/q/26947607
has comment: http://stackoverflow.com/comment/42437621
has comment: http://stackoverflow.com/comment/42438037
answer count: 1
has answer: http://stackoverflow.com/a/27086230
accepted answer: http://stackoverflow.com/a/27086230
has comment: http://stackoverflow.com/comment/42440749
has title: Encrypting using Vigenere cipher where Plaintext is read from a file (JAVA)
type: AnsweredQuestion
tagged with: java
tagged with: vigenere
type: Question
has comment: http://stackoverflow.com/comment/42680962
has body: I am trying a simple Vigenere cipher where plain text is read from a file and encrypted using a key. Key =ABC Cipher text is obtained by addition between the PT and the key Plain Text : W E W I L L A T T A C K T O N I G H T Key : A B C A B C A B C A B C A B C A B C A Cipher : W F Y I M N A U V A D M T P P I H J T How can i repeat the key for the length of the plain text and then encrypt it as it is being read.? The input is read from a file using the following snippet FileInputStream fileInput = new FileInputStream("/Documents/file1.txt"); int r; int count = 0 ; //Read each character from the file one by one till EOF while ((r = fileInput.read()) != -1) { char c = (char) r; //SOMETHING NEEDS TO BE DONE HERE System.out.print(c); count ++; //Keeps count of the number of characters in the plain text.
score: 0

http://stackoverflow.com/q/26853196
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/26853311
has body: I'm trying to read contacts from my android phone to modify them and write them back into the database. The project has three classes so far: The MainActivity.java. This is where I read the database, populate the contacts objects I've created and the put them in a list. public class MainActivity extends Activity { private ArrayAdapter&lt;String&gt; adapter; // Store contacts values in these arraylist. // I t is not really needed for this implementation but I keep this just in case public static ArrayList&lt;String&gt; phoneValueArr = new ArrayList&lt;&gt;(); public static ArrayList&lt;String&gt; nameValueArr = new ArrayList&lt;&gt;(); // Store the values of names and associated phone numbers. public ContactData contactsData= new ContactData(); // List to store the contacts public ContactsDataList contactsList= new ContactsDataList(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); adapter = new ArrayAdapter&lt;&gt; (this, android.R.layout.simple_dropdown_item_1line, new ArrayList&lt;String&gt;()); readContactsData(); //Display the number of contacts Toast.makeText(getApplicationContext(), "read " + phoneValueArr.size() + " contacts. " , Toast.LENGTH_LONG).show(); pressButton(); for(ContactData c:contactsList.getContacts()){ Toast.makeText(getApplicationContext(), c.getContact_name() + "Hopes on God " , Toast.LENGTH_LONG).show(); } } } public void readContactsData() { try { // Reading Contacts Name And Number String phoneNumber = ""; ContentResolver cr = getBaseContext().getContentResolver(); // Query to get contact name Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); // If data data found in contacts if (cur.getCount() &gt; 0) { Log.i("AutocompleteContacts", "Reading contacts........"); int k = 0; String name = ""; //Until there are no more contacts stored while (cur.moveToNext()) { String id = cur.getString(cur .getColumnIndex(ContactsCon…
tagged with: java
accepted answer: http://stackoverflow.com/a/26853311
score: 0
answer count: 1
tagged with: arraylist
tagged with: android
has title: ArrayList stores only the last value read

http://stackoverflow.com/comment/42320627
type: Comment
has text: Won't work if you want an element in both sets while keeping the logic.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26882430

http://stackoverflow.com/a/26897617
has body: per @ajb wouldn't you want to do something like this in your loop? This will print your salary increase every year, and also add that to the salary for the next iteration Per your new comment Every time their is an output, I would like it to display the year and their salary. while (year &gt; years) { //predict = salary * (pi/100); commented this because it is not necessary anymore. salary += salary * (pi/100); System.out.println(years + ". " + salary); // replaced predict with salary, to show their salary and not just their predicted raise. years++; // This block of code will never be hit, therefore it is not needed. //if (years == year){ // break; //} } Revised could be something like this. while (year &gt; years) { salary += salary * (pi/100); System.out.println(years + ". " + salary); years++; }
has comment: http://stackoverflow.com/comment/42348370
answers question: http://stackoverflow.com/q/26897463
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42348599
has comment: http://stackoverflow.com/comment/42348396
type: Answer
accepted answer of: http://stackoverflow.com/q/26897463

http://stackoverflow.com/comment/42314916
comment on: http://stackoverflow.com/q/26879030
type: Comment
score: 1
has text: You'd need a reference to the original `ActionListener`, instead of create an inline class like you are, create an `ActionListener` and assign it an instance variable you can reference later
type: QuestionComment

http://stackoverflow.com/q/26889642
tagged with: editor
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26890366
upvote count: 3
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42333523
possible better answer: http://stackoverflow.com/a/26890366
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/42333952
has answer: http://stackoverflow.com/a/26890482
tagged with: eclipse-rcp
answer count: 2
has title: Making an editor page with sections doesnt work (eclipse, java)
tagged with: eclipse-plugin
favorite count: 0
accepted answer: http://stackoverflow.com/a/26890482
has body: I am trying to create a multipage editor looking similar to the manifest editor. I used the wizard for multipage editors, and tried to make a really really simple page following the tutorial void createPage0() { Composite composite = new Composite(getContainer(), SWT.DEFAULT); FormToolkit toolkit = new FormToolkit(composite.getDisplay()); ScrolledForm scrollform= toolkit.createScrolledForm(composite); scrollform.setText("Test Viewer"); toolkit.decorateFormHeading(form.getForm()); int index = addPage(composite); setPageText(index, "editor1"); } If I run this in eclipse, the first page of the editor is plain grey with nothing displayed. (There suppose to be the title according to the tutorial) Does anyone know why it doesn't work?

http://stackoverflow.com/q/26903049
tagged with: ibeacon-android
tagged with: android-bluetooth
upvote count: 1
answer count: 1
favorite count: 0
has title: How to scan only Advertising Packet BLE
tagged with: bluetooth-lowenergy
tagged with: android
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26903477
accepted answer: http://stackoverflow.com/a/26903477
score: 1
tagged with: java
type: Question
has body: While scanning for advertising beacons with startLeScan method, this method also request peripheral device for scan response and stores it in scanRecord. I only want to scan for advertising payload I don’t want to send request scan response to peripheral device my code to scan: mBluetoothAdapter.startLeScan(mLEScanCallback); private BluetoothAdapter.LeScanCallback mLEScanCallback = new BluetoothAdapter.LeScanCallback() { @Override public void onLeScan(BluetoothDevice device, int rssi, byte[] scanRecord) { } };

http://stackoverflow.com/comment/42513814
type: AnswerComment
type: Comment
has text: @Mayank Then you should follow EJP's advice.
comment on: http://stackoverflow.com/a/26990154
score: 0

http://stackoverflow.com/q/26946482
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/49743609
accepted answer: http://stackoverflow.com/a/26950787
tagged with: wicket-1.6
has answer: http://stackoverflow.com/a/49743609
tagged with: wicket
type: AnsweredQuestion
upvote count: 2
tagged with: java
has body: In wicket form I have a DropDownChoice, and I want to take a selected value in it. I have: private final List&lt;DimSpecific&gt; specificList; private DimSpecific specificPtr = null; ... specificList = roles.getSpecificList(); specificPtr = new DimSpecific(); DropDownChoice specific = new DropDownChoice("specific", new Model&lt;&gt;(specificPtr), specificList, new ChoiceRenderer&lt;DimSpecific&gt;("code", "id")); Form form = new Form("frm_0_07"){ @Override protected void onSubmit() { String specificSelected = specificPtr.getCode(); } } And the variable specificSelected equals to null. How I can get selected value?
type: Question
tagged with: dropdownchoice
has answer: http://stackoverflow.com/a/26950787
answer count: 2
score: 2
has title: How to get selected value in Wicket DropDownChoice?

http://stackoverflow.com/comment/42458602
score: 0
type: AnswerComment
type: Comment
has text: Or, like that for 35.99 and 36: `^(?:([89]|[12][0-9]|3[0-5])(\.[0-9]{1,2})?|36)$` test: [HERE](http://regex101.com/r/bN8oP0/3)
comment on: http://stackoverflow.com/a/26959650

http://stackoverflow.com/comment/42308194
type: Comment
has text: Your class must have a `main` method in order to be run.
type: AnswerComment
comment on: http://stackoverflow.com/a/26874972
score: 0

http://stackoverflow.com/comment/42418811
type: Comment
comment on: http://stackoverflow.com/a/26934483
score: 0
type: AnswerComment
has text: @user1158745 The usual way - create separate `class-name.java` classes for each class, add package names, put them in the proper spot in your project tree (or in your directory structure if you use command line instead of an IDE) and use them from your "main" file by name. If you name the classes right and put them in the proper spots in the project tree, the compiler would find them automatically. You may need to make these classes public as well, if you want to make your `parseFile` public.

http://stackoverflow.com/a/26943655
answers question: http://stackoverflow.com/q/26943548
accepted answer of: http://stackoverflow.com/q/26943548
type: AcceptedAnswer
downvote count: 0
has body: You could clone the Random object in the getNumber method so that you start at the same seed each time. Then compute nextInt repeatedly until you get to the correct index. int getNumber(int index) { Random r = this.seed.clone(); for (int i = 0; i &lt; index - 1; ++i) { r.nextInt(); } return r.nextInt(); }
has comment: http://stackoverflow.com/comment/42430492
type: Answer
score: 1
upvote count: 1

interop
tags question: http://stackoverflow.com/q/26991290
type: Tag
tag name: interop

http://stackoverflow.com/a/26963436
score: 4
downvote count: 0
type: Answer
has body: Your first problem is in this line: int result = (a^e) % p; a^e is "a xor e" not "a to the eth power". You need Math.pow(a, e) or something equivalent. You should probably re-read the description of the algorithm.
upvote count: 4
answers question: http://stackoverflow.com/q/26963376

http://stackoverflow.com/comment/42394148
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example).
comment on: http://stackoverflow.com/q/26923348
score: 0
type: Comment

http://stackoverflow.com/q/26916336
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42381256
has answer: http://stackoverflow.com/a/26922065
has body: Suppose we have the following statement arrayList.size(); This statement in itself does nothing. Will any Java compiler or JVM ignore this statement for optimization purposes? In effect, the compiler or JVM assumes there are no side effects of the statement and therefore removes it for optimization.
has comment: http://stackoverflow.com/comment/42381286
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42381250
type: Question
has comment: http://stackoverflow.com/comment/42381261
tagged with: optimization
score: 0
answer count: 1
has title: Does any Java compiler or JVM ignore a statement for optimization?
has comment: http://stackoverflow.com/comment/42381326
favorite count: 0

http://stackoverflow.com/comment/42403771
score: 0
comment on: http://stackoverflow.com/q/26927117
type: Comment
type: QuestionComment
has text: Not the stack trace, but there should be a detailed error message.

http://stackoverflow.com/comment/42329121
type: QuestionComment
has text: Are you sure JFrame is not visible? As you have nothing added to it, it will much small, may be you didn't notice.
comment on: http://stackoverflow.com/q/26887200
score: 0
type: Comment

http://stackoverflow.com/q/26852579
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26852601
has comment: http://stackoverflow.com/comment/42267713
linked to: http://stackoverflow.com/q/2965747
accepted answer: http://stackoverflow.com/a/26852601
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1624144
linked to: http://stackoverflow.com/q/4792160
has title: java.lang.UnsupportedOperationException while adding element to a list
has body: For a string "a3tx2z" The output of this should be "attttxzzz", or for "12x" it should be "2xxx". I checked everything and they work. but when i want to print "ttt" in the place of 3, there is a java.lang.UnsupportedOperationException at line 28 l.add(i, s1);. What is wrong here? package xyz; import java.util.Arrays; import java.util.List; public class xyz { public static void main(String[] args) { xyz n = new xyz(); n.blowup("a3tx2z"); } public String blowup(String str){ String[] array = str.split(""); List&lt;String&gt; l = Arrays.asList(array); for(int i=0; i&lt;l.size(); i++){ String s1 = l.get(i); if(s1.matches("-?\\d+(\\.\\d+)?")){ String s2 = l.get(i+1); if(!(s2.matches("-?\\d+(\\.\\d+)?"))){ int t = Integer.parseInt(s1); while(t&gt;0){ l.add(i, s1); t--; } } } } for(String x: l){ System.out.print(x); } return ""; } }
duplicate of: http://stackoverflow.com/q/1624144
has comment: http://stackoverflow.com/comment/42267779

http://stackoverflow.com/q/26940143
has comment: http://stackoverflow.com/comment/42424881
tagged with: java
has comment: http://stackoverflow.com/comment/42424734
has answer: http://stackoverflow.com/a/30630803
has title: IntelliJ 13.1.6 JDK 8 support
type: Question
has answer: http://stackoverflow.com/a/30332613
has comment: http://stackoverflow.com/comment/42424899
has comment: http://stackoverflow.com/comment/42425573
tagged with: intellij-idea
upvote count: 2
answer count: 3
favorite count: 0
has answer: http://stackoverflow.com/a/26940200
has comment: http://stackoverflow.com/comment/42425139
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42424779
has comment: http://stackoverflow.com/comment/42424960
tagged with: java-8
has body: I created a project that Project SDK set to 1.8 (1.8.0_25). The problem is that even System cannot be resolved, if I switched Project SDK to 1.7 (1.7.0_71), everything works fine. How to resolve this issue?
score: 2
downvote count: 0

http://stackoverflow.com/comment/42434708
comment on: http://stackoverflow.com/a/26946153
has text: Thanks a lot! It works. But could you help me to clarify is it work in this way: when the button was triggered, it will add the new record into the static _commentlist and the notifyDataSetChanged of adapter will refresh the list view?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42287402
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26863771
has text: As a side note StringBuffer is obsolete - you should use StringBuilder instead.

http://stackoverflow.com/q/26941261
tagged with: java
has answer: http://stackoverflow.com/a/26983100
type: Question
tagged with: docx4j
has body: I am exploring pptx4j to generate slide compatible to office 2013. One of the requirement is to move the element(new row of table/ text box/ new table/ any other element) to next slide when the element added goes beyond the slide height. Is there any way to achieve this.
answer count: 1
accepted answer: http://stackoverflow.com/a/26983100
score: 0
tagged with: powerpoint
has title: how to find end of slide height and last added element position
type: AnsweredQuestion

http://stackoverflow.com/a/49927111
upvote count: 24
has comment: http://stackoverflow.com/comment/124053826
has body: In Java 9 and later, you can do Tooltip tooltip = new Tooltip("A tooltip"); tooltip.setShowDelay(Duration.seconds(3)); There is also a hideDelay property, for the delay between the tooltip appearing and it being hidden again. The default values are 1 second for the showDelay and 200 milliseconds for the hideDelay.
downvote count: 0
has comment: http://stackoverflow.com/comment/124053785
accepted answer of: http://stackoverflow.com/q/26854301
score: 24
answers question: http://stackoverflow.com/q/26854301
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/26911119
upvote count: 1
answers question: http://stackoverflow.com/q/26911032
has body: Your condition should be something like this: if((a != null &amp;&amp; a == 1) || (b != null &amp;&amp; b == 2)) This is just an example but you should check for null before testing if there is a chance a variable could be null...
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/26893971
accepted answer: http://stackoverflow.com/a/26894103
has comment: http://stackoverflow.com/comment/42341847
has title: getSharedPreferences Null Pointer Exception on some devices
has answer: http://stackoverflow.com/a/26894085
tagged with: android
favorite count: 0
upvote count: 2
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/5950043
tagged with: java
tagged with: sharedpreferences
possible better answer: http://stackoverflow.com/a/26894085
type: Question
answer count: 2
has body: I am using SharedPreferences to get some saved values. I only get a null pointer exception on some devices. When I test the code in my own device I don't get any problem. But some of my user get the error. Here is my class to get the value of SharedPreference: public class SavingData { public static final String PREFS_NAME = "MyPrefsFile"; public static MainActivity mainActivity; public static int getRestTime() { // Restore preferences SharedPreferences settings = mainActivity.getSharedPreferences(PREFS_NAME, 0); int restTime = settings.getInt("resttime", defaultRestTime); // 0 is the default // value return restTime; } In my main class I declare the mainActivity variable. SavingData.mainActivity = this; Here is the error I get: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.playsimple.fitnessapp/com.playsimple.fitnessapp.ExerciseStartActivity}: java.lang.NullPointerException at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2198) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2257) at android.app.ActivityThread.access$800(ActivityThread.java:139) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5086) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.playsimple.fitnessapp.data.SavingData.getDifficulty(SavingData.java:91) at com.playsimple.fitnessapp.ExerciseStartActivity.initExercise(ExerciseStartActivity.java:69) at com.playsimple.fitnessapp.ExerciseStartActivity.onCreate(ExerciseStartActivity.java:64) at android.app.Activity…
downvote count: 0
has answer: http://stackoverflow.com/a/26894103

web-services
tags question: http://stackoverflow.com/q/26906849
type: Tag
tags question: http://stackoverflow.com/q/26913051
tags question: http://stackoverflow.com/q/26902663
tags question: http://stackoverflow.com/q/26858630
tags question: http://stackoverflow.com/q/26850635
tags question: http://stackoverflow.com/q/26850742
tags question: http://stackoverflow.com/q/26849356
tags question: http://stackoverflow.com/q/26892050
tags question: http://stackoverflow.com/q/26989265
tags question: http://stackoverflow.com/q/26842375
tags question: http://stackoverflow.com/q/26986718
tags question: http://stackoverflow.com/q/26971511
tags question: http://stackoverflow.com/q/26936346
tags question: http://stackoverflow.com/q/26979217
tags question: http://stackoverflow.com/q/26867418
tags question: http://stackoverflow.com/q/26907856
tags question: http://stackoverflow.com/q/26987588
tags question: http://stackoverflow.com/q/26971767
tags question: http://stackoverflow.com/q/26919126
tags question: http://stackoverflow.com/q/26902047
tags question: http://stackoverflow.com/q/26903492
tags question: http://stackoverflow.com/q/26841704
tags question: http://stackoverflow.com/q/26929352
tags question: http://stackoverflow.com/q/26936150
tags question: http://stackoverflow.com/q/26869577
tags question: http://stackoverflow.com/q/26862786
tags question: http://stackoverflow.com/q/26874795
tags question: http://stackoverflow.com/q/26845344
tags question: http://stackoverflow.com/q/26864688
tags question: http://stackoverflow.com/q/26942455
tags question: http://stackoverflow.com/q/26925691
tag name: web-services
tags question: http://stackoverflow.com/q/26847554
tags question: http://stackoverflow.com/q/26909362
tags question: http://stackoverflow.com/q/26904203
tags question: http://stackoverflow.com/q/26989634
tags question: http://stackoverflow.com/q/26861801
tags question: http://stackoverflow.com/q/26917902
tags question: http://stackoverflow.com/q/26967752
tags question: http://stackoverflow.com/q/26871568
tags question: http://stackoverflow.com/q/26861163
tags question: http://stackoverflow.com/q/26912032
tags question: http://stackoverflow.com/q/26844581
tags question: http://stackoverflow.com/q/26866203
tags question: http://stackoverflow.com/q/26923658
tags question: http://stackoverflow.com/q/26873669

http://stackoverflow.com/comment/42478168
score: 0
comment on: http://stackoverflow.com/q/26971127
type: Comment
has text: Would adding a null check in `hashCode`, and then returning say 0, be viable?
type: QuestionComment

http://stackoverflow.com/comment/42368101
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26908589
has text: I spent quite a while on this problem, and only after having found a solution, I decided that it may be worth having the question here.
score: 0

http://stackoverflow.com/a/26918162
has body: According to the documentation the class attribute does not allow the EL "class="package.class" Instantiates a bean from a class, using the new keyword and the class constructor. The class must not be abstract and must have a public, no−argument constructor. The package and class name are case sensitive." see Oracle docs
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26918040
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26918040

http://stackoverflow.com/a/26967616
downvote count: 0
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42483428
has body: The usual syntax to run a jar file is java -jar TestPractice.jar. If this fails, some analysis is required. Open your jar file with WinZip, and extract to a temporary directory. Check that HelloWorld.class file is present, and in the correct directory. Check that there is a META-INF/MANIFEST.MF file, and it contains a line reading Main-Class: com.hellojava.HelloWorld I don't see anything in your Ant script that would generate this file. If all that is OK, your program will run. For more information, take a look at how to create a bundled runnable jar using Ant
score: 1
answers question: http://stackoverflow.com/q/26966687

http://stackoverflow.com/comment/42488652
score: 0
has text: your last comment seems very strange
comment on: http://stackoverflow.com/q/26976929
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26995108
has comment: http://stackoverflow.com/comment/42520779
answers question: http://stackoverflow.com/q/26845885
has comment: http://stackoverflow.com/comment/42547452
score: 41
accepted answer of: http://stackoverflow.com/q/26845885
has body: it is found in org.opencv.imgproc.Imgproc package, e.g. Imgproc.rectangle(webcam_img, null, null, null);
type: AcceptedAnswer
downvote count: 0
upvote count: 41
type: Answer

http://stackoverflow.com/a/26864462
answers question: http://stackoverflow.com/q/26864305
downvote count: 1
type: Answer
upvote count: 0
has comment: http://stackoverflow.com/comment/42288384
score: -1
has body: I think this would be helpful: How do you assert that a certain exception is thrown in JUnit 4 tests? You will have to simulate those exception scenarios as well.

http://stackoverflow.com/q/26900998
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has body: I have a method that returns List&lt;Super&gt;. say List&lt;Super&gt; myMethod(); When calling that method, I want to cast the returned list to List&lt;Sub&gt;, knowing that its runtime type will be a List of Sub. I know that List&lt;Sub&gt; subs = (List&lt;Sub&gt;) myMethod() won't work because generics are invariant. However, List&lt;? super Sub&gt; subs = myMethod() works, the compile time type becomes List&lt;Object&gt;, so subs.get(0).mySubMethod() won't work. What I end up with is that I have to explicitly cast it as ((Sub) subs.get(0)).mySubMethod() How do I do this correctly without explicit casting on each element?
has title: How to consume a List being returned as List<Super>
upvote count: 2
has comment: http://stackoverflow.com/comment/42354466
answer count: 1
has answer: http://stackoverflow.com/a/26901204
accepted answer: http://stackoverflow.com/a/26901204
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/42354387
linked to: http://stackoverflow.com/q/933447

http://stackoverflow.com/q/26857079
favorite count: 0
has title: Doubts about using jsp include
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/26857629
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/42276153
score: -2
has body: I'm starting to develop systems more precisely in java web applications using jsp'm more a problem that still can not find the solution. I have a file called [header.jsp] that is the links for CSS and other things that are important to my system that file is in the root directory. I have a folder that has other jsp files more when I try to do an include file [header.jsp] does not work, does anyone have experienced the same problem that could help me? Thank you in advance.
tagged with: java
has comment: http://stackoverflow.com/comment/42277002
has comment: http://stackoverflow.com/comment/42276042
upvote count: 0
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/26946823
has answer: http://stackoverflow.com/a/26946882
has answer: http://stackoverflow.com/a/26946884
has title: Android,Use switch case is used to determine the boolean
has comment: http://stackoverflow.com/comment/42435979
type: Question
possible better answer: http://stackoverflow.com/a/26946882
has comment: http://stackoverflow.com/comment/42435911
has answer: http://stackoverflow.com/a/26947058
linked to: http://stackoverflow.com/q/5141830
has comment: http://stackoverflow.com/comment/42435845
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/2015071
accepted answer: http://stackoverflow.com/a/26947058
tagged with: if-statement
tagged with: java
tagged with: switch-statement
has body: I'm writing some programs.Im going to use this programs to tell the situation of the connection. I would only use if-else, and now I want to learn how to use switch case,but I found switch case dont use boolean,The following is what I wrote judgment formula: if(isConnected) { //if connection established btnwifi.setText("Connection"); } else { btnwifi.setText("Unconnected"); }
type: AnsweredQuestion

http://stackoverflow.com/comment/67731565
type: AnswerComment
has text: If somehow an alarm is skipped(due to device power off) then what would happen(!!??). The pending alarm will be missed as well as the opportunity to set next days alarm. Isn't it? This is suicidal.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26959556

http://stackoverflow.com/q/26864092
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42291286
upvote count: 1
has comment: http://stackoverflow.com/comment/42289934
has answer: http://stackoverflow.com/a/31886843
has comment: http://stackoverflow.com/comment/42297938
has comment: http://stackoverflow.com/comment/42293136
tagged with: android-recyclerview
has comment: http://stackoverflow.com/comment/42289529
score: 1
tagged with: java
has body: I'm trying to use ItemDecorator to add some separators into a RecyclerView. This is the fragment of the code that does it. //... public abstract C onInflateViewHolder(Context ctx); public abstract void onBindViewHolder(C holder, int index); @Override public void onDraw(Canvas c, RecyclerView parent) { if (mOrientation == VERTICAL_LIST) { drawVertical(c, parent); } else { drawHorizontal(c, parent); } } public void drawVertical(Canvas c, RecyclerView parent) { final int left = parent.getPaddingLeft(); final int right = parent.getWidth() - parent.getPaddingRight(); for (int i = 0; i &lt; parent.getChildCount(); i++) { C view = onInflateViewHolder(mContext); onBindViewHolder(view, i); RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT); //parent.addView(view.itemView, i, p); view.itemView.draw(c); } } //... As you can see I tried using parent.addView(view.itemView, i, p);, parent.addView(view.itemView, i); and finally view.itemView.draw(c);. This is the implementations: mItemDecorator = new GenericDecorator&lt;ChatDateSeparatorViewHolder&gt;(getActivity(), GenericDecorator.VERTICAL_LIST) { @Override public ChatDateSeparatorViewHolder onInflateViewHolder(Context ctx) { View v = LayoutInflater.from(ctx).inflate(R.layout.chat_message_separator, null); return new ChatDateSeparatorViewHolder(v); } @Override public void onBindViewHolder(ChatDateSeparatorViewHolder holder, int index) { if (index &lt; mAdapter.getItemCount()-1) { ChatMessage previous = mAdapter.getMessage(index); ChatMessage current = mAdapter.getMessage(index+1); long startTime = previous.getSendDate().getTime(); long endTime = current.getSendDate().getTime(); long diffTime = endTime - startTime; long diffDays = diffTime / (1000 * 60 * 60 * 24); if (diffDays &gt; 0) { holder.text.setText(Converters.format(current.getSendDate(), getActivity())); } else { holder.root.setVisibility(View.GONE); } } else { holder.root.se…
has comment: http://stackoverflow.com/comment/42289594
tagged with: draw
type: Question
has comment: http://stackoverflow.com/comment/43634885
answer count: 2
has comment: http://stackoverflow.com/comment/42290486
downvote count: 0
has answer: http://stackoverflow.com/a/33460868
tagged with: android
has comment: http://stackoverflow.com/comment/42303190
has comment: http://stackoverflow.com/comment/42290997
favorite count: 0
has comment: http://stackoverflow.com/comment/42288466
has title: Using ItemDecorator to make separators in a RecyclerView

http://stackoverflow.com/a/26877367
has comment: http://stackoverflow.com/comment/42424020
has comment: http://stackoverflow.com/comment/42321070
answers question: http://stackoverflow.com/q/26876827
type: Answer
has comment: http://stackoverflow.com/comment/42312053
accepted answer of: http://stackoverflow.com/q/26876827
has comment: http://stackoverflow.com/comment/42344380
has body: There are probably a few ways you could do this, you could, for example, simply add and remove the bottom panel as needed. If I can, I'd like to avoid this, as it can make managing the layout more difficult. Another solution is simply to make the component visible/invisible, but you need to find a layout manager which will actually treat a invisible component like it's not there (0x0) - and yes, I had issues with a couple while putting a test together... import java.awt.EventQueue; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class FlipDialog { public static void main(String[] args) { new FlipDialog(); } public FlipDialog() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private JButton flip; private JPanel bottom; public TestPane() { setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.insets = new Insets(8, 8, 8, 8); gbc.gridwidth = GridBagConstraints.REMAINDER; JPanel top = new JPanel(); flip = new JButton("+"); top.add(flip); add(top, gbc); bottom = new JPanel(); bottom.add(new JLabel("Boo")); bottom.setVisible(false); add(bottom, gbc); flip.addActionListene…
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/42329493
has comment: http://stackoverflow.com/comment/42320322
has comment: http://stackoverflow.com/comment/42424617
has comment: http://stackoverflow.com/comment/42343959

http://stackoverflow.com/a/26837614
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26837391
has body: Obviously, you'll need to modify the implementation of mousePressed() in DotsListener because you don't want to unconditionally add a new dot on every click. I'd suggest changing it to something like this: public void mousePressed(MouseEvent event) { Point hitDot = getHitDot(event); if (hitDot == null) { // no dots hit pointList.add(event.getPoint()); } else { // hit a dot pointList.remove(hitDot); } repaint(); } Since this is homework, I'm not going to write getHitDot for you. I will say that you have the correct idea: loop through all the elements of pointList, testing each Point and immediately returning it if is within a distance SIZE of the mouse press coordinates. You can use the Euclidean distance formula to do the hit test for each dot.
type: Answer
upvote count: 1

http://stackoverflow.com/q/26985038
upvote count: 1
has comment: http://stackoverflow.com/comment/42503782
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42503695
type: Question
has answer: http://stackoverflow.com/a/26985304
accepted answer: http://stackoverflow.com/a/26985304
score: -1
has comment: http://stackoverflow.com/comment/42503728
has comment: http://stackoverflow.com/comment/42503744
has comment: http://stackoverflow.com/comment/42503838
answer count: 1
has comment: http://stackoverflow.com/comment/42503713
has comment: http://stackoverflow.com/comment/42503734
favorite count: 0
has title: Compressing a string in Java
has comment: http://stackoverflow.com/comment/42503841
downvote count: 2
has comment: http://stackoverflow.com/comment/42505516
has body: Not sure why my code isn't working. If I input qwwwwwwwwweeeeerrtyyyyyqqqqwEErTTT, I get qw9w5e2ry5y4qE2ET3T when I should be getting q9w5e2rt5y4qw2Er3T. Run-length encoding (RLE) is a simple "compression algorithm" (an algorithm which takes a block of data and reduces its size, producing a block that contains the same information in less space). It works by replacing repetitive sequences of identical data items with short "tokens" that represent entire sequences. Applying RLE to a string involves finding sequences in the string where the same character repeats. Each such sequence should be replaced by a "token" consisting of: the number of characters in the sequence the repeating character If a character does not repeat, it should be left alone. For example, consider the following string: qwwwwwwwwweeeeerrtyyyyyqqqqwEErTTT After applying the RLE algorithm, this string is converted into: q9w5e2rt5y4qw2Er3T In the compressed string, "9w" represents a sequence of 9 consecutive lowercase "w" characters. "5e" represents 5 consecutive lowercase "e" characters, etc. Write a program that takes a string as input, compresses it using RLE, and outputs the compressed string. Case matters - uppercase and lowercase characters should be considered distinct. You may assume that there are no digit characters in the input string. There are no other restrictions on the input - it may contain spaces or punctuation. There is no need to treat non-letter characters any differently from letters. public class Compress{ public static void main(String[] args){ System.out.println("Enter a string: "); String str = IO.readString(); int count = 0; String result = ""; for (int i=1; i&lt;=str.length(); i++) { char a = str.charAt(i-1); count = 1; if (i-2 &gt;= 0) { while (i&lt;=str.length() &amp;&amp; str.charAt(i-1) == str.charAt(i-2)) { count++; i++; } } if (count==1) { result = result.concat(Character.toString(a)); } else { result = result.concat(Integer.toString(count).concat(Character.toString…

http://stackoverflow.com/comment/42508898
comment on: http://stackoverflow.com/q/26988287
has text: For my information, what is the difference between `System.getProperty("line.separator")` and `"\n"` ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42356645
comment on: http://stackoverflow.com/a/26902058
type: AnswerComment
has text: I m really Newbie. i found .apk file and i extract it. using apktool. but this source code many error. and R.java not found in source code. so only ids in Mainactivity.java How solve this problem.
score: 0
type: Comment

http://stackoverflow.com/q/26972858
has title: Why is the result of Byte.parseByte recognised as an integer?
linked to: http://stackoverflow.com/q/15533497
upvote count: 1
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26972918
possible better answer: http://stackoverflow.com/a/26972902
duplicate of: http://stackoverflow.com/q/15533497
has comment: http://stackoverflow.com/comment/42481166
has answer: http://stackoverflow.com/a/26972902
tagged with: type-conversion
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/26972917
favorite count: 0
has body: I'm a beginner to Java, I'm fooling around with primitive numerical types, and when I parse String to Byte I can't work with the resulting byte variable (I'm squaring it), as error returned "is type mismatch: cannot convert from int to byte." static byte squareByte(String p1){ //parse String to byte byte result = Byte.parseByte(p1); //return type byte return result * result; } I've used "System.out.println( ((Object)result).getClass().getName());" to determine the variable type after parsing to byte, and it prints that it is byte, so why do I get an error regarding the result being an int? I find I have to parseByte and then cast Byte just for the multiplication to work, can somebody explain why I have this problem with both Byte and Short, but not with any other primitive numerical type?
has comment: http://stackoverflow.com/comment/42481336
has answer: http://stackoverflow.com/a/26972918
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/26991291
favorite count: 0
has title: Java - local variables in static method
tagged with: static
type: Question
has comment: http://stackoverflow.com/comment/42514057
has answer: http://stackoverflow.com/a/26991395
linked to: http://stackoverflow.com/q/10645914
upvote count: 3
score: 0
has body: Since inside static methods we: Cannot make static reference to a non-static field Then a local variable in a static method SHOULD be static as well. But according to this answer here: Are local variables in static methods also static? Local variables in static methods are just local variables in a static method. They're not static, and they're not special in any way. There is a conflict between my deduction (2) and the statement taken from Ernests answer (3) which I cannot explain. Could someone explain if my deduction is wrong, and why is that? And if I am not wrong what is the correct answer to the question "Are local variables in static methods also static" ? EDIT: I am NOT confused by what a local variable OR a member variable (field) OR a static is. I just thought that: IF "static methods cannot make reference to non static field" AND "fields are variables" THEN "variables in static methods are also static" making a variable in a static method both local &amp;&amp; static Thank you.
tagged with: java
has comment: http://stackoverflow.com/comment/42550916
downvote count: 3
has comment: http://stackoverflow.com/comment/42513990
has answer: http://stackoverflow.com/a/26992527
has comment: http://stackoverflow.com/comment/42540060
has answer: http://stackoverflow.com/a/26991340
answer count: 4
possible better answer: http://stackoverflow.com/a/26991343
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42520615
has answer: http://stackoverflow.com/a/26991343
accepted answer: http://stackoverflow.com/a/26991340

aes
tags question: http://stackoverflow.com/q/26935310
type: Tag
tags question: http://stackoverflow.com/q/26849580
tags question: http://stackoverflow.com/q/26909877
tags question: http://stackoverflow.com/q/26895014
tags question: http://stackoverflow.com/q/26920906
tag name: aes
tags question: http://stackoverflow.com/q/26950251
tags question: http://stackoverflow.com/q/26981264

http://stackoverflow.com/a/26979710
has comment: http://stackoverflow.com/comment/42494582
answers question: http://stackoverflow.com/q/26979602
upvote count: 1
type: Answer
has body: You need to make placeHolder 2D array if you're going to use it as one. private static char[][] placeHolder = new char[9][];
downvote count: 0
has comment: http://stackoverflow.com/comment/42494591
score: 1

http://stackoverflow.com/comment/42451373
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26955733
has text: why not you place the image along your .java files and get it through getClass().getResource(your fileName.extension) ?
score: 0

http://stackoverflow.com/comment/42321925
comment on: http://stackoverflow.com/q/26881056
type: QuestionComment
has text: If I knew what 'that' referred to, I might be able to answer.
score: 1
type: Comment

http://stackoverflow.com/comment/42333106
type: Comment
score: 1
has text: I'm glad my comment helped you :)
comment on: http://stackoverflow.com/a/26889487
type: AnswerComment

http://stackoverflow.com/a/26964484
answers question: http://stackoverflow.com/q/26964436
has comment: http://stackoverflow.com/comment/42466952
downvote count: 1
has comment: http://stackoverflow.com/comment/42467002
has body: process.waitFor() which will return the error level of the command, then simply create a new Exception (probably an IOException)... public class Ex { public static void main(String[] args) { try { Process process = Runtime.getRuntime().exec("echo -n $(date)|xclip --selection clipboard"); int exitCode = process.waitFor(); if (exitCode != 0) { throw new IOException("Command exited with " + exitCode); } } catch (Exception ex) { ex.printStackTrace(); } } } You might also consider using ProcessBuilder over Runtime.getRuntime().exec public static void main(String[] args) { try { ProcessBuilder pb = new ProcessBuilder( "echo", "-n", "$(date)|xclip", "--selection", "clipboard" ); pb.redirectError(); pb.inheritIO(); Process process = pb.start(); // Really should be reading the Process's InputStream int exitCode = process.waitFor(); if (exitCode != 0) { throw new IOException("Command exited with " + exitCode); } } catch (Exception ex) { ex.printStackTrace(); } }
type: Answer
has comment: http://stackoverflow.com/comment/42466996
score: 2
upvote count: 3

http://stackoverflow.com/comment/42501361
score: 0
type: QuestionComment
has text: Heya! Just to confirm, are you looking to get a String at the end of the day, or an array of Strings that happen to be the first three?
type: Comment
comment on: http://stackoverflow.com/q/26983563

http://stackoverflow.com/q/26958160
tagged with: image
answer count: 2
upvote count: 0
tagged with: url
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/26958717
has body: I have array list with images url. Then I am creating images, but only one is showing in scroll panel. There is my code : try{ for (int i = 0; i &lt; arrayName.size(); i++) { String url2 = arrayName.get(i); JLabel picLabel = new JLabel(new ImageIcon(new URL(url2))); picLabel.setSize(100,100); scrollPane.add(picLabel); lol.add( scrollPane); System.out.println(url2); } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } Can any one help me?
type: UnansweredQuestion
has title: ArrayList with images JAVA
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26958252
tagged with: java
score: -1

http://stackoverflow.com/a/26843485
score: 2
answers question: http://stackoverflow.com/q/26843457
downvote count: 0
has comment: http://stackoverflow.com/comment/42250685
has comment: http://stackoverflow.com/comment/42250729
has comment: http://stackoverflow.com/comment/42250877
type: Answer
has comment: http://stackoverflow.com/comment/42251094
has comment: http://stackoverflow.com/comment/42252147
upvote count: 2
has comment: http://stackoverflow.com/comment/42250577
has comment: http://stackoverflow.com/comment/42250886
has comment: http://stackoverflow.com/comment/42251170
has comment: http://stackoverflow.com/comment/42250440
has comment: http://stackoverflow.com/comment/42252041
has body: n[i] = scan.nextLine(); You are assigning a String to an int variable. You can't do that. You should probably display an error message prompting the user to enter only digits. If you wish to display the invalid input to the user, store the String returned by scan.nextLine() in a String variable.

http://stackoverflow.com/comment/42238963
score: 1
has text: I know it. its comparing using String. But i am using pojo class and it cannot be compared like that. If u have any idea please share.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26836638

http://stackoverflow.com/q/26948583
answer count: 1
has comment: http://stackoverflow.com/comment/42438966
has comment: http://stackoverflow.com/comment/42438984
has comment: http://stackoverflow.com/comment/42439269
has comment: http://stackoverflow.com/comment/42439031
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42439596
has body: I read that you can use labels to control which loops to break and continue if you have nested loops. I tried doing that in the code below, but when the outer loop is supposed to break when the cabinet is selected, it doesn't and just loops back the dining room loop, only breaking the kitchen loop. //Same imports used from the original code as needed. import java.net.MalformedURLException; import java.util.Scanner; import javax.swing.JOptionPane; import java.net.URL; import javax.swing.ImageIcon; public class LoopyHauntedHouse { private String name; //Player name. private String location0; //First location selected from door. private String toFrontDoor = ""; private String atFrontDoor; //Method asking for user's name, and welcoming the user as well as asking where they'd like to go for the first time. public void intro()throws MalformedURLException { //URL to image initialized from the original code as needed. URL frontDoor = new URL("http://i.imgur.com/2m3giQk.png"); //Scanner for user input. Scanner scnr = new Scanner(System.in); //Asking for user's name and welcoming the user. name = JOptionPane.showInputDialog(null, "What is your name?"); JOptionPane.showMessageDialog(null, "Welcome " + name + " to the Haunted House!"); //Shows starting location. JOptionPane.showMessageDialog(null, name + " you're at the front door of the haunted house.", "Title", JOptionPane.PLAIN_MESSAGE, new ImageIcon(frontDoor)); //Asks for first choice of room to start at. location0 = JOptionPane.showInputDialog(null, name + " where to next? 'Living Room', 'Dining Room' or 'Stairs'?"); } //Method for the rest of the program allowing users to walk through the house, backtrack, and interact with objects. public void startWalking()throws MalformedURLException { //URLs to images are initialized from the original code as needed. URL stairs = new URL("http://i.imgur.com/WuddJUc.png"); URL bedroom1 = new URL("http://i.imgur.com/HZ6OSyZ.png"); URL bedroom2 = new URL("http://i.imgur.com/JZORNpd.png"…
has comment: http://stackoverflow.com/comment/42439655
score: 0
has comment: http://stackoverflow.com/comment/42439319
has answer: http://stackoverflow.com/a/26948709
has title: Java Label Loop Break

http://stackoverflow.com/a/33429996
type: Answer
has comment: http://stackoverflow.com/comment/117141002
answers question: http://stackoverflow.com/q/26976624
upvote count: 1
has body: For your First option can you please try adding this header too and sending the request? .header("Accept","application/json")
has comment: http://stackoverflow.com/comment/117231340
score: 0
downvote count: 1
has comment: http://stackoverflow.com/comment/108267181

http://stackoverflow.com/a/28823633
upvote count: 1
answers question: http://stackoverflow.com/q/26889416
type: Answer
has body: In Spring boot, you should config your datasource config in application.properties. For example: spring.datasource.url=jdbc:postgresql://localhost:5432/activiti_development spring.datasource.username=postgres spring.datasource.password=postgres spring.datasource.driver-class-name=org.postgresql.Driver Reference: http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-sql.html
score: -1
downvote count: 2

http://stackoverflow.com/q/26979817
tagged with: arrays
linked to: http://stackoverflow.com/q/17515096
score: -1
has title: Read word from file to array and select a word randomly form array
downvote count: 2
has answer: http://stackoverflow.com/a/26980068
answer count: 3
has comment: http://stackoverflow.com/comment/42495533
upvote count: 1
linked to: http://stackoverflow.com/q/363681
has comment: http://stackoverflow.com/comment/42493996
possible better answer: http://stackoverflow.com/a/26979981
has answer: http://stackoverflow.com/a/26979981
favorite count: 0
has comment: http://stackoverflow.com/comment/42496585
accepted answer: http://stackoverflow.com/a/26996205
has body: Trying to read about 25,000 words from file and put it in arraylist and selects random word from the arraylist. Stuck at creating array, filling array, randomly selecting the word in the array. But got a weird result. Code: package se.simple; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.*; public class WordHandler { public static void main(String[] args) { List&lt;String&gt; words = new ArrayList&lt;String&gt;(); try (BufferedReader br = new BufferedReader(new FileReader("/Users/FOOOOO/NetBeansProjects/ss/words.txt"))) { String sCurrentLine; while ((sCurrentLine = br.readLine()) != null) { words.add(sCurrentLine); System.out.println(words); } } catch (IOException e) { e.printStackTrace(); } } } Everything is printed out in one line. But now I need to randomly select a word from arraylist. [10th, 1st, 2nd, 3rd, 4th, 5th, 6th, 7th, 8th, 9th, a, AAA, AAAS, Aarhus, Aaron, AAU, ABA, Ababa, aback, abacus, abalone, abandon, abase, abash, abate, abater, abbas, abbe, abbey, abbot, Abbott, abbreviate, abc, abdicate, abdomen, abdominal, abduct, Abe, abed, Abel, Abelian, Abelson, Aberdeen, Abernathy, aberrant, aberrate, abet, abetted, abetting, abeyance, abeyant, abhorred, abhorrent, abide, Abidjan, Abigail, abject, ablate, ablaze, able, ablution, Abner, abnormal, Abo, aboard, abode, abolish, abolition, abominable, abominate, aboriginal, aborigine, aborning, abort, abound, about, above, aboveboard, aboveground, abovementioned, abrade, Abraham, Abram, Abramson, abrasion, abrasive, abreact, abreast, abridge, abridgment, abroad, abrogate, abrupt, abscess, abscissa, abscissae, absence, absent, absentee, absenteeism, absentia, absentminded, absinthe, absolute, absolution, absolve, absorb, absorbent, absorption, absorptive, abstain, abstention, abstinent, abstract, abstracter, abstractor, abstruse, absurd, abuilding, abundant, abusable, abuse, abusive, abut, abutted, abutting, abysmal, abyss, Abyssinia, AC, academe, academia, …
has comment: http://stackoverflow.com/comment/42496056
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26996205
type: Question
has comment: http://stackoverflow.com/comment/42495501
has comment: http://stackoverflow.com/comment/42494077

http://stackoverflow.com/a/26885364
has body: A jar is missing in your classpath: org.aspectj aspectjweaver ${aspectjweaver.version}
has comment: http://stackoverflow.com/comment/42326212
type: Answer
accepted answer of: http://stackoverflow.com/q/26885301
answers question: http://stackoverflow.com/q/26885301
upvote count: 4
has comment: http://stackoverflow.com/comment/42328622
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/42420679
score: 0
type: AnswerComment
type: Comment
has text: I've installed MinGW and now i have a GUI showing me some packages what next?
comment on: http://stackoverflow.com/a/26937734

http://stackoverflow.com/q/26870312
tagged with: java
tagged with: eclipse
type: Question
has title: Why does this Java code generate an error in one Eclipse project but not the other?
score: 0
tagged with: autoboxing
answer count: 1
tagged with: type-mismatch
accepted answer: http://stackoverflow.com/a/26870313
has answer: http://stackoverflow.com/a/26870313
type: AnsweredQuestion
has body: I have the following test class in a file named Sandbox.java: package cas; public final class Sandbox { public static void main(String[] args) { int primitive = 42; Integer boxed = primitive; } } This is something I would expect to work because of autoboxing. However, it failed to compile with the error: "Type mismatch: cannot convert from int to Integer". To isolate the test case, I put the file in a different Eclipse project, where the code is exactly identical except that package cas; is replaced with package sandbox. In this project, it compiled normally. I am using compiler compliance level 1.8, with what I believe is the most up to date JDK. Since autoboxing was introduced in 1.5 if I recall correctly, there shouldn't be any issues with int –> Integer conversion, or so I thought. I checked the Properties for both projects, and every page with the "Enable project specific settings" checkbox has it disabled. So there should be no difference between the two projects' compilation, no? I don't understand why this code would ever give an error in a Java 1.8 environment.

http://stackoverflow.com/a/26980306
has comment: http://stackoverflow.com/comment/42537324
has comment: http://stackoverflow.com/comment/42554251
has comment: http://stackoverflow.com/comment/42536668
type: Answer
has comment: http://stackoverflow.com/comment/71704430
has comment: http://stackoverflow.com/comment/42533970
answers question: http://stackoverflow.com/q/26974835
has comment: http://stackoverflow.com/comment/42519806
has body: As stated on the spring.io blog regarding the Spring 4.1 release: JSONP is now supported with Jackson. For response body methods declare an @ControllerAdvice as shown below. For View-based rendering simply configure the JSONP query parameter name(s) on MappingJackson2JsonView. @ControllerAdvice private static class JsonpAdvice extends AbstractJsonpResponseBodyAdvice { public JsonpAdvice() { super("callback"); } } [...] In 4.1 an @ControllerAdvice can also implement ResponseBodyAdvice in which case it will be called after the controller method returns but before the response is written and therefore committed. This has a number of useful applications with @JsonView the JSONP already serving as two examples built on it. Javadoc taken from MappingJackson2JsonView: Set JSONP request parameter names. Each time a request has one of those parameters, the resulting JSON will be wrapped into a function named as specified by the JSONP request parameter value. The parameter names configured by default are "jsonp" and "callback". You don't need to implement this stuff by yourself. Just reuse the bits from the Spring Framework. Spring Boot example Following simple Spring Boot application demonstrates use of build in JSONP support in Spring MVC 4.1. Example requires at least Spring Boot 1.2.0.RC1. import com.fasterxml.jackson.annotation.JsonAutoDetect; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.web.HttpMessageConverters; import org.springframework.context.annotation.Bean; import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.mvc.method.annot…
has comment: http://stackoverflow.com/comment/42525072
accepted answer of: http://stackoverflow.com/q/26974835
has comment: http://stackoverflow.com/comment/42552391
score: 12
upvote count: 12
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26893359
has body: You always use the following, when connecting to WebSphere, not your own class. environment.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); It is required to correctly connect to WAS. For the second property you need to provide bootstrap port not http. Usually it is 2809, look for the following message in SystemOut.log: 00000001 NameServerImp A NMSV0018I: Name server available on bootstrap port 2809. You will also need specific jars for your client to connect to WAS JMS. See Installing and configuring the Thin Client for JMS with WebSphere Application Server
score: 1
answers question: http://stackoverflow.com/q/26892729
accepted answer of: http://stackoverflow.com/q/26892729
upvote count: 1
has comment: http://stackoverflow.com/comment/42354252
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42354367
has comment: http://stackoverflow.com/comment/42359897

http://stackoverflow.com/comment/42442940
has text: I have to check your code later. I am too brainwashed at the moment to properly understand what it is doing. I edited my question with a suggestion. The method now works a bit better but there are still cases, where an infinite loop occurs or a wrong insertion index is returned (0, 5, 5, 6, 6, 7, 7, 8, 9, 9 suggests an insertion an pos 0 and not at pos 1)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26950666

http://stackoverflow.com/a/26911373
has comment: http://stackoverflow.com/comment/42372368
has body: The second method probably throws exception ConcurrentModificationException because you change list during its iteration. Try use GoogleGuava with nice function filter: protected List&lt;Car&gt; filterByNote(final String note, List&lt;Car&gt; cars) { return new ArrayList(Collections2.filter(cars, new Predicate&lt;Car&gt;() { @Override public boolean apply(Car input) { return input.getNotes != null &amp;&amp; !input.getNotes.isEmpty() &amp;&amp; input.getNotes().contains(note); } })); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26911003

http://stackoverflow.com/q/26935341
tagged with: java
tagged with: jboss
type: Question
has title: Glassfish or JBoss server needs JDK or is it enoug with JRE
has comment: http://stackoverflow.com/comment/42415092
has comment: http://stackoverflow.com/comment/42415138
tagged with: glassfish
has comment: http://stackoverflow.com/comment/42415464
score: 0
answer count: 0
type: UnansweredQuestion
has body: I want to Install a Glassfish or JBoss server in a computer wuthout GUI. I would like to know if I must install JDK or if it is enough with JRE to run my JavaEE applications?

http://stackoverflow.com/q/26945281
tagged with: jax-rs
favorite count: 0
has answer: http://stackoverflow.com/a/26946055
tagged with: rest
linked to: http://stackoverflow.com/q/26702196
has body: Hi All I was trying to create a rest web-service from scratch. Here is my Service part @Path("/Phones") public class PhonessResource { @GET @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON}) public Response getAllNumbers(){ List&lt;PhoneDetail&gt; list = PhoneDirectoryDao.getInstance().getAllNumbers(); GenericEntity&lt;List&lt;PhoneDetail&gt;&gt; entity = new GenericEntity&lt;List&lt;PhoneDetail&gt;&gt;(list) {}; Response response =Response.ok(entity).status(200).build(); return response;//PhoneDirectoryDao.getInstance().getAllNumbers(); } } My data Model : I a had my getters and setters along with another constructor that take all property ,I didn't paste it to less the question length ,I use the same data model in client and server @XmlRootElement(name="PhoneDetail") @XmlAccessorType(XmlAccessType.FIELD) @XmlType(propOrder={"id","firstName","lastName","address","phoneNo","timeStamp"}) public class PhoneDetail { private int id; private String firstName; private String lastName; private String address; private String phoneNo; private Timestamp timeStamp; public PhoneDetail() {} } Then I create a java client to test the service .I am using NETBEANS IDE ,so I choose default option in IDE to create it Thus I create a Jersey Client public class PhoneCLient { private WebTarget webTarget; private Client client; private static final String BASE_URI = "http://localhost:8080/Phones/webresources"; public PhoneCLient() { client = javax.ws.rs.client.ClientBuilder.newClient(); webTarget = client.target(BASE_URI).path("Items"); } public &lt;T&gt; T getAllNumbers_XML(Class&lt;T&gt; responseType) throws ClientErrorException { WebTarget resource = webTarget; return resource.request(javax.ws.rs.core.MediaType.APPLICATION_XML).get(responseType); } public &lt;T&gt; T getAllNumbers_JSON(Class&lt;T&gt; responseType) throws ClientErrorException { WebTarget resource = webTarget; return resource.request(javax.ws.rs.core.MediaType.APPLICATION_JSON).get(responseType); } } But I…
accepted answer: http://stackoverflow.com/a/26946055
tagged with: jersey-client
type: Question
type: AnsweredQuestion
upvote count: 9
tagged with: java
tagged with: jaxb
score: 9
has title: Glassfish :MessageBodyProviderNotFoundException in Jersy Client
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26969773
has comment: http://stackoverflow.com/comment/42593532
upvote count: 10
tagged with: servlets
type: Question
score: 9
has comment: http://stackoverflow.com/comment/42591586
has comment: http://stackoverflow.com/comment/42639487
tagged with: jquery
has comment: http://stackoverflow.com/comment/42591169
favorite count: 0
tagged with: ajax
has title: Request Dispatcher causing $.get of jQuery to alert the text of the page
tagged with: get
answer count: 3
has comment: http://stackoverflow.com/comment/42591508
has body: for example : i have a js like : $.get('Test_Controller.html',function(response){ alert(response); }); and in my Test_Controller.html servlet i have : request.setAttribute("test","testData"); RequestDispatcher requestDispatcher = request.getRequestDispatcher("/test.jsp"); requestDispatcher.forward(request,response); Question is : why is that the response will always alert the text content of the test.jsp and not the JSON that i passed through the getWriter() EDIT : I need to get the : TestData testData = new TestData(); request.setAttribute("test",testData); using jQuery's $.get() so the page won't reload, but unfortunately when i didn't do dispatch my response object seems to be null and when i do dispatch and forward, when i alert the response it alerts the text of the page.
has answer: http://stackoverflow.com/a/27036000
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27035761
downvote count: 1
has comment: http://stackoverflow.com/comment/42591362
has answer: http://stackoverflow.com/a/27123203
tagged with: java

http://stackoverflow.com/q/26896316
favorite count: 0
accepted answer: http://stackoverflow.com/a/26896386
possible better answer: http://stackoverflow.com/a/26897519
tagged with: multithreading
has body: I created a FutureTask in an analog way to what is presented in Brian Goetz's book Java Concurrency in Practice (the code sample can be found here, listing 5.12). The problem is that the task times out even if given 10 seconds. The task just returns true so there shouldn't be a reason for it to happen: public static void main(String[] args) throws Exception { FutureTask&lt;Boolean&gt; task = new FutureTask&lt;&gt;(new Callable&lt;Boolean&gt;() { @Override public Boolean call() throws Exception { return true; } }); System.out.println(task.get(10, TimeUnit.SECONDS)); } This code prints: Exception in thread "main" java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(Unknown Source) at Main.main(Main.java:19)
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26896386
downvote count: 0
tagged with: java
tagged with: concurrency
type: Question
has title: Futuretask doesn't work
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/26897519

http://stackoverflow.com/q/26889801
tagged with: java
has title: Complex Ebean Query
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/26899396
accepted answer: http://stackoverflow.com/a/26899396
tagged with: playframework
upvote count: 1
favorite count: 0
downvote count: 0
tagged with: ebean
type: AnsweredQuestion
has body: i am trying to make ebean query for this case: i want to filter users based on their last_update_time and update_frequency(in days) the query should get the users when last_update_time.plusDays(update_frequency)&lt;now(). my query now looks like this: List&lt;User&gt; users = Ebean.find(User.class).where().lt("last_update_time",DateTime.now()).findList(); i need to add update_frequency to the last_update_time. any idea how to do this?
score: 1

http://stackoverflow.com/a/26962729
score: 1
type: Answer
answers question: http://stackoverflow.com/q/26962589
upvote count: 1
has body: If you want to use @Inheritance, you can't have those join_tables. With those join tables, your model says: one value can belong to multiple master rows one master row can belong to multiple value rows If you just want: 1 master belongs to 1 value row, than use this: master (id, ...) value1 (masterId, ...) value2 (masterId, ...) With @Inheritance(strategy=InheritanceType.JOINED). For more information have a look here: http://en.wikibooks.org/wiki/Java_Persistence/Inheritance BUT: Whenever you use @Inheritance you will have to create a separate @Entity class for everything. If you really need the 5 table layout from above, use @ManyToMany. Basically JPA is made for Mapping Java Objects to SQL Tables, not the other way round ;) If you need to do thing's which aren't possible using JPA (or too complicated), you can always use JDBC and craft your queries and Entity mappings by hand.
downvote count: 0

http://stackoverflow.com/comment/42287607
has text: http://www.w3.org/DesignIssues/MatrixURIs.html
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26850419
type: Comment

http://stackoverflow.com/q/26886708
type: AnsweredQuestion
tagged with: java
tagged with: methods
has comment: http://stackoverflow.com/comment/42327869
has body: Hey ho everybody I need some help I want to change the Color from my JFrame I know that I can remove the border with "setUndecorated(true)" but now I want to customize this Border. Are there any methods to customize my JFrame border?? Thank you for your help.
type: Question
has answer: http://stackoverflow.com/a/26886857
accepted answer: http://stackoverflow.com/a/26886857
has comment: http://stackoverflow.com/comment/42328001
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42327921
tagged with: jframe
has title: JFrame Change Border Color
has comment: http://stackoverflow.com/comment/42327893
tagged with: swing
linked to: http://stackoverflow.com/q/2482971

http://stackoverflow.com/q/26832697
linked to: http://stackoverflow.com/q/4921827
has body: I'm trying to update some of my old Scala code to new APIs. In one of the libraries I use, a case class has been converted to a simple POJO for compatibility reasons. I was wondering if it is still possible somehow to use pattern matching for the Java class. Imagine I have a simple Java class like: public class A { private int i; public A(int i) { this.i = i; } public int getI() { return i; } } After compilation, I would like to use it in pattern matching somehow like: class Main extends App { val a = ... a match { case _ @ A(i) =&gt; println(i); } } For the code above, I obviously get an error: Main.scala:7: error: object A is not a case class constructor, nor does it have an unapply/unapplySeq method. Is there any trick I could use here? Thanks in advance!
answer count: 3
favorite count: 0
tagged with: scala
has answer: http://stackoverflow.com/a/27013851
has title: Pattern matching on POJOs in Scala?
has answer: http://stackoverflow.com/a/26832840
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: scala-2.11
type: Question
has answer: http://stackoverflow.com/a/26839951
accepted answer: http://stackoverflow.com/a/26839951
possible better answer: http://stackoverflow.com/a/26832840
upvote count: 3

http://stackoverflow.com/q/26879408
tagged with: jcheckbox
has answer: http://stackoverflow.com/a/26879472
has comment: http://stackoverflow.com/comment/42315973
type: Question
score: 0
tagged with: swing
answer count: 1
has title: How do I draw a rectangle every time I click on a JCheckBox?
tagged with: java
type: UnansweredQuestion
has body: I am trying to draw a filled rectangle whose color corresponds to the checkbox. The rectangle is to be randomly sized and placed on the JPanel. So far, I have gotten the rectangle to draw to the JPanel with a random size and random location, but I am having trouble with drawing a rectangle when a checkbos is selected. The code in my ActionListener serves no purpose to the running of my project and I have tried other things, but am having trouble. package colorViewerCheck; public class ColorViewerCheckFrame extends JFrame { private static final int FRAME_WIDTH = 300; private static final int FRAME_HEIGHT = 400; private JPanel colorPanel; private JCheckBox redCheckBox; private JCheckBox greenCheckBox; private JCheckBox blueCheckBox; public ColorViewerCheckFrame() { createColorPanel(); createControlPanel(); setSize(FRAME_WIDTH, FRAME_HEIGHT); } public void createControlPanel() { class ColorListener implements ActionListener { public void actionPerformed(ActionEvent event) { if (redCheckBox.isSelected()) {createColorPanel();} if (greenCheckBox.isSelected()) {createColorPanel();} if (blueCheckBox.isSelected()) {createColorPanel();} } } ActionListener listener = new ColorListener(); redCheckBox = new JCheckBox("Red"); greenCheckBox = new JCheckBox("Green"); blueCheckBox = new JCheckBox("Blue"); redCheckBox.setSelected(true); JPanel controlPanel = new JPanel(); controlPanel.add(redCheckBox); controlPanel.add(greenCheckBox); controlPanel.add(blueCheckBox); redCheckBox.addActionListener(listener); greenCheckBox.addActionListener(listener); blueCheckBox.addActionListener(listener); add(controlPanel, BorderLayout.SOUTH); } public void createColorPanel() { class RectangleComponent extends JComponent { private int x; private int y; private int width; private int height; private Random rand; public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; rand = new Random(); x = rand.nextInt(250); y = rand.nextInt(350); width = rand.nextInt(50); height = rand.nextInt(50)…

http://stackoverflow.com/q/26838219
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42242355
tagged with: eclipse
downvote count: 1
has body: Good day, I am creating an Android program that connects to MS SQL 2012 database on a remote server.. Im currently using Eclipse Juno.. my code works on Eclipse Helius but when I transfer my code to Juno, I encounter problems with connecting to database... I already added drivers such as "mysql-connector-java-5.1.33" and "jtds-1.2.5" Here is my code: Connection conn = null; int a = 0; try { Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance(); String connString = "jdbc:jtds:sqlserver://xxx.xxx.xxx.xxx:1433/SAMPLEDB;encrypt=false;user=XX;password=XXXXXXX;instance=SQLEXPRESS;"; String username = "XX"; String password = "XXXXXXX"; String sql = ""; conn = DriverManager.getConnection(connString, username, password); a++; Statement stmt = conn.createStatement(); a++; sql = "Select * from NUMBERFILE"; ResultSet reset = stmt.executeQuery(sql); a++; while(reset.next()) { tDisplayS.setText(reset.getString("NUMBER").toString()); } } catch(Exception e) { Toast.makeText(getApplicationContext(), e.getMessage() + " " + a, Toast.LENGTH_LONG).show(); } I used "a" to indicate where it would stop then it only has a value of 1 so meaning it cant establish connection.. I already searched for similar problems with mine but still no luck.. Please help.. appreciate all your reply.. Thanks!
tagged with: mssql-jdbc
has comment: http://stackoverflow.com/comment/42243395
type: UnansweredQuestion
has title: Android: Cant connect with database on Remote Server
tagged with: sql
favorite count: 0
has comment: http://stackoverflow.com/comment/44032618
type: Question
tagged with: android
upvote count: 1
has answer: http://stackoverflow.com/a/27812298

http://stackoverflow.com/q/26892050
has title: Necessity of java web-frameworks when using AngularJS
accepted answer: http://stackoverflow.com/a/26892251
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: javascript
has answer: http://stackoverflow.com/a/26892251
answer count: 1
downvote count: 0
favorite count: 0
tagged with: angularjs
has body: We are currently developing an enterprise web application (Java backend + HTML/JS frontend). This application shall provide cloud-based data analysis functionality to a variety of users. Now, we have decided to use AngularJS for creating the web-frontend. The communication to the backend is realized with REST webservices (implemented in java using jersey, and jetty as webserver). Some time ago, I have already developed simple java web apps using apache wicket just for examplary reasons. Since I am new to AngularJS, I am wondering if there is any reason why it could still be necessary for us to use a java web-framework (such as wicket, gwt, etc.) additionally to Angular JS? The other way around: since we use Angular for developing the web-frontend, we do not need any web-framework on the java side any more, right? I am quite new to java web applications, so any help would really be appreciated :-) Regards
tagged with: web-services

http://stackoverflow.com/comment/42282925
type: AnswerComment
type: Comment
has text: Thanks prageeth..its worked for me.you saved my day.! seems issue is Hibernate version conflict.Thanks again
comment on: http://stackoverflow.com/a/26861199
score: 1

http://stackoverflow.com/a/26968028
type: Answer
answers question: http://stackoverflow.com/q/26967672
downvote count: 0
score: 1
has body: Have you defined the Requestmapping like this: @POST @Path("/submitclient") // your request mapping for 'subUrl' public Object persistResetPasswordLogs(@FormParam("clientName") String clientName) and html: &lt;form action="submitclient" method="post"&gt; ... &lt;/form&gt; Also look at your json object. I believe you should send something like this: var loginData = { clientName: "dit" // get it from input }; ?
upvote count: 1
has comment: http://stackoverflow.com/comment/68270898

http://stackoverflow.com/comment/42471657
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26967437
score: 0
has text: you are getting this url http://localhost:8080/Scheduler/test am i correct

http://stackoverflow.com/a/44149302
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/26991864
downvote count: 0
score: 3
has body: Create file in the user's home directory: /usr/home/username/.java/deployment/security/security/exception.sites Add the sites that should be given exception. https://192.168.70.10 But if you prefer a GUI application, run JControl and create exception site list.

http://stackoverflow.com/a/26960567
has comment: http://stackoverflow.com/comment/42495305
answers question: http://stackoverflow.com/q/26960473
score: 0
has comment: http://stackoverflow.com/comment/42547368
has body: We use newrelic It will let you know which method is used the most, which is the slowest one, db performance and more. That's how we monitor production and we also used it to plan our stress tests. I hope that helps.
type: Answer

http://stackoverflow.com/q/26836850
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42239281
has comment: http://stackoverflow.com/comment/42239785
tagged with: netbeans
answer count: 0
has comment: http://stackoverflow.com/comment/42240022
has comment: http://stackoverflow.com/comment/42246698
tagged with: java
has title: Netbeans GUI Builder Displaying Elements in JTable From Linked List
type: Question
has comment: http://stackoverflow.com/comment/42239764
has comment: http://stackoverflow.com/comment/42241384
has comment: http://stackoverflow.com/comment/42280833
linked to: http://stackoverflow.com/q/9132987
score: 0
tagged with: user-interface
has body: I am using the Netbeans GUI builder to create a desktop Java application. I have a linked list that holds a bunch of objects. I was wondering if there was a way to create a JTable in the Netbeans GUI Builder and have it traverse through my linked list and write various fields of the objects at each node to rows in the table. Obviously, there will be a variable amount of objects in the linked list, so I would also need a way to have this table dynamically adjust its size based on how many elements it is holding. Lastly, I would like to be able to select a row in the table (Just one full row only. No multi-select. No only selecting one cell in the table etc.) and extract the data that is in the selected row. Is there any way to do these things with a JTable in Netbeans? Or should I use a different Swing element for what I want to do? I am open for suggestions. This is what my table looks like now -> https://i.sstatic.net/FWCKW.png There is lots of blank space that I need to get rid of, hence the dynamic part mentioned above.

http://stackoverflow.com/a/26928584
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26926559
type: Answer
answers question: http://stackoverflow.com/q/26926559
has body: That's just stupid. The code works if I don't compare the Documents but transform them to strings and compare these: ByteArrayOutputStream expected = new ByteArrayOutputStream(); storeXml(expectedDocument, expected); ByteArrayOutputStream actual = new ByteArrayOutputStream(); storeXml(actualDocument, actual); assertXMLEqual(expected.toString(), actual.toString()); With: protected static void storeXml(Document document, OutputStream out) throws Exception { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); transformer.transform(new DOMSource(document), new StreamResult(out)); }
score: 0

http://stackoverflow.com/a/26921711
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26903213
type: Answer
has body: Each node has Oracle Coherence running? You can write a bash script that starts Oracle Coherence before start Tomcat.
score: 0
accepted answer of: http://stackoverflow.com/q/26903213

http://stackoverflow.com/comment/42376919
has text: @Tap That was the problem thank you. Fell free to answer..
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26912276

http://stackoverflow.com/a/26885453
downvote count: 0
has body: You don't need to calculate all factors, but you can go in both directions from the number to find its closest number which is the factor of given number Pseduo code will be: n= given number(dividend); x= second number( whose closest number is required) i=0; if(n%x==0) print x; else while(true){ if(n%(x-i)==0){ print x-i break } else if(n%(x+i)==0){ print x+i; break } else i=i+1 }
has comment: http://stackoverflow.com/comment/42356695
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26885198
has comment: http://stackoverflow.com/comment/42340673
type: Answer
has comment: http://stackoverflow.com/comment/42337067
has comment: http://stackoverflow.com/comment/42326107

http://stackoverflow.com/comment/42275285
comment on: http://stackoverflow.com/q/26856664
score: 1
has text: where is your driver class? is it an assignment ?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26926645
answer count: 5
downvote count: 2
tagged with: loops
has answer: http://stackoverflow.com/a/26926891
has comment: http://stackoverflow.com/comment/42399485
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42399542
score: -2
tagged with: java
has title: How to optimize do-while loops?
type: Question
has answer: http://stackoverflow.com/a/26926850
has comment: http://stackoverflow.com/comment/42399470
accepted answer: http://stackoverflow.com/a/26926792
upvote count: 0
has answer: http://stackoverflow.com/a/26926852
favorite count: 0
has answer: http://stackoverflow.com/a/26926845
has body: I want to execute a loop as long as a certain condition applies. At the end, I want to return the value that was last being found inside the loop. Non-realworld example: teststring = " abcde"; String letter = null; do { letter = reader.read(); //reads the teststring char by char } while (letter.equals(" ")); return letter; //return "a" Could this be optimized from the coding point of view, eg transform it from a do-while loop to just a while-loop?
possible better answer: http://stackoverflow.com/a/26926845
has comment: http://stackoverflow.com/comment/42399429
has answer: http://stackoverflow.com/a/26926792

http://stackoverflow.com/q/26863409
has comment: http://stackoverflow.com/comment/42286572
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42286624
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42286531
has answer: http://stackoverflow.com/a/26863452
has title: Deleting entry from SQLite database
has body: I am making an app and a function of this app is to delete an entry from the database, I had the function correctly working using the rowid of the entry but now i want the user to be able to delete the row using a column name. The code that I have at the moment is what I thought would work but it is giving me an error, can anyone help? This is the delete class that I am using: import android.app.Activity; import android.content.Intent; import android.os.Bundle; 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; import com.pinchtapzoom.R; public class Delete extends Activity implements View.OnClickListener{ public EditText item; Button delete; //instansiation the DBAdapter class to db, to call functions from DBApater use db.(function name) DBAdapter db = new DBAdapter(this); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_delete); item = (EditText)findViewById(R.id.edit1); delete = (Button)findViewById(R.id.delete); delete.setOnClickListener(this); } public void onClick(View v) { String deleteItem = item.getText().toString(); //if the ROW ID its a number (long) try{ //long rowID = Long.parseLong(userInput); //call the delete method db.open(); db.deleteContact(deleteItem); db.close(); Toast.makeText(Delete.this,"Item Deleted", Toast.LENGTH_SHORT).show(); }catch(NumberFormatException e){ Log.e("INPUT ERROR","Input is not a number!",e); Toast.makeText(this,"Invalid Value!",Toast.LENGTH_LONG).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.delete, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle click…
tagged with: sqlite
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42286527
tagged with: android
accepted answer: http://stackoverflow.com/a/26863452

http://stackoverflow.com/comment/84526664
score: 1
type: AnswerComment
has text: @CroskCool getEntity on outbound Response, readEntity on inbound Response
comment on: http://stackoverflow.com/a/26864804
type: Comment

http://stackoverflow.com/a/26950332
has comment: http://stackoverflow.com/comment/42442065
has body: Are you sure that you need to use UDP for it? Seems like you should change it to TCP impelementation. Do you want to use netty for it ? See here. 1024 bytes it's normal safe value for UDP datagaram, making it bigger can bring issues with router. (See https://stackoverflow.com/a/13089776/3502543). If you don't want to use netty, you should provide something similar to DelimiterBasedFrameDecoder. edited.
has comment: http://stackoverflow.com/comment/42441924
type: Answer
has comment: http://stackoverflow.com/comment/42442008
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26950236
answers question: http://stackoverflow.com/q/26950236
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42442510
has comment: http://stackoverflow.com/comment/42443127

http://stackoverflow.com/q/26973152
has comment: http://stackoverflow.com/comment/42481839
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42481692
has answer: http://stackoverflow.com/a/26973223
has title: How to pass another class strings to Jlabel API
type: AnsweredQuestion
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/26973223
has comment: http://stackoverflow.com/comment/42481563
tagged with: java
score: -4
has body: How set text in Jlabel: PsoMath1.java class contains method (print soliution) int printSolution() { // Find solution particle. int i = 0; for(; i &lt; particles.size(); i++) { if(testProblem(i) == TARGET){ break; } } // Print it. **System.out.println("Particle " + i + " has achieved target.");** for(int j = 0; j &lt; MAX_INPUTS; j++) { if(j &lt; MAX_INPUTS - 1){ System.out.print(particles.get(i).data(j) + " + "); }else{ System.out.print(particles.get(i).data(j) + " = " + TARGET); } } // j System.out.print("\n"); return 0; } Pso.java contains Jbutton:here, I want to set the text from another class. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { psomath1 ob =new psomath1(); String n1 = TARGETS.getText(); TARGETT= Integer.parseInt(n1); ob.TARGET=TARGETT; String n2 = MAXINPUTS.getText(); final int MAX_INPUTST = Integer.parseInt(n2); ob.MAX_INPUTS=MAX_INPUTST; String n3 = MAXPARTICLES.getText(); final int MAX_PARTICLEST = Integer.parseInt(n3); ob.MAX_PARTICLES=MAX_PARTICLEST; String n4 = VMAX.getText(); final int V_MAXT = Integer.parseInt(n4); ob.V_MAX =V_MAXT; String n5 = MAXEPOCHS.getText(); final int MAX_EPOCHST = Integer.parseInt(n5); ob.MAX_EPOCHS =MAX_EPOCHST; String n6 = STARTRANGEMIN .getText(); final int START_RANGE_MINT = Integer.parseInt(n6); ob.START_RANGE_MIN =START_RANGE_MINT; String n7 = STARTRANGEMAX.getText(); final int START_RANGE_MAXT = Integer.parseInt(n7); ob.START_RANGE_MIN =START_RANGE_MINT; ob.PSOAlgorithm(); **PRINTIT.setText(Integer.toString(ob.printSolution()));** return; } But the output prints:0. How to print the last iteration value?
downvote count: 4

http://stackoverflow.com/a/27147176
answers question: http://stackoverflow.com/q/26989211
accepted answer of: http://stackoverflow.com/q/26989211
type: AcceptedAnswer
has body: Thanks everyone.! i changed my mysql default port number and config. it was running on port 8080 which is the default port of apache tomcat.so i changed mysql port number to 3306.Now the program run smoothly!!
type: Answer
score: 0

http://stackoverflow.com/q/26885516
has comment: http://stackoverflow.com/comment/42325951
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42325875
has title: Could not find or load main class HelloWorldApp
has answer: http://stackoverflow.com/a/26885657
has answer: http://stackoverflow.com/a/26886348
has answer: http://stackoverflow.com/a/26885763
has comment: http://stackoverflow.com/comment/42325964
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42326259
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/26885589
has body: I got that error while running the program, below are few more details I have created a folder on C drive with name as myapplication I have saved the code with file name as HelloWorldApp.java using notepad. At the command prompt I have c:\myapplication&gt; Then I am typing the following command java -cp . HelloWorldApp, below is how it looks c:\myapplication&gt;java -cp . HelloWorldApp Error: Could not find or load main class HelloWorldApp Kindly help me solve this, so that I can proceed further.
favorite count: 0
has answer: http://stackoverflow.com/a/26885634
has comment: http://stackoverflow.com/comment/42325952
has comment: http://stackoverflow.com/comment/42326046

http://stackoverflow.com/a/26926891
upvote count: 1
answers question: http://stackoverflow.com/q/26926645
score: 1
has body: do { ... } while (&lt;condition&gt;); I am going to explain your question on do/while vs while alone. The do is only a label. It has no impact on efficiency. The while at the bottom is effectively an if(condition) goto line #, where line # is the do. The "do" is simply a way of telling the compiler what number you want in that goto statement at the bottom. Putting the while statement at the top would actually be less efficient because it means the condition has to be evaluated on the first iteration. Perhaps your reader does need to be checked on the first iteration, then it should be a while statement, but that requires more work, you see? Second even transforming it to only a while statement, still places an unconditional goto at the bottom, with a conditional goto on the top, so even though it looks like less code, it could possibly be more.
has comment: http://stackoverflow.com/comment/42401009
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42644407
type: Comment
type: QuestionComment
has text: Clement, i don't think that relates the synchronization protocol. I used "synchronized" before the methods using. Moreover, all methods in this case are the end.
score: 0
comment on: http://stackoverflow.com/q/26910143

http://stackoverflow.com/q/26884948
has comment: http://stackoverflow.com/comment/42325464
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26896109
has body: I want to make a GUI where I have a list where one item can be selected, 3 JButtons, ON, OFF and STATE. When the Jbutton "State" is selected a separate box pops up telling the user if they selected ON / OFF and which parameter they selected from the JList. This is my code so far. The pop up box keeps telling me that the heater is on, because it keeps reading on = true. Also, the part where I try to select off the list is completely wrong aswel for some reason I can't see. import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; public class Heater extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; private Object state; private boolean on; private Object inten; //private JList HeatIntensity; private String intensity[] = {"Level 1", "Level 2", "Level 3", "Level 4", "Level 5"}; public Heater() { super("Heater"); //creating box box(intensity); } public static void main(String[] args){ new Heater(); } @Override public void actionPerformed(ActionEvent ae) { String action = ae.getActionCommand(); //if on button is pressed, on = true if (action.equals("ON")) { on = true; } //if off pressed on = false else if (action.equals("OFF")) { on = false; } if (action.equals("State")) { //if the on/off button was pressed then the state button, a new box pops up telling if on / off if(on = true){ JOptionPane.showMessageDialog(null, "on"); } else if(on = false) JOptionPane.showMessageDialog(null, "The Heawdadwqwdqwdater is off"); } //when somthing is pressed on the list, show that in a new pop up box /*intensity.additemListener( new itemlistener(){ public void itemChanged(ItemEvent event){ if(event.getStateChange() == ItemEvent.SELECTED){ JOptionPane.showMessageDialog(null, ItemEvent.SELECTED); } } } ); */ } public void box(String[] a){ //creating the box this.getContentPane().setLayout(new FlowLayout()); setSize(new Dimension(900, 300)); setDefa…
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42325172
score: 0
answer count: 1
has title: GUI with 3 Jbuttons, and a list that stores the selected buttons/list parameters and can display them separately

http://stackoverflow.com/comment/42238844
comment on: http://stackoverflow.com/a/26836460
has text: I edited the method to fix that bug. The `while` loop condition should be `!input.hasNext("quit")`. You would put the terminating process after the `while` loop exits. This isn't a copy and paste answer to your question as you might be hoping. This answer is illustrating a point.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42290629
score: 0
type: AnswerComment
type: Comment
has text: ${project.home} value is set to be "."
comment on: http://stackoverflow.com/a/26865520

http://stackoverflow.com/comment/42370081
type: QuestionComment
type: Comment
has text: `String` does override `hashCode`.
score: 0
comment on: http://stackoverflow.com/q/26910225

http://stackoverflow.com/comment/42448892
comment on: http://stackoverflow.com/q/26954500
type: Comment
type: QuestionComment
has text: Are you sure that value 12 isn't at location 6? Why do you only read 10 values?
score: 0

http://stackoverflow.com/comment/42295192
type: Comment
type: QuestionComment
score: 2
has text: There will be problems with `array[s+1]`, as the `s` is a valid index, but `s+1`, `s+2`, `s+3` might not.
comment on: http://stackoverflow.com/q/26867929

http://stackoverflow.com/q/26966123
has title: notable to create spinner in fragment
has answer: http://stackoverflow.com/a/26966153
type: UnansweredQuestion
tagged with: java
downvote count: 1
type: Question
score: -1
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/26966203
has comment: http://stackoverflow.com/comment/42469483
favorite count: 0
has body: I am trying to make a custom spinner inside a fragment.But i am not able to make it.The following errors are encountered while creating the spinner.Plese help me out in solving these errors. Errors that are in java file: 1.The method getLayoutInflater(Bundle) in the type Fragment is not applicable for the arguments () GamesFragment.java /dailyexpenses/src/com/example/dailyexpenses line 47 Java Problem 2.No enclosing instance of the type MainActivity is accessible in scope GamesFragment.java /dailyexpenses/src/com/example/dailyexpenses line 31 Java Problem 3.The constructor GamesFragment.MyAdapter(Context, int, String[]) refers to the missing type Context GamesFragment.java /dailyexpenses/src/com/example/dailyexpenses line 31 Java Problem 4.Context cannot be resolved to a type GamesFragment.java /dailyexpenses/src/com/example/dailyexpenses line 38 Java Problem this is my java file package com.example.dailyexpenses; import java.util.ArrayList; import java.util.List; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.Spinner; import android.widget.Toast; import android.widget.ImageView; import android.widget.TextView; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.ViewGroup; public class GamesFragment extends Fragment { String[] Languages = { "Select a Language", "C# Language", "HTML Language", "XML Language", "PHP Language" }; // Declaring the Integer Array with resourse Id's of Images for the Spinners Integer[] images = { 0, R.drawable.icon, R.drawable.petrol, R.drawable.books, R.drawable.recharge}; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_games, container, false); Spinner mySpinner = (Spinner) rootView.findViewById(R.id.spinner1); mySpinner.se…
tagged with: android
has comment: http://stackoverflow.com/comment/42470828
has answer: http://stackoverflow.com/a/26966542

http://stackoverflow.com/comment/42417012
comment on: http://stackoverflow.com/a/26936234
has text: As i understand map transforms one value to other (for example, int -> String). So even if i return Observable<T> from first map, second map will be called immediately with userData of type Observable<T>, but i want it to be called with type T when fetchUserData completes
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/26893139
has body: I'm using a common servlet multiple times for various classes. Now i have a requirement that differs with a small validation in using this servlet. So i thought of passing a flag like variable to servlet to meet my requirement. I've browsed to sort this out and found that i can assign variables to URLrequest. I've set the URLRequest in Flex as follows: var request:URLRequest = new URLRequest(UPLOAD_SERVLET_URL); request.method = URLRequestMethod.POST; var variables:URLVariables=new URLVariables(); variables.name="xyz"; request.data=variables; file.upload(request); In Java Servlet : protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // How to use the variables here...?? } I'm going in the right direction? If so, can anyone please help me out. If not, guide me the way how to do it !!
answer count: 1
has title: How to modify POST method in servletRequest?
accepted answer: http://stackoverflow.com/a/26893225
tagged with: actionscript-3
tagged with: apache-flex
tagged with: flex3
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/26893225

http://stackoverflow.com/a/26902641
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26901753
answers question: http://stackoverflow.com/q/26901753
type: Answer
score: 1
upvote count: 1
has body: We're tracking this as Issue 1083.
has comment: http://stackoverflow.com/comment/42357164

http://stackoverflow.com/a/26984432
type: Answer
answers question: http://stackoverflow.com/q/26959545
has body: While the contract of hashCode() is frequently described in terms of the implementer, it's sometimes more useful to think of it from the standpoint of the caller: code which knows that two objects have returned different values for hashCode() is entitled to assume that they cannot possibly be equal. While many descriptions of hashing talk about bucket indices, the issue of hashing goes beyond that. Basically, the purpose of hashCode() is to make it possible to quickly identify large numbers of things that can't possibly equal an item. While it's common to subdivide things into buckets whose hash codes meet various criteria (a bucket of things whose hash code meets some criterion can't contain anything whose hash code does not meet that criterion), that's not the only use for hash codes. If a collection class records the hash code of an items when they are added, it may check whether two instances contain the same sequence of items by first checking whether they contain the same sequence of hash values. If the hash values all match, then it will be necessary to examine the items individually, but if e.g. the hash values of each collections' fiftieth item differs, there's no reason to inspect the first 49 items in detail. Thinking of hash codes in terms of the bold face statement above and its usage and contractual implications will be much clearer than would thinking of it in terms of buckets.
upvote count: 1
score: 1
downvote count: 0

http://stackoverflow.com/a/26836004
has comment: http://stackoverflow.com/comment/42237926
has comment: http://stackoverflow.com/comment/42239511
has comment: http://stackoverflow.com/comment/42308762
has comment: http://stackoverflow.com/comment/42237966
has comment: http://stackoverflow.com/comment/42237805
has comment: http://stackoverflow.com/comment/42237790
has body: This does appear to be thread-safe, however the code is more complex than it needs to be. Plus the use of a lock, comes with a performance cost. It takes time to acquire the lock, and other threads attempting to execute that code are blocked. These 2 concerns could be addressed by using a static initializer and removing synchronization from the getInstance method entirely. The JVM will ensure that this statement is executed exactly once. The result is significantly simpler code, and slightly more-performant code. public class Singleton { private static Singleton mySingleton = new Singleton(); private Singleton() {} public static Singleton getInstance() { return mySingleton; } }
downvote count: 0
has comment: http://stackoverflow.com/comment/42237983
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26835985
has comment: http://stackoverflow.com/comment/42237922
score: 1

http://stackoverflow.com/a/26922065
upvote count: 4
has body: As stated in the comments, it's not exactly a no-op: At the very least, it must perform a null check. Moreover, there may be subclasses of ArrayList working differently. In theory, they could even fetch the data from a database or alike. Normally, nobody would subclass an ArrayList for doing this, but such a List implementation makes some sense. The compiler (JIT, not javac) must be able to prove that it's really a side-effect free. Usually, it's quite simple as it knows, if there are any overriden implementation of ArrayList.size().1 If there are none, then it sees that it's a simple getter and inlines it.23 This reduces to problem to a useless field load, which gets reduces to the null check. The null check can get eliminated too, if it was performed earlier (e.g., due to a previous useless statement :D). Otherwise, it can get moved out of the loop, if arrayList is a loop invariant. Will any Java compiler or JVM ignore this statement for optimization purposes? So I'd conclude that it's quite probable to happen. 1 This may change later as such a class gets loaded and then a deoptimization will take place. 2 Assuming it decides it's worth optimizing. 3 This may fail, if the method is already over inlining limit, e.g., due to bad coding style or because of other inlining.
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/26916336
type: Answer

http://stackoverflow.com/q/26885494
has comment: http://stackoverflow.com/comment/42325876
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I try to switch my Resteasy REST clients (3.0.8) to using the proxy mechanism as this looks really nice to me. I can successfully fire the REST requests, but now I need to map/deserialize the response. Here comes the code: RestRequest.java: ResteasyClient client = new ResteasyClientBuilder().build(); ResteasyWebTarget target = client.target("http://127.0.0.1:8080/backend-1.0-SNAPSHOT/"); CategoryClient categoryClient = target.proxy(CategoryClient.class); categoryList = categoryClient.getCategories(); CategoryClient.java (proxy interface): public interface CategoryClient { @GET @Path("categories") @JsonProperty("categories") @JsonIgnoreProperties(ignoreUnknown = true) @Produces(MediaType.APPLICATION_JSON) public List&lt;Category&gt; getCategories(); Category.java (target model): public class Category { private Long id; private String name; private List&lt;Asset&gt; assetList; // getter &amp; setters } JSON reply I get and need to map: { "_links" : { "self" : { "href" : "http://127.0.0.1:8080/backend-1.0-SNAPSHOT/categories{?page,size,sort}", "templated" : true }, "search" : { "href" : "http://127.0.0.1:8080/backend-1.0-SNAPSHOT/categories/search" } }, "_embedded" : { "categories" : [ { "name" : "monkeys", "_links" : { "self" : { "href" : "http://127.0.0.1:8080/backend-1.0-SNAPSHOT/categories/0" }, "assetList" : { "href" : "http://127.0.0.1:8080/backend-1.0-SNAPSHOT/categories/0/assetList" } } }, { "name" : "donkeys", "_links" : { "self" : { "href" : "http://127.0.0.1:8080/backend-1.0-SNAPSHOT/categories/1" }, "assetList" : { "href" : "http://127.0.0.1:8080/backend-1.0-SNAPSHOT/categories/1/assetList" } } } ] }, "page" : { "size" : 20, "totalElements" : 5, "totalPages" : 1, "number" : 0 } } Now I need a mechanism to map the response to List&lt;Category&gt;, currently it is only giving a javax.ws.rs.client.ResponseProcessingException: javax.ws.rs.ProcessingException: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.util.ArrayLis…
has comment: http://stackoverflow.com/comment/42326019
score: 0
has comment: http://stackoverflow.com/comment/42329616
answer count: 1
has answer: http://stackoverflow.com/a/35151183
tagged with: jackson
has title: Resteasy proxy jackson mapping/deserialization
tagged with: resteasy
tagged with: rest
has comment: http://stackoverflow.com/comment/42329422
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/42434317
has text: @MysticMagic Is it listview.notifyDataSetChanged()? But with this, I am getting error message
comment on: http://stackoverflow.com/q/26945918
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26928426
has title: enabling proguard on android failing
score: 0
has answer: http://stackoverflow.com/a/26929935
tagged with: android
accepted answer: http://stackoverflow.com/a/27038318
tagged with: apk
tagged with: proguard
has answer: http://stackoverflow.com/a/27038318
tagged with: encryption
linked to: http://stackoverflow.com/q/4732656
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26929935
type: Question
answer count: 2
has body: i am trying to protect my apk file by using proguard to prevent hackers from easily decompiling my code. I have followed many tutorials online on how to do this but my application crushes when i follow the advice online. The tutorials i have followed are on: Enabling ProGuard in Eclipse for Android http://proguard.sourceforge.net/manual/examples.html#androidapplication http://dominoc925.blogspot.com/2013/12/how-to-obfuscate-android-apk-file-using.html The project.properties file in my source directory looks like : # This file is automatically generated by Android Tools. # Do not modify this file -- YOUR CHANGES WILL BE ERASED! # # This file must be checked in Version Control Systems. # # To customize properties used by the Ant build system edit # "ant.properties", and override values to adapt the script to your # project structure. # # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt # Project target. target=android-18 android.library.reference.1=..\\appcompat_v7 android.library.reference.2=../../adt-bundle-windows-x86_64-20140702/sdk/extras/google /google_play_services/libproject/google-play-services_lib When i attempt to Export the signed apk , the following error is displayed in the console: [2014-11-14 12:41:18 - SMART calculator] Proguard returned with error code 1. See console [2014-11-14 12:41:18 - SMART calculator] proguard.ParseException: Unknown option '(' in argument number 14 [2014-11-14 12:41:18 - SMART calculator] at proguard.ConfigurationParser.parse(ConfigurationParser.java:191) [2014-11-14 12:41:18 - SMART calculator] at proguard.ProGuard.main(ProGuard.java:484) [2014-11-14 12:41:29 - SMART calculator] Proguard returned with error code 1. See console line 14 is the line target=android-18 in the project.properties file. can someone please help me fix this error that i am getting. :)D

http://stackoverflow.com/comment/42440483
type: QuestionComment
comment on: http://stackoverflow.com/q/26949359
score: 0
has text: Let me see if I understand this, are you saying you need to download a zip file and you cannot either store it in memory or disk in your server? Because if that's what you're a suggesting those are quite paradoxical requirements.
type: Comment

http://stackoverflow.com/q/26878979
has comment: http://stackoverflow.com/comment/42322035
type: Question
tagged with: jakarta-ee
tagged with: jpa
has answer: http://stackoverflow.com/a/26884400
score: 0
has body: I used jboss, and hibernate 4 within jpa (JTA transaction type). In a DAOUtil class, I try to get entity manager, I can get it and do a query. But when I flush entity manager, the error happened. Caused by: javax.persistence.TransactionRequiredException: no transaction is in progress at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:970) at com.vms.dao.hibernate.HibernateDAOSession.flush(HibernateDAOSession.java:288) I searched on internet, and they say: if we use jpa with jta transaction type, we must inject EntityManager into a ejb, is this correct? If this is correct, I've a concern: how about threadpool for entity manager? I confused alot of thing about that. Please anyone give my the true way, to use jpa within JTA transaction type. Added. I think this issue because I've a getter to get EntityManager outside EJB. One more question, in JPA with JTA transaction type, I think we could not update by native sql. IN ejb I've below code. public int executeNativeUpdate(String query, Map&lt;String, Object&gt; params) { Query q = em.createNativeQuery(query); setParameters(q, params); return q.executeUpdate(); } Error raised when running into code: Caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query Anyone can explain. I'm beginer in JPA adn JTA. If I use JPA with JTA transaction type and inject the EntityManager into Stateless EJB, EJB container will handle transaction for me, right? I no need do begin/commit a transaction. How about native sql? Can EJB container handle all?
answer count: 1
has title: How JPA with type is JTA handled by EJB container
type: UnansweredQuestion
tagged with: java
tagged with: jboss

http://stackoverflow.com/q/26979786
tagged with: datetime
has comment: http://stackoverflow.com/comment/42494013
favorite count: 0
has comment: http://stackoverflow.com/comment/42504359
has answer: http://stackoverflow.com/a/26981842
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/26983083
has answer: http://stackoverflow.com/a/26981647
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42509709
has comment: http://stackoverflow.com/comment/42500362
tagged with: date
type: Question
upvote count: 2
has title: Convert Date Time String from one timezone A to timezone B where jvm is running in timezone C
has comment: http://stackoverflow.com/comment/42499734
has body: I have a scenario where I need to convert a date time string from Timezone A(UTC) to Timezone B(EST). Catch here is the JVM where this transformation is happening is Timezone C(HKT) Date Object. So the code block is as follows: String dateString="20141114213000"; dateString += " UTC"; String formatString ="yyyyMMddHHmmss"; SimpleDateFormat sdf = new SimpleDateFormat(formatString + " z"); Date localDate = sdf.parse(dateString); System.out.println("Local Date::"+localDate); // Local Date::Sat Nov 15 05:30:00 HKT 2014 Calendar localCal = Calendar.getInstance(); localCal.setTime(localDate); TimeZone estTimeZone = TimeZone.getTimeZone("America/New_York"); localCal.setTimeZone(estTimeZone); sdf.setTimeZone(estTimeZone); System.out.println(sdf.format(localCal.getTime()));//20141114163000 EST System.out.println(localCal.getTime());//Sat Nov 15 05:30:00 HKT 2014 The output I am expecting is to be "Fri Nov 14 16:30:00 EST 2014" from the last statement, i.e., the final date object available should be in EST. Please let know if anyone has info on this. Update: Just to make my request clear, output should be in Date object only. The sample code and the output I printed is only for clearer explanation. So basically String "20141114213000" which is a UTC Date String needs to be converted to EST Date Object and JVM where this transformation is happening is in HKT.
answer count: 3

http://stackoverflow.com/comment/42394609
type: Comment
type: QuestionComment
has text: while creating a view in your adapter you can make a check on the value of array list item if the condition passes then make your text bold accordingly.
score: 0
comment on: http://stackoverflow.com/q/26923782

http://stackoverflow.com/a/26959556
has comment: http://stackoverflow.com/comment/42457890
upvote count: 30
answers question: http://stackoverflow.com/q/26959511
has comment: http://stackoverflow.com/comment/42457875
has comment: http://stackoverflow.com/comment/42457635
has comment: http://stackoverflow.com/comment/67741170
has comment: http://stackoverflow.com/comment/67740658
has comment: http://stackoverflow.com/comment/42457754
has comment: http://stackoverflow.com/comment/67738822
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42457588
has comment: http://stackoverflow.com/comment/42458025
type: Answer
has comment: http://stackoverflow.com/comment/67731565
has comment: http://stackoverflow.com/comment/42457728
has body: Unfortunately, the scheduled times for repeating are inexact and I read that they could be inexact for a full interval! If your targetSdkVersion is 19 or higher, yes. What can I do instead to set an exact repeating alarm? Use setExact() to get control for your initial delay. Then, as part of your work for processing that event, use setExact() to get control at your next desired time. IOW, you do the "repeating" part yourself. Yes, this is irritating. It is intentionally irritating, to steer developers to not use exact repeating alarms, as those are worse for the battery than are their inexact brethren. If the user will perceive the inexact behavior and will not appreciate it, feel free to use setExact() to make the alarms occur when the user wants. However, if the user will not perceive the inexact behavior, please use inexact alarms, as the user may notice the battery impact of your exact alarms.
score: 30
downvote count: 0
has comment: http://stackoverflow.com/comment/42457802
has comment: http://stackoverflow.com/comment/67740860
accepted answer of: http://stackoverflow.com/q/26959511
has comment: http://stackoverflow.com/comment/42457863

http://stackoverflow.com/a/26880206
has comment: http://stackoverflow.com/comment/42317573
downvote count: 0
has body: &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" // added this line in xml file android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;com.google.ads.AdView android:id="@+id/ad" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="ca-app-pub-3972562323687644/9363983016" ads:loadAdOnCreate="true" /&gt;
answers question: http://stackoverflow.com/q/26879601
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42317116
has comment: http://stackoverflow.com/comment/42317044
score: 1
has comment: http://stackoverflow.com/comment/42317684

http://stackoverflow.com/q/26872167
score: 0
has comment: http://stackoverflow.com/comment/42302596
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42302648
tagged with: constructor
has body: I have been able to add an ArrayList into a text file while at the main method. But when I tried to make a constructor that has a method that takes an ArrayList and add it to the text file giving to the constructor .I get all kind of errors. could someone please give me an advice on what I could be doing wrong thank you Im new to java so please no big words. public class RXTWriter { private String filename; public RXTWriter(String afilename) { filename = afilename; } public void addtext(ArrayList&lt;String&gt; line) throws IOException { File file = new File(filename); if (!file.exists()) { file.createNewFile(); } FileWriter momo = new FileWriter(file.getAbsoluteFile()); BufferedWriter xoxo = new BufferedWriter(momo); for (int k = 0; k &lt; line.size(); k++) { xoxo.write(line.get(k) + "\n"); xoxo.close(); System.out.println("Data saved."); } } }
has comment: http://stackoverflow.com/comment/42302776
linked to: http://stackoverflow.com/q/25540751
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42302580
has answer: http://stackoverflow.com/a/26872362
tagged with: java
accepted answer: http://stackoverflow.com/a/26872362
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42302628
has comment: http://stackoverflow.com/comment/42302619
has comment: http://stackoverflow.com/comment/42302852
has title: Writing an ArrayList via a constructor into a txt file
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42302563

http://stackoverflow.com/comment/42337293
type: Comment
has text: What represent the mainClass?
type: AnswerComment
comment on: http://stackoverflow.com/a/26891430
score: 0

http://stackoverflow.com/comment/42480809
has text: OK. How can I do that? How can I send the data as a stream on android or treat received data on Java as a form?
score: 0
comment on: http://stackoverflow.com/a/26969736
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42237802
has text: looks ugly...mine looks better ^.^
score: 1
comment on: http://stackoverflow.com/a/26836002
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42490636
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26975976
has text: I did multithreading in the `log` function! I created a new runnable each and every single time

http://stackoverflow.com/q/26904467
answer count: 1
has body: Here is a simple program for test connection to cassandra: package testJava.db.cassandra; import com.datastax.driver.core.Cluster; import com.datastax.driver.core.Session; public class ConnectionTester { public static void main (String[] args) { Session session = null; try { Cluster cluster = Cluster.builder().addContactPoint("192.168.1.2").build(); session = cluster.connect("myspace"); System.out.println(session.getState()); } catch (Exception ex) { ex.printStackTrace(); } finally { if (session != null) { session.close(); } } } } When I tun it I get: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /192.168.1.2:9042 (com.datastax.driver.core.TransportException: [/192.168.1.2:9042] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:199) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:80) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1199) at com.datastax.driver.core.Cluster.init(Cluster.java:154) at com.datastax.driver.core.Cluster.connect(Cluster.java:230) at com.datastax.driver.core.Cluster.connect(Cluster.java:263) at testJava.db.cassandra.ConnectionTester.main(ConnectionTester.java:11) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) When I change localhost to 192.168.1.2 every thing works. Also ipconfig windows command returns: Ethernet adapter Local Area Connection: Description . . . . . . . . . . . . . : Realtek PCIe GBE Family Controller Physical Address. . . . . . . . . . . : 40-61-86-7C-4B-0F DHCP Enabled. . . . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . . . : Yes IPv4-address. . . . . . …
linked to: http://stackoverflow.com/q/18724334
favorite count: 0
tagged with: windows-7
tagged with: cassandra
has title: How connect to cassandra cluster via 192.168.x.x ip addres?
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/18724334
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26911713
type: Question
tagged with: ip
tagged with: datastax-java-driver
upvote count: 1

http://stackoverflow.com/comment/42351651
has text: I'm and idiot, thank you for pointing that out. Works great now thank you
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26877048

http://stackoverflow.com/a/26878154
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/26876761
score: 2
answers question: http://stackoverflow.com/q/26876761
has body: You don't need the following in your "project.clj" (ns guidemo.namespace (:gen-class) (:require [seesaw.core :as seesaw]))
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42392800
type: QuestionComment
comment on: http://stackoverflow.com/q/26922551
type: Comment
has text: Good idea, but this is not an option in my case as the Java and R run on different machines.
score: 0

http://stackoverflow.com/comment/42408661
has text: You can leave the initialization in main method (or in some other method called (in)directly from the main mathod) if you don't use the GUI widgets on initialization. In other case you need call it from the `run()` method inside of invokeLater statement (as it shown below).
score: 0
comment on: http://stackoverflow.com/q/26930651
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26928925
score: 1
has comment: http://stackoverflow.com/comment/42403822
has body: Change public abstract class GenericDictionary&lt;T extends Generic&gt; extends Generic&lt;GenericDictionary&gt; { to public abstract class GenericDictionary&lt;T extends Generic&gt; extends Generic&lt;T&gt; { As it stands, Clinic extends Generic&lt;GenericDictionary&gt; - not Generic&lt;Clinic&gt;.
upvote count: 1
answers question: http://stackoverflow.com/q/26928541
type: Answer
downvote count: 0

http://stackoverflow.com/q/26929739
downvote count: 1
favorite count: 0
has body: I want to create a little swing application that takes input from the text field and puts it in a ArrayList. The code is not working and I need some help. EDIT. Fixed the syntax. Now the i cant get the code to work. It wont add the textfield data to the list. Please help. Here is the code: public class GUI extends JPanel implements ActionListener{ JButton button = new JButton(" &gt;&gt; CLICK ME &lt;&lt;"); final JTextField txt = new JTextField("Enter player name."); static List &lt;String&gt; player = new ArrayList &lt;String&gt; (); public GUI(){ txt.setBounds(1, 1, 300, 30); JButton button = new JButton(" &gt;&gt; ADD PLAYER &lt;&lt;"); button.setBounds(40, 40, 200, 40); setLayout(null); add(txt); add(button); button.addActionListener(this); } public void actionPerformed(ActionEvent e) { if (e.getSource().equals(button)) { player.add(txt.getText()); System.out.println("Added: " + txt.getText() + " to the list."); } else System.out.println("Adding the textField data to the list did not work."); } public static void main(String[] args) { JFrame frame1 = new JFrame("Memory Game. Add player function."); frame1.getContentPane().add(new GUI()); frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame1.setSize(310, 130); frame1.setVisible(true); } I am new to swing and have only been coding for a couple of weeks. :/
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42404999
tagged with: swing
tagged with: jtextfield
linked to: http://stackoverflow.com/q/17874717
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42406049
has answer: http://stackoverflow.com/a/26929855
has answer: http://stackoverflow.com/a/26929806
linked to: http://stackoverflow.com/q/5621338
upvote count: 1
has title: Add textField data to a list. Swing
has comment: http://stackoverflow.com/comment/42405607
score: 0
has answer: http://stackoverflow.com/a/26929816
answer count: 3
tagged with: jlist

http://stackoverflow.com/comment/42496876
type: AnswerComment
type: Comment
has text: No allowed directory has been specified. Perhaps you tested this on a jvm in conditions where the working directory happens to be writable; it seems unlike you tested it on android.
comment on: http://stackoverflow.com/a/26981086
score: 0

http://stackoverflow.com/comment/42421624
type: AnswerComment
type: Comment
has text: yeah i have checked it and i haven't found make.exe anywhere within the installed folder.
comment on: http://stackoverflow.com/a/26937734
score: 0

http://stackoverflow.com/q/26942531
has title: JPanel wont scroll within JScrollPane
type: Question
has comment: http://stackoverflow.com/comment/42428513
tagged with: swing
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/42428508
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26942580
upvote count: 0
tagged with: jpanel
type: UnansweredQuestion
has body: I've looked at many examples that are suppose to make a JPanel be able to scroll within a JScrollPane, but none of the implementations worked in my case. My JPanel is larger than the JScrollPane, but when I run it, the scrollbars doesn't reflect to the size of the JPanel accordingly. ePanel = new EnvironmentPanel(); // class that extends JPanel environmentSP = new JScrollPane(ePanel.getPanel()); environmentSP.setPreferredSize(new Dimension(1235, 780)); environmentSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); environmentSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); environmentSP.setViewportView(ePanel.getPanel()); this.frame.getContentPane().add(splitPane, BorderLayout.CENTER); this.frame.getContentPane().add(environmentSP, BorderLayout.EAST); splitPane.setRightComponent(environmentSP);
tagged with: jscrollpane
favorite count: 0

http://stackoverflow.com/q/26922846
has comment: http://stackoverflow.com/comment/42393204
score: 0
tagged with: numberformatexception
answer count: 2
accepted answer: http://stackoverflow.com/a/26922909
has comment: http://stackoverflow.com/comment/42394387
has comment: http://stackoverflow.com/comment/42393134
favorite count: 0
has comment: http://stackoverflow.com/comment/42395127
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42394349
tagged with: java
has answer: http://stackoverflow.com/a/26922909
upvote count: 1
downvote count: 1
type: Question
tagged with: try-catch
possible better answer: http://stackoverflow.com/a/26923469
has answer: http://stackoverflow.com/a/26923469
has title: Using Try/Catch in JAVA
has body: I have the following piece of code where I'm trying to get the user to only enter integers; if a string is entered then it would display a system out error message "please only enter numbers" and then it would show the "Enter your ID#:" again. I tried using the try/catch method but was not using it correctly -- still a beginner. I know I can use the "NumberFormatException" but not sure where. Can anyone help? Thanks! //Get Customer ID and Account Number do { System.out.print("Enter your ID#: "); custid = Integer.parseInt(input.readLine()); System.out.print("Enter your Account Number#: "); custacctnum = Integer.parseInt(input.readLine()); //validate the choice for(int i=0; i&lt;people.length; i++) { if ((people[i].custid == custid) &amp;&amp; (people[i].custacctnum == custacctnum)) { match = true; System.out.println("Welcome " +people[i].firstname+ " to JJ Dealership!"); for(int p=0; p&lt;cluster.length; p++) System.out.println(+(p+1)+ ": " +cluster[p].year+"," +cluster[p].make+ "," +cluster[p].model); System.out.println(people[i].firstname+ ", what color car would you like?"); break; } } if (!match) { System.out.println("Invalid ID"); } while (!(match));

http://stackoverflow.com/q/26987429
answer count: 4
has comment: http://stackoverflow.com/comment/42507723
has answer: http://stackoverflow.com/a/26987518
has body: public String checkIn(Book b) { for (int i = 0; i &lt; books.length; i++) { if (b.equals(books[i])) { if (checkedOut[i] &gt; 0) { checkedOut[i]--; return "Checked in!"; } else { return "All of our copies are already checked in."; } } else { return "Book not found."; } } } } The last curly brace is where I get the error. What's odd is that it recommends i remove it yet it still gives out the error. Any ideas?
has title: Cannot figure out why this curly brace is giving out an error
accepted answer: http://stackoverflow.com/a/26987495
has answer: http://stackoverflow.com/a/26987471
has answer: http://stackoverflow.com/a/26987549
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26987471
has answer: http://stackoverflow.com/a/26987495
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42507481
has comment: http://stackoverflow.com/comment/42507529

http://stackoverflow.com/q/26991851
has body: I would like to send all the selected row values of a table in a single parameter in ajax. Please find below code in which I am sending as one by one using for each statement. If table has 7000 rows. It will not give optimum performance. SELECT DEPARTMENT BOXNO QUANTITY STATUS 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Finish If possible please give me how to receive the same in Java end aswell
tagged with: foreach
tagged with: java
type: Question
tagged with: jquery
has title: How To pass whole table rows and columns as single parameter in ajax
score: 0
tagged with: playframework
has answer: http://stackoverflow.com/a/26994760
answer count: 1
tagged with: ajax
type: UnansweredQuestion

http://stackoverflow.com/comment/42243377
type: QuestionComment
has text: Try to use `jar tvf ConcurDumpProcessLatest.jar` from command line and make sure that `org.springframework.context.ApplicationContext` really was included. Perhaps it was overlooked.
comment on: http://stackoverflow.com/q/26839129
score: 0
type: Comment

http://stackoverflow.com/comment/42498064
has text: @jtahlborn on the receiver side I am calling the bytebuffer.remaining() method to get the number of bytes I am receiving, on the sender side I am using bytebuffer.position() to get the amount I am sending
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26981232

http://stackoverflow.com/a/26902713
has comment: http://stackoverflow.com/comment/85577285
has comment: http://stackoverflow.com/comment/71655144
type: AcceptedAnswer
upvote count: 162
has comment: http://stackoverflow.com/comment/129539731
answers question: http://stackoverflow.com/q/26881739
has comment: http://stackoverflow.com/comment/42471922
score: 161
has comment: http://stackoverflow.com/comment/71659204
has comment: http://stackoverflow.com/comment/133062450
accepted answer of: http://stackoverflow.com/q/26881739
type: Answer
has comment: http://stackoverflow.com/comment/53786211
has body: There are several possible causes: Your entity classes are in the same or in a sub-package relative one where you have you class with @EnableAutoConfiguration. If not then your spring app does not see them and hence will not create anything in db Check your config, it seems that you are using some hibernate specific options, try to replace them with: spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect spring.jpa.hibernate.ddl-auto=update spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver spring.datasource.url=jdbc:mysql://localhost:3306/test spring.datasource.username=test spring.datasource.password= **note that the manual loading of the driver class is unnecessary because it's automatically registered, so don't bother yourself with it Your application.properties must be in src/main/resources folder. If you did not specify dialect correctly it might try to default to bundled together with boot in-memory database and (as it was with me) I could see that it tries to connect to local HSQL (see console output) instance and fail at updating the schema.
downvote count: 1
has comment: http://stackoverflow.com/comment/95584008
has comment: http://stackoverflow.com/comment/96439225
has comment: http://stackoverflow.com/comment/129930946

http://stackoverflow.com/comment/42394771
has text: thanks very much ,and your first question answer Only one TX will be created,is from the document?or some other reference?
type: Comment
comment on: http://stackoverflow.com/a/26923815
score: 0
type: AnswerComment

http://stackoverflow.com/q/26938671
tagged with: database-scan
tagged with: jdbc
tagged with: ycsb
type: UnansweredQuestion
has body: I am trying to run a scan-only workload using YCSB client on MySQL database (a 10GB setup). I am using the following command to run the workload ./bin/ycsb run jdbc -P workloads/workloademod -p db.driver=com.mysql.jd bc.Driver -p db.url=jdbc:mysql://localhost:3306/ycsbtest -p db.user=username -p maxscanlength=100 -p recordcount=5000 -p operationcount=1000 -p maxexecutiontime=1800 > try_ycsb_emod But I get java GC out of memory exception and the workload gets killed as follows:- Loading workload... Starting test. Maximum execution time specified as: 1800 secs Exception in thread "Thread-1" java.lang.OutOfMemoryError: Java heap space at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3380) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3327) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:870) at com.mysql.jdbc.MysqlIO.nextRow(MysqlIO.java:1928) at com.mysql.jdbc.MysqlIO.readSingleRowSet(MysqlIO.java:3278) at com.mysql.jdbc.MysqlIO.getResultSet(MysqlIO.java:462) at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate(MysqlIO.java:2997) at com.mysql.jdbc.MysqlIO.readAllResults(MysqlIO.java:2245) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2638) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1907) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2030) at com.yahoo.ycsb.db.JdbcDBClient.scan(JdbcDBClient.java:348) at com.yahoo.ycsb.DBWrapper.scan(DBWrapper.java:107) at com.yahoo.ycsb.workloads.CoreWorkload.doTransactionScan(CoreWorkload.java:605) at com.yahoo.ycsb.workloads.CoreWorkload.doTransaction(CoreWorkload.java:491) at com.yahoo.ycsb.ClientThread.run(Client.java:233) Could not wait until max specified time, TerminatorThread interrupted. I have tried increasing the java heap size for ycsb client by doing "export YCSB_HEAP_SIZE=8000" to make it 8G, still I …
tagged with: java
has answer: http://stackoverflow.com/a/29090027
tagged with: mysql
type: Question
answer count: 1
has title: YCSB Error with scan operation on mysql db
score: 0

http://stackoverflow.com/q/26832663
tagged with: jboss
has body: I am trying to read System Property by injecting the value. I am trying to use http://juraj.blahunka.eu/2014/05/17/inject-jboss-system-properties/ for reference. My code looks like @Qualifier @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD, ElementType.TYPE}) public @interface SystemProperty { /* Full name of System Property */ @Nonbinding String value(); } and public class SystemPropertyProvider { @Produces @SystemProperty("") String getSystemProperty(final InjectionPoint injectionPoint) { final SystemProperty annotation = injectionPoint.getAnnotated().getAnnotation(SystemProperty.class); final String name = annotation.value(); final String found = System.getProperty(name); if (null == found) { throw new RuntimeException("System property " + name + "not found"); } System.out.println("serverPrivateKeyValue:" + found); return found; } } and the way I inject is @Stateless public class UniqueIdGenerator { private static final String COLON = ":"; private String serverPrivateKey; @SuppressWarnings("UnusedDeclaration") public UniqueIdGenerator() { } @Inject public UniqueIdGenerator(@SystemProperty("com.kb.serverPrivateKey") @Nonnull final String serverPrivateKey) { this.serverPrivateKey = serverPrivateKey; } .... } I deploy my war using maven cargo and set the property as wildfly8x com.h2database h2 <com.kb.serverPrivateKey>test</com.kb.serverPrivateKey> and when I deploy the app I see error as [INFO] [talledLocalContainer] 11:57:49,676 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."application.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."application.war".WeldStartService: Failed to start service [INFO] [talledLocalContainer] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.Final.jar:1.2.0.Final] [INFO] [talledLocalContainer] at java.ut…
has answer: http://stackoverflow.com/a/26835890
type: Question
answer count: 2
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26872189
type: UnansweredQuestion
tagged with: wildfly
tagged with: maven
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42236284
has title: Unsatisfied dependencies for type String with qualifiers @SystemProperty

http://stackoverflow.com/comment/42508476
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26987487
has text: As stated by the message `''` (i.e. empty string) is not a correct date

http://stackoverflow.com/a/26852458
has body: For others help, Ant is using Junit3 test runner by default. No way I can specify the test runner in ant Junit task. I used workaround like from this post. Thanks @AlexanderMiles
accepted answer of: http://stackoverflow.com/q/26848673
type: Answer
answers question: http://stackoverflow.com/q/26848673
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42525966
has text: With this attitude the shortest solution would be `System.out.println("somevalue")`. Do you know what I mean?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26991859

http://stackoverflow.com/a/38616132
downvote count: 2
has body: Best and simple way to print 0 to 99999 numbers to words conversion program Note: You can also extend more numbers greater than 99999 using same logic. import java.util.Scanner; class NumberToWord { final private static String[]units = {"Zero", "One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten", "Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"}; final private static String[]tens = {"","","Twenty ","Thirty ","Forty ","Fifty ","Sixty ","Seventy ","Eighty ","Ninety "}; public static String convert(int number) { if(number&lt;0) { throw new ArithmeticException("Number should be positive."); } else if(number&lt;20) { return (units[number]); } else if(number&lt;100) { return tens[number/10] + ((number % 10 &gt; 0)? convert(number % 10):""); } else if(number&lt;1000) { return units[number/100] + " hundred" + ((number%100&gt;0)? " and " + convert(number%100):""); } else if(number&lt;20000) { return units[number/1000] + " Thousand " + ((number%1000&gt;0)? convert(number%1000):""); } return tens[number/10000] + ((number%10000&gt;0)? convert(number%10000):"Thousand" ); } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Enter a number between 0 to 99999: "); int num = sc.nextInt(); System.out.println(convert(num)); } } Thank you for reading!!
upvote count: 0
answers question: http://stackoverflow.com/q/26948858
has comment: http://stackoverflow.com/comment/115019917
type: Answer
score: -2
has comment: http://stackoverflow.com/comment/64620126

http://stackoverflow.com/q/26837034
has title: How to tell if a HTML table has an empty cell (&nbsp) using Jsoup?
tagged with: http://stackoverflow.com/tag/html
score: 2
upvote count: 2
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: jsoup
answer count: 1
downvote count: 0
has body: Here is the HTML I'm trying to parse. I want to use everything that actually has information and not just &amp;nbsp, but for some reason I can't seem to check if the info in those columns are empty. &lt;tbody&gt; &lt;tr&gt; &lt;td class=""&gt;&lt;a href="/website.com"&gt;Cal83&lt;/a&gt;&lt;/td&gt; &lt;td class=""&gt;List &lt;/td&gt; &lt;td&gt;07/19/12&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; Here is the code I'm using to try to parse it. It can get it just fine until it gets to the &amp;nbsp line. I'm trying to make sure the line has something in it besides whitespace or an empty string. Elements rows = calendarPage.getElementsByTag("tr"); for (Element row : rows) { Elements td = row.getElementsByTag("td"); if (td.get(0).hasText()){ //&amp;nbsp System.out.println(td.get(0).text()); Element link = td.get(0).select("a").first(); } } I tried using .hasText() like I showed there, checking if it's whitespace, an empty string, null, and I even tried checking if it was \u\&amp;nbsp. But it never gets caught, can someone tell me what I'm doing wrong?
favorite count: 0
has answer: http://stackoverflow.com/a/26837822

titanium
type: Tag
tag name: titanium
tags question: http://stackoverflow.com/q/26863260

http://stackoverflow.com/q/26870346
upvote count: 1
answer count: 1
favorite count: 0
has body: I'm developping a java web application and I use MySQL Cluster for Database I get this error when I try to instal the application in a Jboss server .... org.hibernate.exception.GenericJDBCException: could not get table metadata: MY_TABLE_NAME .... Caused by: java.sql.SQLException: Got error 157 'Unknown error code' from NDBCLUSTER environnement info : prod environnement jbos eap 6.2 mysql cluster with 2 data nodes jboss data source URL : jdbc:mysql:loadbalance://&lt; ip-1 >,&lt; ip-2 >/BASE_NAME?loadBalanceBlacklistTimeout=5000
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
type: Question
tagged with: mysql-cluster
has answer: http://stackoverflow.com/a/26871014
accepted answer: http://stackoverflow.com/a/26871014
has title: "could not get table metadata" "Got error 157 'Unknown error code' from NDBCLUSTER"

http://stackoverflow.com/q/26845411
tagged with: debugging
has comment: http://stackoverflow.com/comment/42255904
accepted answer: http://stackoverflow.com/a/27889073
score: 0
answer count: 1
has title: Eclipse Java Debugger just stepping after first resume
has comment: http://stackoverflow.com/comment/42255572
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27889073
has comment: http://stackoverflow.com/comment/42253886
has body: Using eclipse juno 4.4.1 with JDK8 Simple java application/junit (does not matter) debugging working properly just after first resume: setting breakpoints debug debugger holds on first breakpoint resume, suspend, terminate enabled step into, step over, step return disabled (grey) variables not listed after resume the debugger works fine on next breakpoint (stepping &amp; vars) Already tried new projects, new workspace, export/import several settings. -> the problem dissappeared on a new fresh workspace might be a configuration/plug-in issue but could not isolate it when I thought I got it the issue appeared again (on restart of eclipse) Any ideas? == as requested, but the problem seems to rely on eclipse, not on code or sdk public static void main(String[] args) { System.out.println(""); // BP1, debugger holds but no stepping, vars System.out.println(""); // BP2, debugger holds after resume, stepping available, vars shown } UPDATE It's the thread focus (context switch) in the Debug view. When I manually select the main thread, I can (trivially) control and see it again. QUESTION How do I autoselect the main thread/context of first break point? currently, the first line is selected ("App (4) [Java Application]") after starting debug. Stack dump: App (4) [Java Application] com.test.App at localhost:52658 Thread Group [system] Daemon System Thread [Reference Handler] (Running) Daemon System Thread [Finalizer] (Running) Daemon System Thread [Signal Dispatcher] (Running) Daemon System Thread [Attach Listener] (Running) Thread Group [main] Thread [main] (Suspended (breakpoint at line 6 in com.test.App)) com.test.App.main(java.lang.String[]) line: 6 C:\Program Files\Java\jre8\bin\javaw.exe (10.11.2014 17:38:26)
has comment: http://stackoverflow.com/comment/42254226
tagged with: java
has comment: http://stackoverflow.com/comment/42253949
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42255358
type: Question

http://stackoverflow.com/q/26935595
has comment: http://stackoverflow.com/comment/42416131
favorite count: 0
has title: Search in a file for Specific sentences in a txt file in java
upvote count: 2
accepted answer: http://stackoverflow.com/a/26936825
has comment: http://stackoverflow.com/comment/42417620
type: AnsweredQuestion
tagged with: java
downvote count: 2
tagged with: file
has comment: http://stackoverflow.com/comment/42416254
type: Question
has comment: http://stackoverflow.com/comment/42415627
possible better answer: http://stackoverflow.com/a/26948292
has body: I have a TXT file with a multiple choice question and answer(like 150 question),this is the format: what's your name? a. danny b. pedro c. jose d. mikey I need to seek in the file and get the questions and the answer to show them in a UI interface. For the moment, I can read and print the file, but I don't know how to get the sentence for separate. Any suggestion? The code: import java.io.*; import java.nio.file.Path; public class fileManager { public FileInputStream inputStream; public InputStreamReader reader; public File myfile; public String question; public String [] answer; public fileManager(String myfile) { this.myfile = new File(String.valueOf(myfile)); try { inputStream = new FileInputStream(this.myfile ); try { reader = new InputStreamReader(inputStream , "UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } catch (FileNotFoundException e) { e.printStackTrace(); } } public void printFile(){ int indexChar = 1; char concatination = '.'; int endFile = 0; try { endFile = inputStream.available(); } catch (IOException e) { e.printStackTrace(); } do { try { char mychar = (char)reader.read(); if (mychar == ((char)indexChar)){ if(concatination == (char)reader.read()){ do{ System.out.print((char)reader.read()); }while ((char)reader.read() == 'א'); } } endFile++; } catch (IOException e) { e.printStackTrace(); } }while(endFile &lt; 1000); } public void closeFile(){ try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } //End function public void getChar(){ } public void getTheQuestion(){ int questionNum = 0; int eof = 0; int i =0; String []file; String question; try { eof = inputStream.available(); } catch (IOException e) { e.printStackTrace(); } for (;i == '1';){ try { i = reader.read(); } catch (IOException e) { e.printStackTrace(); } } }//end getTheQuestion //Getters and Setters public FileInputStream getInputStream() { return inputStream; } public void setInputStream(FileInputStream inputStream) { this.inputStream = …
has answer: http://stackoverflow.com/a/26936825
has answer: http://stackoverflow.com/a/26948292
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42416518

http://stackoverflow.com/comment/42457875
type: Comment
comment on: http://stackoverflow.com/a/26959556
has text: @KalaJ: [My `PowerHungry` sample app](https://github.com/commonsguy/cw-omnibus/tree/master/JobScheduler/PowerHungry) demonstrates using `setExact()` to emulate an exact repeating alarm, though I am not worrying about event time drift.
score: 3
type: AnswerComment

http://stackoverflow.com/comment/42488335
comment on: http://stackoverflow.com/q/26975976
has text: Okay, let me have a look at it! :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42288967
comment on: http://stackoverflow.com/q/26864685
type: Comment
type: QuestionComment
score: 0
has text: `Assert.assertEquals("m 0.23", String.format("m %.%df", 0.2345d, 2));` fails on me.

http://stackoverflow.com/a/26874845
score: 7
has body: In your for loop you are only setting bytesRead once, not every iteration like you do in the while. The for-equivalent of your while loop would be: for( int bytesRead; (bytesRead = fileInputStream.read(buffer)) != -1; ) Or a different way: for( int bytesRead = fileInputStream.read(buffer); bytesRead != -1; bytesRead = fileInputStream.read(buffer) )
answers question: http://stackoverflow.com/q/26874776
upvote count: 7
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26874776
type: Answer
downvote count: 0

http://stackoverflow.com/a/26947221
has body: I don't see a Scanner object anywhere ;) But, I think, you want to do something like that: Scanner sc = new Scanner(System.in); System.out.println("Thats cool, I have thought that was a very interesting activity, how many hours a week do you do that."); String oftenHangOut = sc.nextLine(); int parsedInt = Integer.parseInt(oftenHangOut); if (parsedInt &gt; 10) { System.out.println("Wow thats a lot you must love to do that."); } else { System.out.println("Cool, you must love to do that."); } or without parsing: Scanner sc = new Scanner(System.in); System.out.println("Thats cool, I have thought that was a very interesting activity, how many hours a week do you do that."); int oftenHangOut = sc.nextInt(); if (oftenHangOut &gt; 10) { System.out.println("Wow thats a lot you must love to do that."); } else { System.out.println("Cool, you must love to do that."); } Good technique is to use try-catch block. You will see what goes wrong, and why your appliaction stopped.
answers question: http://stackoverflow.com/q/26947100
upvote count: 1
type: Answer
downvote count: 0
score: 1

pattern-recognition
tags question: http://stackoverflow.com/q/26871585
type: Tag
tag name: pattern-recognition

http://stackoverflow.com/q/26920034
type: Question
has comment: http://stackoverflow.com/comment/42391482
type: AnsweredQuestion
tagged with: java
tagged with: jenkins-plugins
has comment: http://stackoverflow.com/comment/42397417
has answer: http://stackoverflow.com/a/26931234
answer count: 1
has body: I have configured jenkins to copy the jar file generated from the job to target folder on remote host(GNU LINUX) where jboss is running. Presently I have to manually restart the jboss every time for the changes to reflect. I am using scp only account and jenkins scp plugin for jar movement. Is there a way we can restart the jboss from jenkins without root access on the remote host where jboss is running so that this completely automates the process. The scp account I have on the remote only has copy persmissions. I cannot execute a shell. Thanks for the help.
score: 0
tagged with: linux
tagged with: jboss-eap-6
accepted answer: http://stackoverflow.com/a/26931234
tagged with: jenkins
has title: Restarting Jboss eap using jenkins without root permission on remote host

null
tags question: http://stackoverflow.com/q/26911032
tag name: null
tags question: http://stackoverflow.com/q/26874173
tags question: http://stackoverflow.com/q/26914299
tags question: http://stackoverflow.com/q/26852650
tags question: http://stackoverflow.com/q/26847582
tags question: http://stackoverflow.com/q/26891222
tags question: http://stackoverflow.com/q/26988809
tags question: http://stackoverflow.com/q/26853753
tags question: http://stackoverflow.com/q/26847008
type: Tag
tags question: http://stackoverflow.com/q/26959783
tags question: http://stackoverflow.com/q/26947916
tags question: http://stackoverflow.com/q/26963967
tags question: http://stackoverflow.com/q/26985422

http://stackoverflow.com/a/26982563
score: 1
answers question: http://stackoverflow.com/q/26981917
has body: You are creating and customizing a content panel - LoginJ, but not assigning it to the frame. At the end of initComponents method, you should do: this.setContentPane(this.LoginJ); You will see your form elements, and then you can further customize, e.g. enlarge and center the dialog.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/26939363
has body: Which browser, what exactly did you really try? The URL 127.0.0.1:8080:jspbook/ is invalid, it should be 127.0.0.1:8080/jspbook/ instead. And, of course, if the Windows machine is not the same as the Linux machine, then 127.0.0.1 (aka. localhost) will not take you from your Windows to your Linux.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26939313

http://stackoverflow.com/comment/42308192
type: AnswerComment
has text: Glad we worked it out. Feel free to accept the answer if it works for you.
type: Comment
comment on: http://stackoverflow.com/a/26874805
score: 0

http://stackoverflow.com/a/26981746
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26981649
type: Answer
has body: getInstance() returns some object of type Calendar. It means, that this object is instance of Calendar or its child. As you can see here: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/Calendar.java/ Calendar.getInstance() returns an instance of GregorianCalendar

http://stackoverflow.com/comment/42433188
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26945301
has text: You might want to add a .exists() check in there and check for write permissions and such first.
score: 0

http://stackoverflow.com/a/26865736
score: 0
has comment: http://stackoverflow.com/comment/42290761
type: Answer
answers question: http://stackoverflow.com/q/26865735
has body: It seems, the script language by default is not groovy for some reason in newer versions of es. Need to provide that too explicitly. SO, on providing the script language it worked now. (Note:- setScriptLang("groovy") is the required param if groovy is your choice of script in es). UpdateResponse ur = null; Map par = new HashMap(); par.put("nsite", "newfield"); par.put("docid", "56783"); ur = client.prepareUpdate(index, type, id) .setScriptLang("groovy") .setScriptParams(par) .setScript("ctx._source.sites.nsite=docid",ScriptService.ScriptType.INLINE) .execute().actionGet(); System.out.println("updated for "+site);

http://stackoverflow.com/comment/42289285
has text: It moves the vertical line 2px to the right.
comment on: http://stackoverflow.com/q/26864638
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26954527
has title: Unknown Null Pointer Exception when adding an element to an arraylist
has answer: http://stackoverflow.com/a/27013706
accepted answer: http://stackoverflow.com/a/26954534
has comment: http://stackoverflow.com/comment/42448959
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/26954576
favorite count: 0
possible better answer: http://stackoverflow.com/a/26954576
has comment: http://stackoverflow.com/comment/42448949
has comment: http://stackoverflow.com/comment/42448909
has answer: http://stackoverflow.com/a/26954534
type: AnsweredQuestion
score: 0
tagged with: java
has body: What I am trying to do is add an element to an ArrayList each time a method is called. public class Dice { private static int x3; private static ArrayList&lt;Integer&gt; totals; public Dice() { totals = new ArrayList&lt;Integer&gt;(); } public static void Roll() { int x1 = (int)(Math.random()*6)+1; int x2 = (int)(Math.random()*6)+1; x3 = x1 + x2; totals.add(x3); } } Every time the Roll() method is called, I receive a Null Pointer Error for "totals.add(x3);" Any ideas?
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/218384

http://stackoverflow.com/comment/42234915
type: Comment
comment on: http://stackoverflow.com/a/26834178
has text: Thank you for a great answer, the links explain everything. I am surprised though, I thought Thinking in Java is considered to be one of the better sources for learning the language.
type: AnswerComment
score: 0

http://stackoverflow.com/a/37128723
has comment: http://stackoverflow.com/comment/77263200
has comment: http://stackoverflow.com/comment/92432351
answers question: http://stackoverflow.com/q/26833389
has comment: http://stackoverflow.com/comment/96191860
score: 35
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26833389
has comment: http://stackoverflow.com/comment/114168488
downvote count: 1
has comment: http://stackoverflow.com/comment/66402377
type: Answer
has comment: http://stackoverflow.com/comment/109742041
upvote count: 36
has body: In case someone using Dagger 2 gets here, this is the way I've done in my App: In the library module I've created the following Module and Component: @Module public class ModuleUtil { @Provides public RestTemplate provideRestTemplate() { return new RestTemplate(); } } @Singleton @Component( modules = { ModuleUtil.class }) public interface MainComponent { void inject(Postman postman); } And then I've created the Singleton below in order to manage the injections: public class DaggerWrapper { private static MainComponent mComponent; public static MainComponent getComponent() { if (mComponent == null) { initComponent(); } return mComponent; } private static void initComponent () { mComponent = DaggerMainComponent .builder() .utilModule(new ModuleUtil()) .build(); } } When some class from the library module needs to inject its members, I simply call DaggerWrapper.getComponent().inject(this); and that't it.
has comment: http://stackoverflow.com/comment/67874785
has comment: http://stackoverflow.com/comment/85209525

http://stackoverflow.com/q/26848258
has answer: http://stackoverflow.com/a/26860452
favorite count: 0
tagged with: http://stackoverflow.com/tag/svg
type: UnansweredQuestion
has body: I'm trying to edit an existing SVG and save it afterwards using Batik (I need different formats and DOM-Manipulation). What I do: Adobe Illustrator Source File (CS 4.0) saved as SVG 1.0 with all Glyphs (two embedded Fonts) Loaded with Batik (using SAXSVGDocumentFactory, source below) DOM-Modifications (even without modifications the problem occurs) Saving using SVGTranscoder After transcoding I get a new SVG-File, which is filled with XML, but is not able to render properly in Firefox or Illustrator. In Firefox I get the message that the XML is not well formed e.g., &lt;glyph horiz-adv-x="249" unicode=""/&gt; My Code: /////////////// // Load Template File (with embedded Fonts) /////////////// File file = new File(SVGFilePath); FileInputStream svgInputStream = new FileInputStream(file); //////////////////// // Load SVG into DOM-Tree //////////////////// String parser = XMLResourceDescriptor.getXMLParserClassName(); SAXSVGDocumentFactory factory = new SAXSVGDocumentFactory(parser); Document doc = factory.createDocument(parser, svgInputStream); //... /////////////////////// // Generate Output File /////////////////////// String savepath = "test.svg"; byte[] fileData = transcodeToSVG(doc); FileOutputStream fileSave = new FileOutputStream(savepath); fileSave.write(fileData); fileSave.close(); My Transcoding Code: public byte[] transcodeToSVG(Document doc) throws TranscoderException { try { //Determine output type: SVGTranscoder t = new SVGTranscoder(); //Set transcoder input/output TranscoderInput input = new TranscoderInput(doc); ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); OutputStreamWriter ostream = new OutputStreamWriter(bytestream); TranscoderOutput output = new TranscoderOutput(ostream); //Perform transcoding t.transcode(input, output); ostream.flush(); ostream.close(); return bytestream.toByteArray(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
tagged with: java
has title: Batik - Modify and saving of SVG results in not well formed XML
has comment: http://stackoverflow.com/comment/42260063
type: Question
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42259935
answer count: 1
downvote count: 0
tagged with: batik

http://stackoverflow.com/comment/42554374
score: 0
comment on: http://stackoverflow.com/q/26965494
has text: THanks euler...it worked...kindly post it as an answer...I will accept as helpful answer.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42377488
type: Comment
has text: You can create an object of that Master class and use the object to call the method..
score: 0
comment on: http://stackoverflow.com/q/26914186
type: QuestionComment

filter
tags question: http://stackoverflow.com/q/26991839
tags question: http://stackoverflow.com/q/26850405
tags question: http://stackoverflow.com/q/26865775
tag name: filter
tags question: http://stackoverflow.com/q/26940816
type: Tag
tags question: http://stackoverflow.com/q/26852254
tags question: http://stackoverflow.com/q/26944196

http://stackoverflow.com/comment/42237260
has text: Can you make sure you have assertions enabled?
score: 1
comment on: http://stackoverflow.com/q/26834865
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26883687
accepted answer: http://stackoverflow.com/a/26884301
tagged with: dialog
has comment: http://stackoverflow.com/comment/42322858
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42322954
has comment: http://stackoverflow.com/comment/42323680
has title: Show small window after button click
has comment: http://stackoverflow.com/comment/42323146
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42323579
has answer: http://stackoverflow.com/a/26884301
has comment: http://stackoverflow.com/comment/42323077
has body: I am looking for a way to display a small window beside a Button when it is clicked. Using a Jface Dialog is not what I am looking for, but rather a kind of window which can be exactly positioned beside the Button like a tool tip.
type: Question
tagged with: swt
answer count: 1
has comment: http://stackoverflow.com/comment/42323834

http://stackoverflow.com/comment/42442819
type: QuestionComment
has text: I'm not real familiar with try-with-resources, since it was introduced after I worked on the verifier. But in general you're not supposed to be able to get a verify error except when the Java bytecodes have been corrupted somehow, and the only way I can see outside of switching referenced classes after compile or actually modifying the .class file would be a *javac* or JVM bug. I think it's a bug in Java.
score: 0
comment on: http://stackoverflow.com/q/26876014
type: Comment

http://stackoverflow.com/a/26835167
has body: As the exception raised states, reference to Ambigious is ambiguous, both constructor Ambigious(float[]) in Ambigious and constructor Ambigious(Integer) in Ambigious match. This means that both constructors can take the value you passed, which is null.
score: 3
answers question: http://stackoverflow.com/q/26835150
downvote count: 1
type: Answer
upvote count: 4

http://stackoverflow.com/comment/42539072
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26996213
type: AnswerComment
has text: @chrixle No. The HashMap keys are `((long) y << 32) + (long) x`, where x = 0..1023 and y = 0..1023. There are only 1024 different hash codes for these 1 million values.

http://stackoverflow.com/comment/42521556
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26991573
type: Comment
has text: If I where you I would update the question with these details.

http://stackoverflow.com/comment/42323114
score: 0
type: Comment
has text: I would rather have my script take care of the quote instead of me changing all the crontab entries.
comment on: http://stackoverflow.com/a/26860528
type: AnswerComment

http://stackoverflow.com/comment/42273474
type: AnswerComment
has text: Thank you. Would you mind provide some sample code in the github?
type: Comment
comment on: http://stackoverflow.com/a/26839274
score: 0

http://stackoverflow.com/q/26949967
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26955194
type: Question
has comment: http://stackoverflow.com/comment/42441747
score: 0
has body: I have tried setting up my JAVA_HOME with the path I have got from using the command where Java. But still when I am trying to launch mvn.bat it's not working. I have tried setting up JAVA_HOME with all the below paths: C:\Program Files\Java\jdk1.8.0_25 C:\Program Files\Java\jdk1.8.0_25\bin C:\ProgramData\Oracle\Java\javapath\java.exe But none seems to work when using mvn.bat. Anyone any help please? I am using Windows 7 x86.
answer count: 1
favorite count: 0
duplicate of: http://stackoverflow.com/q/15279586
type: UnansweredQuestion
tagged with: windows
linked to: http://stackoverflow.com/q/15279586
tagged with: maven
has comment: http://stackoverflow.com/comment/42441268
has title: JAVA_HOME is not working for Maven
tagged with: java
tagged with: java-home

http://stackoverflow.com/q/26892149
has comment: http://stackoverflow.com/comment/42348661
tagged with: parsing
type: UnansweredQuestion
tagged with: xsd
answer count: 0
tagged with: schema
score: 0
tagged with: java
has body: i'm working with parse a WADL and write a XML of this WADL (with my specifications), when a response have a representation of a element like 'tns:type', i need to parse the included file XSD and get a sample representation and insert into the XML i'm creating. Example: XSD FILE INCLUDED IN A WADL EXAMPLE &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:yahoo:yn" xmlns="urn:yahoo:yn" elementFormDefault="qualified"&gt; &lt;xs:element name="ResultSet"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="Result" type="ResultType" minOccurs="0" maxOccurs="50"/&gt; &lt;/xs:sequence&gt; &lt;xs:attribute name="totalResultsAvailable" type="xs:integer"/&gt; &lt;xs:attribute name="totalResultsReturned" type="xs:integer"/&gt; &lt;xs:attribute name="firstResultPosition" type="xs:integer"/&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:complexType name="ResultType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Title" type="xs:string"/&gt; &lt;xs:element name="Summary" type="xs:string"/&gt; &lt;xs:element name="Url" type="xs:string"/&gt; &lt;xs:element name="ClickUrl" type="xs:string"/&gt; &lt;xs:element name="NewsSource" type="xs:string"/&gt; &lt;xs:element name="NewsSourceUrl" type="xs:string"/&gt; &lt;xs:element name="Language" type="xs:string"/&gt; &lt;xs:element name="PublishDate" type="xs:string"/&gt; &lt;xs:element name="ModificationDate" type="xs:string" minOccurs="0"/&gt; &lt;xs:element name="Thumbnail" type="ImageType" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType name="ImageType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="Url" type="xs:string"/&gt; &lt;xs:element name="Height" type="xs:integer" minOccurs="0"/&gt; &lt;xs:element name="Width" type="xs:integer" minOccurs="0"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; And i need this: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;ResultSet totalResultsAvailable="1234" totalResultsReturned="1234" firstResul…
has title: Parse XSD and get a sample XML representantion
has comment: http://stackoverflow.com/comment/42478869
linked to: http://stackoverflow.com/q/3967480
type: Question
has comment: http://stackoverflow.com/comment/42381234
tagged with: xml-parsing
has comment: http://stackoverflow.com/comment/42380460

http://stackoverflow.com/q/26954682
type: Question
has answer: http://stackoverflow.com/a/26954742
answer count: 1
tagged with: javascript
has comment: http://stackoverflow.com/comment/42584752
score: 0
tagged with: serialization
type: UnansweredQuestion
tagged with: spring-mvc
tagged with: java
has title: Serializing as javascript object
has body: I am working on a Spring MVC and I want to insert javascript into the html output for analytics purpose. I am only partially familiar with serialization but I figured it does the job nicely rather than manually constructing a string containing javascript. Would it be possible to generate something the following snippet? Any pointers would be great! "emd" : new Date('6/6/2014') Update: I need to output a javascript object which has many fields which may be complex. Hence, on the backend I am gathering all the data into java beans with all the information and I plan to use Jackson mapper to convert to string that I can just output through JSP. Generating the above snippet does not seem straightforward though, not sure if it is even possible. For context, the rest of that javascript looks something like this. Analytics.items["item_123"] = { //ratings and reviews "rat" : a.b, //the decimal value for the rating "rev" : xxxx, //integer //list of flags that indicate how the product was displayed to the customer //add as needed...tracking code will pick up flags as needed when they are available "dec" : ["mbe", "green", "recycled"], //delivery messaging "delivery" : { "cd" : new Date() //current date "offers" : [{ "type" : "abcd" "emd" : new Date('6/6/2014'), "weekend" : true } ] }, };
has comment: http://stackoverflow.com/comment/42589002

http://stackoverflow.com/q/26955225
linked to: http://stackoverflow.com/q/2506488
answer count: 2
possible better answer: http://stackoverflow.com/a/26955260
has answer: http://stackoverflow.com/a/26955260
downvote count: 0
has body: I'm working on a dueling system for a game that I've been working on, here's the skeleton of the class: public class Duel { private Champion challenger; private Champion defendant; private boolean duelStarted; private long timer; public Duel(Champion challenger, Champion defendant) {.. public void tick() {.. public void declineDuel() {.. public void endDuel(ResultType resultType, Champion winner, Champion forfeit) {.. public void declareWinner(Champion player) {.. public void declareForfeit(Champion player) {.. private enum ResultType {.. public Champion getChallenger() {.. public Champion getDefendant() {.. } This class will be assigned to the Champion's class for both the challenger, and the defendant. When a duel ends (Effectively by calling Duel#declineDuel() or Duel#endDuel(ResultType, Champion, Champion) or due to something like a Champion#Disconnect(), how should I properly set the class up to be collected by the Java garbage collection. I've never completely understood this, would I need to set everything inside of the class to null, as-well as the Duel currentDuel; declaration in Champion.class or should I only set the currentDuel to equal null, which will effectively stop referencing ( I would assume, this is what I'm confused about ) to this instance of the class. I'm don't quite understand what the garbage collection would consider a "Referenced" class, would Duel#getChallenger() being set make it be considered referenced still, even though it's not being touched from an outside class? I guess I'm confused between in-bound and out-bound references, would anybody care to shed some enlightenment since I can't seem to understand what's going on when i rtfm.
favorite count: 0
tagged with: garbage-collection
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26955256
score: 1
tagged with: java
has title: How to properly prepare a class for garbage collection?
upvote count: 1
accepted answer: http://stackoverflow.com/a/26955256
type: Question

http://stackoverflow.com/q/26928840
type: AnsweredQuestion
has title: JPA boolean default = false @transient
accepted answer: http://stackoverflow.com/a/26928875
tagged with: java
type: Question
has body: How can i set the default value of a @transient boolean to false? Everytime i get my object the value is true. I tried with "@Column(nullable=false, columnDefinition="boolean default false") " but doesn't work Thx =)
score: 0
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/26928875

http://stackoverflow.com/q/26951770
type: Question
score: 0
answer count: 1
has body: I am creating a JTree for a project of mine, and the names for some of the nodes dynamically change, and I'm updating the tree using this function: public void updateTree() { for (Sprite spr : sprites) { spr.getMyNode().removeFromParent(); } treeModel.reload(); } However, when I call this, a row of whitespace shows up like this: Foo Child Foo2
tagged with: jtree
tagged with: java
type: UnansweredQuestion
has title: Jtree removeFromParent() creates whitespace
has answer: http://stackoverflow.com/a/26954020

http://stackoverflow.com/q/26942655
favorite count: 0
tagged with: python
has body: I have installed Jython 2.7 beta version. I have the code like this: import org.python.util.PythonInterpreter; import org.python.core.*; public class SimpleEmbedded { public static void main(String []args) throws PyException { PythonInterpreter interpreter = new PythonInterpreter(); interpreter.exec("from selenium import webdriver"); System.out.println("Hello world!!"); } } I'm trying to refer to the selenium package, which is been installed via like this: pip install -U selenium But when I run the above Java code, I was getting the following exception: Exception in thread "main" Traceback (most recent call last): File "&lt;string&gt;", line 1, in &lt;module&gt; ImportError: No module named selenium Then I found there is not selenium.py in the Lib directory of the Jython installation. So what I did is copied all the selenium code from pip installation location to Jython Lib. Like cp -r /Library/Python/2.7/site-packages/selenium/* ~/jython/Lib After this I ran the following code, I get: Exception in thread "MainThread" Traceback (most recent call last): File "&lt;string&gt;", line 1, in &lt;module&gt; ImportError: cannot import name webdriver Now I'm struck. I dont know how to resolve this problem. Any idea? Where I'm making mistake?
upvote count: 2
type: UnansweredQuestion
tagged with: pip
has title: Calling Selenium from Jython PythonInterpreter is giving me error
has answer: http://stackoverflow.com/a/34903429
score: 2
tagged with: java
type: Question
tagged with: jython
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26852746
has comment: http://stackoverflow.com/comment/42268175
has answer: http://stackoverflow.com/a/26852888
tagged with: arrays
score: 0
answer count: 1
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/42268012
has title: Null pointer exception while useing Userdefined array
type: UnansweredQuestion
tagged with: java
has body: After validation, program is running successfully and storing the user input into last_name variable. But when I am trying to put last_name in the student Array, it gives me a null-pointer exception.If I omit the third line inside the for loop, the program is running fine. Here, "setStudentLastName" is a void method inside the Student class that accepts a string parameter //Create a array using the data from user Student student[] = new Student[numOfStudents]; for(int i=0;i&lt;student.length;i++) { int j = i+1; last_name = Validator.validUpperCase(sc,"Enter student "+j+" last Name: "); student[i].setStudentLastName(last_name); }
has comment: http://stackoverflow.com/comment/42268412
type: Question

http://stackoverflow.com/q/26953750
accepted answer: http://stackoverflow.com/a/26953828
has answer: http://stackoverflow.com/a/26953828
type: AnsweredQuestion
has title: Scale All Graphics in an OpenGL Game
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
answer count: 1
has body: I'm just beginning with OpenGL and LWJGL, but I have experience in Java and game development. My game I'm making is going to be a 2D Pixel Art Platformer, with most sprites being 16x16px. I want to scale all the graphics being rendered up by 3. In regular Java, you would draw all the pixels to a BufferedImage, and then draw that image by doing something like this: g.drawImage(image, 0, 0, WIDTH * SCALE, HEIGHT * SCALE, null); I'm trying to do the same with glScalef(), but it makes the images blurry, can I fix that or is there a better way to do it? Here's my code: glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, WIDTH, HEIGHT, 0, 1, -1); glMatrixMode(GL_MODELVIEW); glScalef(SCALE, SCALE, SCALE); Please let me know of any other information I may need to provide. Thanks!
score: 0
linked to: http://stackoverflow.com/q/3840917

http://stackoverflow.com/tag/png
tags question: http://stackoverflow.com/q/26991462
tag name: png
tags question: http://stackoverflow.com/q/26918675
type: Tag

http://stackoverflow.com/comment/42335193
type: Comment
type: QuestionComment
has text: If you don't want a class in the import section then does it really belong to that package ?
comment on: http://stackoverflow.com/q/26890603
score: 0

http://stackoverflow.com/comment/42486206
comment on: http://stackoverflow.com/q/26974744
score: 0
type: Comment
type: QuestionComment
has text: 1. Why should I open transaction for single update? 2. It differs from PostgreSQL / MySQL behavior - I can't be sure in my tests

http://stackoverflow.com/a/26947255
upvote count: 3
has body: You have to transfer the content of the file. To do that you have to change the remote interface signature: public interface Upload_1 extends Remote { void upload(byte[] content) throws RemoteException; } The client send a byte array with the content of the file, and the server takes it and writes to disk. The problem is when you use large files, the javavm will throw OOME, so you have to simulate streaming over RMI. Another alternative is using an existing library, take a look at http://openhms.sourceforge.net/rmiio/
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26943681
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26943681
type: Answer
score: 3

http://stackoverflow.com/q/26891070
tagged with: java
has answer: http://stackoverflow.com/a/26891347
has answer: http://stackoverflow.com/a/26892281
type: Question
score: 0
answer count: 2
has title: how to display the outputs by name
has body: I have to read from a binary file and then I should display the output in order by name. The question : Write a program that read data from a binary file person.dat. (Please download the binary file from the Web site.) Then, display the name, age and gender (M – Male, F – Female) in ascending order sort by name. The structure of the binary file is as below: intVariable-TotalNumberofRecord StringVariable-Name IntVariable-Age CharVariable-Gender … StringVariable-Name IntVariable-Age CharVariable-Gender This is what in the binary file (person.dat) ¬í wa Mohamad Ali M Siti Nuraini F Tan Mei Kuan F Mutu Samy M Alvin Tan M ============================================ This is the code that I have made. The problem is I don't know how to sort the outputs in alphabetical order. Please help me with this, thank you. try { ObjectInputStream inputStream = new ObjectInputStream (new FileInputStream("C:/Users/user/Desktop/person.dat")); String input; int age, record; char gender; record = inputStream.readInt(); System.out.println("Total number of records: "+record); try{ while(true) { input = inputStream.readUTF(); age = inputStream.readInt(); gender = inputStream.readChar(); System.out.println(input+" " +age +" " +gender);} }catch(EOFException e){} inputStream.close(); } catch (FileNotFoundException e) { System.out.println("File was not found"); } catch (IOException e) { System.out.println("Problem with file output."); }
type: UnansweredQuestion

http://stackoverflow.com/a/26988248
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26969640
has body: I could finally solve the problem using this article: Android Code to Upload &amp; Download large files to server the code I used on the Android was: String urlString=params[0]; String path=params[1]; File file=new File(path); int maxBufferSize=1024; URL url=null; try { url=new URL(urlString); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } HttpURLConnection connection=null; try { connection = (HttpURLConnection) url.openConnection(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } connection.setDoInput(true); connection.setDoOutput(true); connection.setUseCaches(false); try { connection.setRequestMethod("PUT"); } catch (ProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); } connection.setRequestProperty("Content-Type", "image/jpg"); OutputStream outputStream=null; FileInputStream fileInputStream=null; byte[] buffer; int bytesRead,bytesAvailable,bufferSize; try { outputStream=connection.getOutputStream(); fileInputStream=new FileInputStream(file); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); buffer = new byte[bufferSize]; bytesRead = fileInputStream.read(buffer, 0, bufferSize); while(bytesRead &gt; 0){ outputStream.write(buffer, 0, bufferSize); bytesAvailable = fileInputStream.available(); bufferSize = Math.min(bytesAvailable, maxBufferSize); bytesRead = fileInputStream.read(buffer, 0, bufferSize); } int serverResponseCode = connection.getResponseCode(); String serverResponseMessage = connection.getResponseMessage(); Log.d("test Response Code ",Integer.toString(serverResponseCode)); Log.d("test Response Message ", serverResponseMessage); } catch (IOException e) { Log.d("test", e.getMessage()); }

pointers
tags question: http://stackoverflow.com/q/26874296
tags question: http://stackoverflow.com/q/26911032
tags question: http://stackoverflow.com/q/26852650
tags question: http://stackoverflow.com/q/26921289
type: Tag
tag name: pointers

http://stackoverflow.com/q/26959906
answer count: 2
upvote count: 1
downvote count: 0
tagged with: deserialization
possible better answer: http://stackoverflow.com/a/26960131
tagged with: query-string
has answer: http://stackoverflow.com/a/27017855
favorite count: 0
type: AnsweredQuestion
tagged with: cxf
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26960131
type: Question
has body: I am trying to convert querystring into Pojo. Is there any way to convert query string into pojo. Below is what I have tried so far: Request: POST /Service/services/handler/qpStringtoPOJO HTTP/1.1 Host: localhost Cache-Control: no-cache id=123434&amp;value=BB$@##@FDBB$#Gw3r3232rvd Pojo: package com.nexsols.license.model; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement public class Pojo { String id; String value; @XmlElement(name="id") public String getId() { return id; } public void setId(String id) { this.id = id; } @XmlElement(name="value") public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public String toString() { return "Pojo [id=" + id + ", value=" + value + "]"; } } Service method: @POST @Path("/qpStringtoPOJO") public String qpStringtoPOJO(@QueryParam("") Pojo pojo){ System.out.println(pojo); return "SUCCESS"; } Currently output is Pojo [id=null, value=null] I am using cxf for my service.Am I doing something wrong? Thanks in Advance.
accepted answer: http://stackoverflow.com/a/27017855
has title: How to deserialize query string to pojo in cxf java

http://stackoverflow.com/q/26876437
has comment: http://stackoverflow.com/comment/42310434
tagged with: java
has comment: http://stackoverflow.com/comment/42326646
has comment: http://stackoverflow.com/comment/42310481
has comment: http://stackoverflow.com/comment/42310561
type: Question
has answer: http://stackoverflow.com/a/26876619
has comment: http://stackoverflow.com/comment/42310499
has comment: http://stackoverflow.com/comment/42319175
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42310437
has answer: http://stackoverflow.com/a/26876890
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42310496
has comment: http://stackoverflow.com/comment/42310301
has body: I have an interface where I implemented the following method: public void shutdown() Quite a few of the classes that implement this method will not actually use it. Is there a way to check if the body of the implementation actually has some content in it? I suppose I could add a boolean check, but I'd like to avoid additional overhead.
has title: Check If Java Interface Method Is Populated

http://stackoverflow.com/q/26921400
has comment: http://stackoverflow.com/comment/42390940
answer count: 1
has comment: http://stackoverflow.com/comment/42390980
has comment: http://stackoverflow.com/comment/42390947
favorite count: 0
accepted answer: http://stackoverflow.com/a/26921527
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Have the same Java file name as the project name in intelliJ
has body: I am learning Java using intelliJ, I am wondering how to configure the IDE so that the default Java file (Main.java) when creating a new project, can have the same name as the project name. cheers
has comment: http://stackoverflow.com/comment/42390987
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/26921527

http://stackoverflow.com/comment/42437665
comment on: http://stackoverflow.com/a/26947841
score: 0
type: AnswerComment
has text: i'm in first year CS so i'm not entirely sure what split is, what would that do exactly?
type: Comment

http://stackoverflow.com/comment/70755779
type: AnswerComment
comment on: http://stackoverflow.com/a/41782780
has text: @user3717841 : Yes class name should be defined as Packagename.classname
score: 0
type: Comment

http://stackoverflow.com/comment/42250310
has text: Please explain better your answer
score: 5
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26843180

http://stackoverflow.com/a/26851641
downvote count: 0
answers question: http://stackoverflow.com/q/26834779
type: Answer
score: 3
upvote count: 3
has body: Here is one way with very simple math. First, you need a constant for the distance the camera is from the center of the tree (the radius of the circle path it travels on). Also, you need some variable to track it's angle around the circle. static final float CAM_PATH_RADIUS = 5f; static final float CAM_HEIGHT = 2f; float camPathAngle = 0; Now you can change the camPathAngle to anything you want from 0 to 360 degrees. 0 degrees corresponds with the location on the circle that is in the same direction as the world's X-axis from the tree's center. On each frame, after you've update camPathAngle, you can do this to update the camera position. void updateTreeCamera(){ Vector3 camPosition = camera.getPosition(); camPosition.set(CAM_PATH_RADIUS, CAM_HEIGHT, 0); //Move camera to default location on circle centered at origin camPosition.rotate(Vector3.Y, camPathAngle); //Rotate the position to the angle you want. Rotating this vector about the Y axis is like walking along the circle in a counter-clockwise direction. camPosition.add(treeCenterPosition); //translate the circle from origin to tree center camera.up.set(Vector3.Y); //Make sure camera is still upright, in case a previous calculation caused it to roll or pitch camera.lookAt(treeCenterPosition); camera.update(); //Register the changes to the camera position and direction } I did it like that for the sake of commenting it. It's actually shorter than the above if you chain commands: void updateTreeCamera(){ camera.getPosition().set(CAM_PATH_RADIUS, CAM_HEIGHT, 0) .rotate(Vector3.Y, camPathAngle).add(treeCenterPosition); camera.up.set(Vector3.Y); camera.lookAt(treeCenterPosition); camera.update(); }

http://stackoverflow.com/q/26887783
possible better answer: http://stackoverflow.com/a/26888084
answer count: 2
has answer: http://stackoverflow.com/a/26888006
has body: How can I detect the timezone where a local machine is in? I tried DateTimeZone.getDefault() but that does not give me eg timezone "germany" if the machine is in germany. Is it possible at all?
type: AnsweredQuestion
score: 0
tagged with: java
has title: How to get the TimeZone of the local machine in JodaTime?
has answer: http://stackoverflow.com/a/26888084
type: Question
tagged with: jodatime
accepted answer: http://stackoverflow.com/a/26888006

http://stackoverflow.com/q/26931211
tagged with: glassfish
upvote count: 4
possible better answer: http://stackoverflow.com/a/46385883
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/42750009
has answer: http://stackoverflow.com/a/26931327
accepted answer: http://stackoverflow.com/a/26931327
has body: I'm trying to start Glassfish 4.1 in Intellij IDEA 13.1.4. I've set basic settings in Run/debug configurations window - selected application server, jvm, put 2 artifacts to deploy, left startup/connection configurations default. When I try to start it the exception is thrown. Here is full stack trace: /home/glassfish/glassfish/bin/asadmin start-domain domain1 Detected server admin port: 4848 Detected server http port: 8080 [2014-11-14 03:09:49,839] Artifact ss-ear:ear: Server is no connected.Deploy is not available. [2014-11-14 03:09:49,839] Artifact ss-ear:ear exploded: Server is not connected. Deploy is not available. java.nio.file.AccessDeniedException: /home/glassfish/glassfish/domains/domain1/logs/server.log.lck at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) at sun.nio.fs.UnixFileSystemProvider.newFileChannel(UnixFileSystemProvider.java:177) at java.nio.channels.FileChannel.open(FileChannel.java:287) at java.nio.channels.FileChannel.open(FileChannel.java:335) at java.util.logging.FileHandler.openFiles(FileHandler.java:438) at java.util.logging.FileHandler.&lt;init&gt;(FileHandler.java:318) at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:99) at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:192) at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:228) at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:124) at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:322) at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:366) at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:300) at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56) Waiting for domain1 to start .Error starting do…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/46385883
has title: IDEA failed to start a local glassfish server
tagged with: java
type: Question
tagged with: intellij-idea
score: 4
tagged with: ubuntu

http://stackoverflow.com/comment/42582153
comment on: http://stackoverflow.com/a/26875419
type: Comment
has text: I know that you've probably not yet had time to take a look, but I just wanted to make sure that you were able to obtain the server contents.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42436109
type: AnswerComment
has text: @BackSlash I think it needs to be clarified regarding static/non-static scopes. You can demonstrate this yes, but only because you are calling a static method from a another static method. This will not be true for non-static context.
comment on: http://stackoverflow.com/a/26946923
score: 0
type: Comment

http://stackoverflow.com/q/26874794
has comment: http://stackoverflow.com/comment/42307398
has comment: http://stackoverflow.com/comment/42307467
type: UnansweredQuestion
score: 0
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: fibonacci
has title: Java Fibonacci recursion code
has body: I am trying to come up with a program to take from a user any number and produce the nth number for the fibonacci code. When I complete my work it's showing the next # instead of the # I need. For instance I'm looking for the 11th # and its producing 233 instead of 144. Here is my code: public static int fibonacci(int n) { if (n&lt;=0) return 1; else return fibonacci(n-2)+ fibonacci(n-1); } public static void main(String[] args) { System.out.println("Enter a Number:"); Scanner keyboard = new Scanner(System.in); int number = keyboard.nextInt(); System.out.println("You Entered Number:" + number); System.out.println(number + "th Fibonacci Number is:"+ fibonacci(number)); keyboard.close(); }
has comment: http://stackoverflow.com/comment/42307434
has answer: http://stackoverflow.com/a/26874834
has answer: http://stackoverflow.com/a/26875076
favorite count: 0
has answer: http://stackoverflow.com/a/79345024
has answer: http://stackoverflow.com/a/26874875
has comment: http://stackoverflow.com/comment/42307459
answer count: 4

printing
tags question: http://stackoverflow.com/q/26855492
tags question: http://stackoverflow.com/q/26856917
tags question: http://stackoverflow.com/q/26980305
tags question: http://stackoverflow.com/q/26966410
tag name: printing
tags question: http://stackoverflow.com/q/26985422
tags question: http://stackoverflow.com/q/26923326
tags question: http://stackoverflow.com/q/26950102
tags question: http://stackoverflow.com/q/26899721
type: Tag

http://stackoverflow.com/q/26983947
has comment: http://stackoverflow.com/comment/42501853
tagged with: java
type: Question
score: 0
answer count: 2
has title: can we declare static variables inside static block in java
has answer: http://stackoverflow.com/a/26984000
has body: Why can't we declare static variables inside a static block because static attributes ,when are allotted memory during class loading time and also ,with the class loading only the static block gets executed then why is there a restriction that we can't do this. Also,during class loading when the main method gets loaded then why cant we even declare our static variables inside the main method also.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26984130

http://stackoverflow.com/comment/89131414
type: AnswerComment
has text: Thanks @matsev this works like a charm. Is there a better way to do this since 2014.
type: Comment
comment on: http://stackoverflow.com/a/27094219
score: 0

http://stackoverflow.com/comment/42495445
score: 0
comment on: http://stackoverflow.com/q/26980427
type: Comment
type: QuestionComment
has text: @badjr: that's a mooit point because every method you will use probably has an `if` down the line. It's about what you write yourself, that matters.

http://stackoverflow.com/a/26975688
has comment: http://stackoverflow.com/comment/42488280
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26975530
has comment: http://stackoverflow.com/comment/42488918
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26975530
type: Answer
has body: Use a \w*\d\w* regex matcher for that. It will match all words with at least one digit in them. Although I generally despise regexes, they are particularily well suited for your problem. String[] s = input.replaceAll("\\w*\\d\\w* *", "").split(" +"); See Java lib docs for Pattern/Matcher (RegEx) for more reference how to work with regexes in general. Test code: http://ideone.com/LrHDsT
score: 1

http://stackoverflow.com/q/26850261
type: Question
score: 0
has body: I have a question about objects in a switch statement. I am aware that variables used in case clause must be final (otherwise we get: "case expressions must be constant expressions"). Final on objects means only reference can't be changed, the value still can be changed by other non final reference therefore, we cant use objects in 'case'. But why cant we use wrappers? They are immutable arent they? java code: Integer i = 8; final int x = 10; switch ( x ) { case x: System.out.println("x"); break; case i: System.out.println("i"); break; }
answer count: 1
has comment: http://stackoverflow.com/comment/42263311
has answer: http://stackoverflow.com/a/26850551
tagged with: wrapper
has comment: http://stackoverflow.com/comment/42262943
has title: Wrappers in switch statement
has comment: http://stackoverflow.com/comment/42263488
accepted answer: http://stackoverflow.com/a/26850551
type: AnsweredQuestion
tagged with: java
tagged with: switch-statement

http://stackoverflow.com/q/26838119
has answer: http://stackoverflow.com/a/26841042
type: UnansweredQuestion
has title: How to show image in Eclipse Scout?
has answer: http://stackoverflow.com/a/26840865
has body: How to show an image in scout form? I want to show an image as logo in the desktop form, I tried imagefield and htmlfield, but i failed to find examples online.
score: 0
type: Question
tagged with: eclipse-scout
tagged with: java
tagged with: image
answer count: 2

http://stackoverflow.com/a/26906243
has comment: http://stackoverflow.com/comment/42363366
accepted answer of: http://stackoverflow.com/q/26904378
has body: You have selected a Java Runtime which doesn't contain sources. Check the preferences "Installed JREs" and make sure they include sources.
has comment: http://stackoverflow.com/comment/42363119
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42368827
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26904378

http://stackoverflow.com/comment/42506239
type: Comment
has text: provide the details of project structure.
comment on: http://stackoverflow.com/q/26985862
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42255141
score: 0
type: AnswerComment
has text: the great Oliver watkins! i never thought of saving changes to file. the trick worked. that why i called you the great. so nxt time i want to save changes made, i think this is the only way.
type: Comment
comment on: http://stackoverflow.com/a/26843657

http://stackoverflow.com/a/66823888
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26952565
has body: You can represent each box as an almost square String[] array: +------ | | | +------ Then you can concatenate these arrays line-by-line, and add a right border: +------+------+------+------+------+ | | | | | | | | | | | | | | | | | | +------+------+------+------+------+ This code works in Java 11: <a href="https://tio.run/##3VVNj9owEL3zK0Y5OQW8H1V7CAtVD63aw7aHrdQD4mCIA6aJHTmTZVF3fzs7@SQRJKjSnppLHM9745k348lWPIrx1v9zOKgoNhZhSxs8RRXyd5PByV6Q6hUqo/nXcnEGk6CVIuLfNT7kq25IZR/E6TJUK1iFIkngXigNfwdAT7mfoEB6PRrlQ0RWRkSl1/MFCLtO3BKcPVdXoNNoKS2YAJbmSSa1SWkEDVP4MGmid8rHzXlwYZrCxxZhI9V6g@cZpW0K7ymnyvCwT1BG3KTIY4oaQ82cH@0YPXBgCNqd9JJ@t0ItOHmMF3jf2hEXxCLUJrOSNAdRDnX9uBV6Ldn1iCKs4Q1FCtRd4WB2guCRiH@Zn8stUzCelWhuAnaCbPhM45j0WRrr08uaXSf26M4ZZnk5Y4dbGUuBrNCmk9k4Tfg@CLC5TOWZaAA3Eqghs62ni16GQOndUYON4QY@geMA6Tx0XHfUl6bSms6Khc26jYorIJRBFUMn8UxlynJeDPNYDBI1K4fznKsG/6ra26rXq@LzJRVDs/tPmqU7AB6EAu9FzKrBy5UvNSrcsz4Wms/Win09MD1Py5179hpb6acr2b7N88UsS05AQh@hpHFLzupRcXrVCx@MkQg3o0yKWzdrss6GJSVue6JvT47M6VwtiJM5ptUb5M2N/RImkpG1Sut64TamNwlDwzROsd7JHSflL4zl09LlAfkRqw07zl/PKwdwOWNfBi@Hwys" rel="nofollow noreferrer" title="Java (JDK) – Try It Online">Try it online! // number of boxes int n = 5; // width of boxes int width = 6; // height of boxes int height = 3; System.out.println("Number of boxes: " + n); System.out.println("Width of boxes: " + width); System.out.println("Height of boxes: " + height); String[] boxes = IntStream.range(0, n) // Stream<String> .mapToObj(i -> Stream.of( // upper border row Stream.of("+" + "-".repeat(width) // add a right border to the last box + (i < n - 1 ? "" : "+")), // inner part with a left border IntStream.range(0, height) .mapToObj(row -> "|" + " ".repeat(width) // add a right border to the last box + (i < n - 1 ? "" : "|")), // lower border row Stream.of("+" + "-".repeat(width) // add a right border to the last box + (i < n - 1 ? "" : "+"))) .flatMap(Function.identity()) .toArray(String[]::new)) // reduce Stream<String[]> to a single array String[] .reduce((box1, box2)…

http://stackoverflow.com/q/26847295
has comment: http://stackoverflow.com/comment/42283794
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42257472
has title: Make a print method with for loop Java
accepted answer: http://stackoverflow.com/a/26890981
type: AnsweredQuestion
downvote count: 12
has comment: http://stackoverflow.com/comment/42257474
favorite count: 0
type: Question
score: -11
has body: The task of exercise is to make a method that will work like in Example.( We must use for loop. But if you know how to do it in another way, it will be also very interesting.) Input number can be any. Example: Input: 3 Output: **1** *121* 12321 *121* **1** My example: public static void main(String[] args) { printMatrix(5); } public static void printMatrix (int n) { int d = n +(n-1); for (int i = 0; i &lt; n ; i++) { for(int j = 1; j &lt;=d; j++){ int abs = Math.abs(j-n); System.out.print(abs&gt;i ? "*" : i-abs+1); } System.out.println(""); } My output: ****1**** ***121*** **12321** *1234321* 123454321 I can't make the next step, to turn it upside down. Dose anybody hava an ideas?
has comment: http://stackoverflow.com/comment/42261867
has answer: http://stackoverflow.com/a/26890981
has comment: http://stackoverflow.com/comment/42257497
has comment: http://stackoverflow.com/comment/42257459
tagged with: java

http://stackoverflow.com/q/26957359
has title: How to include a Double Variable in a String Variable in Java?
has answer: http://stackoverflow.com/a/26957412
tagged with: double
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26957411
has answer: http://stackoverflow.com/a/26957413
has body: Say, for example, I have a double variable in Java: double alpha = 3; However, I wanted to create a String variable, including that Double Variable: String beta = "Alpha has a value of " + alpha; So that the output would be //Output Alpha has the value of 3 However, it will not let me do so, as it says the double value cannot be included in the string value. As I am doing this for around 150 variables, I want to know how to do it the simplest and shortest way. Thanks
has comment: http://stackoverflow.com/comment/42453789
tagged with: string
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26957411
has comment: http://stackoverflow.com/comment/42453825
possible better answer: http://stackoverflow.com/a/26957412
favorite count: 0
tagged with: parsing

http://stackoverflow.com/a/26855937
has body: In your manifest, in activity you should set parent like this: android:parentActivityName="com.some.myproject.ParentActivityToThisActivity" But it can not working with API 14, API 15 should be used or newest.
has comment: http://stackoverflow.com/comment/42274271
downvote count: 0
has comment: http://stackoverflow.com/comment/42274308
answers question: http://stackoverflow.com/q/26855707
type: Answer
score: 1
upvote count: 1

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/26978978
tag name: tablemodel
tags question: http://stackoverflow.com/q/26890337

http://stackoverflow.com/q/26840176
type: Question
answer count: 2
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42244845
has answer: http://stackoverflow.com/a/26841504
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26840465
has comment: http://stackoverflow.com/comment/42244806
score: 3
tagged with: network-programming
tagged with: java
has title: Find out IP address associated with MAC Address in servlet web application
has body: I'm trying to find out the IP address associated with an MAC address in servlet programming. Is it possible ? I have the MAC address. Using MAC address how can I find out the IP Address ?
tagged with: servlets

http://stackoverflow.com/comment/42370479
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26910307
has text: HAshcode and equals rule: if equals method returns true ..it means that hashcode being true is a must....if hashcode returns false then equals can never return true
type: AnswerComment

http://stackoverflow.com/a/26987134
accepted answer of: http://stackoverflow.com/q/26987056
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26987056
has comment: http://stackoverflow.com/comment/42507315
type: Answer
has comment: http://stackoverflow.com/comment/42507378
upvote count: 1
has body: Try to get access through getter. Like public JTextArea getTextArea() { return jTextAreaField; } and then getTextArea().append("ur text");
score: 1
has comment: http://stackoverflow.com/comment/42507244

http://stackoverflow.com/q/26954920
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27051449
upvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
has body: I am running apache and tomcat in different ports as I am using tomcat only for REST API using JAVA and apache for html/js/css etc . Now I want to enable reverse-proxy the ajax calls to tomcat server ( as otherwise my REST calls are failing due to cross-domain policy ). Please advise 1) how to enable reverse proxy in apache ? (OR) 2) Is there any better way to do this thanks in advance
has title: how to enable mod_proxy in amazon EC2?
tagged with: apache
downvote count: 0
tagged with: amazon-ec2
answer count: 1
has comment: http://stackoverflow.com/comment/42458734
tagged with: amazon-web-services
tagged with: tomcat
has answer: http://stackoverflow.com/a/27051449

jersey-client
tags question: http://stackoverflow.com/q/26947948
tags question: http://stackoverflow.com/q/26873448
tags question: http://stackoverflow.com/q/26945281
tag name: jersey-client
type: Tag
tags question: http://stackoverflow.com/q/26887470

http://stackoverflow.com/comment/42557379
comment on: http://stackoverflow.com/a/26984000
has text: yes sir ,I understood but why is the following code giving error public class qu3 { static { static int a=90; } }
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42518572
comment on: http://stackoverflow.com/a/26990123
score: 0
type: AnswerComment
has text: tnx it works i just dont get how the : work i saw in net about the ? and : together not alone
type: Comment

http://stackoverflow.com/comment/42393134
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/26922846
has text: Have you looked at the [hasNextInt()](https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html#hasNextInt()) method? I assume you are using a scanner to get input.
type: Comment

http://stackoverflow.com/comment/42260616
comment on: http://stackoverflow.com/q/26848606
score: 0
type: QuestionComment
has text: You should post a simple but complete and compilable example instead of pseudo code.
type: Comment

http://stackoverflow.com/q/26957069
has title: display emoji in Java (jFrame)
accepted answer: http://stackoverflow.com/a/26957368
tagged with: iphone
has body: I have a csv file imported from iPhone and included Emoji smiles Using iPhone the file looks like But if I use open the csv file from computer How can I process these characters in Java to get emoji smiles? and when I change the extension to .txt that what I get: How can I display the original (iPhone) emoji? If I cannot do it, so how can I display the smiles like the .txt file? each csv file has different emoji smiles!
answer count: 1
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/42453524
tagged with: http://stackoverflow.com/tag/csv
has comment: http://stackoverflow.com/comment/42453373
has answer: http://stackoverflow.com/a/26957368
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42453788
upvote count: 1
tagged with: emoji
downvote count: 1
type: Question

http://stackoverflow.com/a/26867129
downvote count: 0
has body: You could take out the / between the two template parameters and insert it into the regex of the userId @Path("/lock/{userName}{userid:((/[a-zA-Z]{2})?)}") Won't make a difference, but the extra wrapping parenthesis are not needed, i.e. this {userid: (/[a-zA-Z]{2})?} is sufficient
score: 2
type: AcceptedAnswer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26866446
type: Answer
answers question: http://stackoverflow.com/q/26866446

http://stackoverflow.com/comment/45214084
type: Comment
comment on: http://stackoverflow.com/a/26947482
has text: is possible use only the center of BorderPane?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42250135
score: 0
type: QuestionComment
has text: I think the better name is default methods. They have a default implementation in the Interface that you can override, but you don't have to.
type: Comment
comment on: http://stackoverflow.com/q/26843058

http://stackoverflow.com/comment/42474370
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26968964
has text: I guess that dates back to old C times, where it was crucial what you declared first.

http://stackoverflow.com/comment/42492637
has text: Even when it works.. for now i always have window "Sensor application has been stopped" after running it..
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26979001
type: Comment

http://stackoverflow.com/comment/42759552
comment on: http://stackoverflow.com/q/26972683
type: Comment
type: QuestionComment
has text: You might also be able to leverage JNA's `Native.getWindowHandle()` to obtain the native window handle, rather than the reflection-based lookup you're using. Depends on how the JavaFX stuff handles its native peers, though.
score: 0

http://stackoverflow.com/q/26896900
possible better answer: http://stackoverflow.com/a/26903756
has answer: http://stackoverflow.com/a/29415095
accepted answer: http://stackoverflow.com/a/29415095
has body: Spring 4.1.2 (4.0.8 and 3.2.12) contains a Security Bugfix SPR-12354 that prevents the ResourceHttpRequestHandler (the thing behind &lt;mvc:resources&gt;) to load files from outside the the resource folder. On the other hand: is JRebel (I use it with its default configuration). And it seams that JRebel do some magic to load the resources not from the wtp folder but directly form the "source" folder. So after upgrading from Spring 3.2.11 to 3.2.12 (and an other similar Application from 4.0.7 to 4.0.8) Springs ResourceHttpRequestHandler does not longer deliver the resource files that are "maintained" by JRebel. Instead is delivers a 404. The reason is that Spring compare the absolute file path of the configured resource folder with the absolute file path of the file that is going to be delivered. If the ResourceHttpRequestHandler perceived that the file is outside of configured resource folder, then it assume that the url that was used to select the file is malicious. Therefore the ResourceHttpRequestHandler and response with a 404 resource not found. I expect that JRebel can been configured not to "maintain" js, png and css files, but I don't know how. And this is the question: How to configure JRebel that a Spring MVC Application (v 4.0.8) still deliver Resources with ResourceHttpRequestHandler? (I expect that almost every JRebel User is facing this problem after upgrading to Spring 4.1.2, 4.0.8 or 3.2.12). (don't get me wrong, this is NOT a question how to manipulate Spring not to check that the files are outside of the configures resource folder. I have had a look at the source code and the observed behaviour is the behaviour that is intended by the authors of the Bug fix. - This question is about configuring JRebel)
tagged with: java
has comment: http://stackoverflow.com/comment/43016450
type: Question
has answer: http://stackoverflow.com/a/27185931
has comment: http://stackoverflow.com/comment/42347391
has comment: http://stackoverflow.com/comment/43014780
answer count: 3
upvote count: 7
downvote count: 1
has title: Resource Not Found after Spring 4.1.2 Update when deploy with JRebel 6.0.0
favorite count: 0
has answer: http://stackoverflow.com/a/26903756
score: 6
tagged with: jrebel
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/a/26896735
answers question: http://stackoverflow.com/q/26896658
has body: The code needs to change like this : if(recordAns.equals('n')) { System.out.print("\nDid You Receive At Least A D Grade In Pass Irish In The Leaving Cert &lt;y or n&gt;?: "); certAns = input.nextLine(); System.out.print("\nDo You Commit To Taking A 10-Week Irish Course on Application &lt;y or n&gt;?: "); courseAns = input.nextLine(); }
score: 0
type: Answer

http://stackoverflow.com/comment/42266612
type: QuestionComment
comment on: http://stackoverflow.com/q/26852049
score: 0
has text: @alecxe- Thanks for the replay. In that case how come it is working fine with other browsers? Why only it is happening with chrome?
type: Comment

http://stackoverflow.com/comment/42383896
type: Comment
has text: I'm sorry, but if you basically say that you don't really know how to do this right and you know you do it in an awful way, then maybe it's not the right topic to be giving advice on. Just my 2c.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26917293

http://stackoverflow.com/a/26934748
type: Answer
has body: To correctly import scanner use: import java.util.Scanner; to create a new scanner as a variable do: Scanner sc = new Scanner(System.in); This will create a new scanner named sc.
has comment: http://stackoverflow.com/comment/42416704
answers question: http://stackoverflow.com/q/26934621
score: 0

http://stackoverflow.com/a/26929844
accepted answer of: http://stackoverflow.com/q/26928953
type: AcceptedAnswer
score: 0
has body: EDIT1: figured out better regex. You can apply similar logic to your needs. I'm guessing you have to build the regex based on an input string? Explanation of the pattern used: ^([^/*]+)/([^/*]+)/[*]$ ^ start of string [^/*] match any character except / or * + is a quantifier that matches preceding char or group 0 to many times / followed by the character / [^/*] match any character except / or * / followed by the character / [*] followed by only 1 more character which is * and not something else $ end of string public static void main(String[] args) { final ArrayList&lt;String&gt; entries = new ArrayList&lt;String&gt;(); entries.add("text1/*"); entries.add("text2/*/*"); entries.add("text2/*/*/*"); entries.add("text1/*/*"); entries.add("text1/value1/*"); entries.add("*/*"); final Pattern pattern = Pattern.compile("^([^/*]+)/([^/*]+)/[*]$", 2); for (String entry : entries) { Matcher matcher = pattern.matcher(entry); while (matcher.find()) { System.out.println("found correct entry: " + entry); } } }
type: Answer
answers question: http://stackoverflow.com/q/26928953

http://stackoverflow.com/comment/90917746
score: 2
comment on: http://stackoverflow.com/a/48477812
type: AnswerComment
type: Comment
has text: Sorry, this is plain nonsense. in and out aren't Strings, they are Input/Output streams. And it is not about *initialisation*, but about *declaration*. Your answer adds nothing new. And worse: it only adds **wrong** information.

http://stackoverflow.com/a/26934294
has body: You are overusing classes — classes are meant to represent data types, or be holders for static methods (which are essentially just functions). You however, are using classes as a means to distribute functions and then apply bogus inheritance. Also, you're inheriting from Menus and instatiating Menus in the same class — that makes no sense whatsoever. In other words, you don't need to use inheritance and a lot of classes just for the sake of it. There's nothing in Java other than a lot of incompetent developers who overuse classes that forces or recommends overuse of classes and inheritance. Functions, preferrably ones with no side effects/global state, are much much easier to reason about and get right. Whereas complicated state variables scattered across a parent class chain is a shortcut to a big headache. I would use something simple such as: public class Library { public static void main(final String[] args) { showMainMenu(); } int totalBooks; public static void showMainMenu() { final Scanner ui = new Scanner(System.in); while (true) { System.out.println("Main menu"); System.out.println("1. Add student"); System.out.println("2. Display all"); System.out.println("3. exit"); System.out.print("Enter choice"); switch (ui.nextInt()) { case 1: getInputs(); /*System.out.println("option 1");*/ break; case 2: showAllInfo(); break; case 3: System.out.println("Leaving the program now..."); System.exit(0); break; default: System.out.println("error."); } } } public static void getInputs() { inputData(); updateTotalBooks(); } public static void showAllInfo() { printData(); System.out.println("total books taken = " + totalBooks); } public static void updateTotalBooks() { System.out.print("Enter number of books "); totalBooks = new Scanner(System.in).nextInt(); } } If you need to split this up in different modules, do NOT use inheritance. Instead, create something like a State or Database class, and pass that around between static functions that either modify the passed in dat…
answers question: http://stackoverflow.com/q/26933883
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26933883
has comment: http://stackoverflow.com/comment/42414233
type: Answer
score: 6
upvote count: 6
has comment: http://stackoverflow.com/comment/42415761
has comment: http://stackoverflow.com/comment/42426108
has comment: http://stackoverflow.com/comment/42414069
has comment: http://stackoverflow.com/comment/42413981
has comment: http://stackoverflow.com/comment/42415779
has comment: http://stackoverflow.com/comment/42414047

http://stackoverflow.com/q/26875951
has comment: http://stackoverflow.com/comment/43540344
has answer: http://stackoverflow.com/a/26875952
has comment: http://stackoverflow.com/comment/44068394
tagged with: java
has comment: http://stackoverflow.com/comment/44067677
downvote count: 1
accepted answer: http://stackoverflow.com/a/26875952
type: Question
has comment: http://stackoverflow.com/comment/44061414
tagged with: self-reference
has title: Java returning subclass without generic parameter in superclass method
has body: I really love using initializers to make constructing and configuring classes more understandable. Basically I prefer this: new ClassObj().StartingFrom(1).EndingAt(5).IncrementBy(1).Backwards(); Rather than this: new ClassObj(1,5,1,false); This is a bit of a pain in Java when mixed with inheritance, as returning types default to as generic as possible. I've found a workable solution using self-referential inheritance (Java: returning subclass in superclass method signature), but I'm having some problems with it. My issue is that the Parent class implements Iterable, but the generic type parameter gets lost, so the for-each loop wants to return an Object instead of a File. Here's an SSCCE showing the behavior: public class SSCCE { private static abstract class Sentence&lt;T extends Sentence&lt;T&gt;&gt; implements Iterable&lt;String&gt; { protected LinkedList&lt;String&gt; Words = new LinkedList&lt;&gt;(); abstract T self(); public T Say(String word) { Words.add(word); return self(); } @Override public Iterator&lt;String&gt; iterator () { return Words.iterator(); } } static class QuietSentence extends Sentence&lt;QuietSentence&gt; { public QuietSentence Whisper(String word) { Say(word.toLowerCase()); return this; } @Override QuietSentence self() { return this; } } static class LoudSentence extends Sentence&lt;LoudSentence&gt; { public LoudSentence Shout(String word) { return Say(word.toUpperCase()); } @Override LoudSentence self() { return this; } } static void PrintWords(Sentence words) { for(Object obj : words) { // I'd really like to avoid this cast String word = (String)obj; System.out.println(new StringBuilder(word).append(": ").append(word.length()) .toString()); } } public static void main (String[] args) { QuietSentence peaceful_words = new QuietSentence().Say("Hello").Whisper("World"); PrintWords(peaceful_words); LoudSentence noisy_words = new LoudSentence().Say("Hello").Shout("World"); PrintWords(noisy_words); } } What's going on, and how can I fix it?
has comment: http://stackoverflow.com/comment/43542747
score: -1
has comment: http://stackoverflow.com/comment/44030601
tagged with: inheritance
has comment: http://stackoverflow.com/comment/44060155
has comment: http://stackoverflow.com/comment/44068308
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/44027019
linked to: http://stackoverflow.com/q/10968557
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/44067145
has comment: http://stackoverflow.com/comment/44067343
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/44068323
has comment: http://stackoverflow.com/comment/42351433

http://stackoverflow.com/a/26992322
has comment: http://stackoverflow.com/comment/42519201
upvote count: 1
answers question: http://stackoverflow.com/q/26979120
downvote count: 0
has body: I think you need to add an mvc:messsage-converters section to your spring.xml. For instance &lt;mvc:annotation-driven ignoreDefaultModelOnRedirect="true" &gt; &lt;mvc:message-converters&gt; &lt;bean class="org.springframework.http.converter.ResourceHttpMessageConverter"/&gt; &lt;bean class="org.springframework.http.converter.xml.Jaxb2RootElementHttpMessageConverter"/&gt; &lt;bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/&gt; &lt;/mvc:message-converters&gt; &lt;/mvc:annotation-driven&gt;
type: Answer
score: 1

http://stackoverflow.com/q/26984819
tagged with: java
type: Question
has title: JDBC to JTable output query regarding making buttons work in GUI Editor for Netbeans
has answer: http://stackoverflow.com/a/27019167
has comment: http://stackoverflow.com/comment/42558899
answer count: 1
has body: so, i'm working on a project where I have to use a search button to find user information from a jdbc database, and so far I've got some of the code to work and added fields and data to the database, but once i hit search in the jtextfield it doesn't display any data in the table. So, i'm wondering if someone can take a look at this code and tell me where the mistake is, the jbutton is supposed to connect to the mainframe where the database connection information is stored. this is the main frame code: package guestbook; import java.sql.Connection; import java.sql.DriverManager; public class MainFrame extends javax.swing.JFrame { public static String dbURL = "jdbc:derby://localhost:1527/Coolkidsclub;create=true;user=Vic"; public static Connection conn = null; /** * Creates new form MainFrame */ public MainFrame() { try { Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();//"org.apache.derby.jdbc.ClientDriver" to use derby driver conn = DriverManager.getConnection(dbURL); initComponents(); } catch (Exception e){ } 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() { jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/guestbook/ckc.PNG"))); // NOI18N jButton1.setText("Add Kid"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Update Kid"); jButton2.addActionListener(new j…
tagged with: jtable
tagged with: jdbc
score: 0
type: UnansweredQuestion
tagged with: swing
tagged with: jbutton

http://stackoverflow.com/comment/42323524
comment on: http://stackoverflow.com/q/26883601
score: 0
type: Comment
type: QuestionComment
has text: @Jeremy. Please don't confuse the OP. He is passing all name value pairs as parameter of the postData() call.

http://stackoverflow.com/a/26900902
has comment: http://stackoverflow.com/comment/42357877
has comment: http://stackoverflow.com/comment/42357018
has comment: http://stackoverflow.com/comment/42358975
has comment: http://stackoverflow.com/comment/42354364
has body: public class testString { public static void main(String[] args){ //need to configure this accordingly int row=3+1; int col=4+1; String[][] array=new String[row][col]; //construct the string with the number of row-1 String s1="testcaseZ : a,b,c"; String s2="testcaseX : b,d"; String s3="testcaseC : b"; String[] strings=new String[]{s1,s2,s3};//strings should have lenghth of row-1 String[] allValues=new String[]{"a","b","c","d"}; //polulate the first row array[0][1]="a"; array[0][2]="b"; array[0][3]="c"; array[0][4]="d"; //Above, you can dynamically construct the two arrays based on your input(say from files) for(int i=1;i&lt;array.length;i++){//for every rest rows String text=strings[i-1]; String theCase=text.substring(0,text.indexOf(":")).trim();// String valueText=text.replaceAll(theCase, "").replaceFirst(":", "").trim(); array[i][0]=theCase; String[] values=valueText.split(","); List valueList=Arrays.asList(values); for(int j=1;j&lt;array[i].length;j++){//for every cols if(valueList.contains(allValues[j-1])){//if contains the value, array[i][j]="1"; } else array[i][j]="0"; } } //test the output System.out.println(Arrays.deepToString(array)); } } output is like: [[null, a, b, c, d], [testcaseZ, 1, 1, 1, 0], [testcaseX, 0, 1, 0, 1], [testcaseC, 0, 1, 0, 0]]
score: 0
has comment: http://stackoverflow.com/comment/42354549
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26900343
type: Answer
answers question: http://stackoverflow.com/q/26900343

http://stackoverflow.com/q/26839518
downvote count: 1
possible better answer: http://stackoverflow.com/a/26840248
type: Question
has answer: http://stackoverflow.com/a/26840248
tagged with: arrays
accepted answer: http://stackoverflow.com/a/26839638
score: 0
answer count: 2
tagged with: string
linked to: http://stackoverflow.com/q/1372599
favorite count: 0
has comment: http://stackoverflow.com/comment/42243675
has title: Conversion of char array to String array in java
duplicate of: http://stackoverflow.com/q/1372599
has comment: http://stackoverflow.com/comment/42244633
has answer: http://stackoverflow.com/a/26839638
type: AnsweredQuestion
tagged with: java
has body: I'm new to java.How to convert char array into string array.My char array holds the values from Resultset rs.The code for char array is char[] time= rs.getString(logtime).toCharArray(); How to convert this time into String array.
upvote count: 1

http://stackoverflow.com/a/26949337
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26949251
score: 1
upvote count: 1
has body: If the only problem you have is printing the suit, then I would either create an array: String[] suits = {"Clubs", "Spades", "Hearts", "Diamonds"}; or an ArrayList&lt;String&gt;(): ArrayList&lt;String&gt; suits = new ArrayList&lt;String&gt;(); suits.add("Clubs"); suits.add("Spades"); suits.add("Hearts"); suits.add("Diamonds"); You can simply iterate it like that: for(String suit : suits)

http://stackoverflow.com/comment/42512682
type: QuestionComment
comment on: http://stackoverflow.com/q/26990631
type: Comment
has text: Classic example: When you want to implement your own iterator.
score: 1

http://stackoverflow.com/q/26922551
has comment: http://stackoverflow.com/comment/42392800
has title: Transferring data structure from R to Java
upvote count: 0
has comment: http://stackoverflow.com/comment/42464628
type: UnansweredQuestion
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42397309
has body: I have an R script that does some computation. The last step of the computation is a kernel density estimate: http://www.inside-r.org/packages/cran/kerdiest/docs/kde I now, in R, need to convert the result of calling kde into a string, or save it into a file, such that I can read and "unmarshal" it from a Java program. What is the best format to use for the exchange and what R and Java libraries can read / write that format? The structure is not ridiculously complex, but also not trivial: &gt; str(tmp) List of 8 $ x : num [1:1398, 1:3] 1.035 0.902 0.679 0.826 1.243 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : NULL .. ..$ : chr [1:3] "Rb ppm" "Sb ppm" "Cr ppm" $ eval.points:'data.frame': 1398 obs. of 3 variables: ..$ Rb ppm: num [1:1398] 1.035 0.902 0.679 0.826 1.243 ... ..$ Sb ppm: num [1:1398] -2.58 -2.6 -2.48 -2.44 -2.53 ... ..$ Cr ppm: num [1:1398] 4.56 4.44 4.3 4.26 4.49 ... $ estimate : Named num [1:1398] 0.1572 0.0897 0.0311 0.0434 0.099 ... ..- attr(*, "names")= chr [1:1398] "1" "2" "3" "4" ... $ H : num [1:3, 1:3] 0.02395 0.00927 -0.014 0.00927 0.06868 ... $ gridded : logi FALSE $ binned : logi FALSE $ names : chr [1:3] "Rb ppm" "Sb ppm" "Cr ppm" $ w : num [1:1398] 1 1 1 1 1 1 1 1 1 1 ... - attr(*, "class")= chr "kde"
type: Question
has answer: http://stackoverflow.com/a/26964663
has comment: http://stackoverflow.com/comment/42392667
answer count: 1
downvote count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/r

http://stackoverflow.com/comment/42513733
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26989559
has text: I changed the workerQueue to ConcurrentLinkedQueue, but now the problem is that sometimes there is no output only or just few of the output comes. It seems like the the program is ending before thethreads are completed. Can you please suggest how to resolve the problem ?
type: AnswerComment

http://stackoverflow.com/q/26931552
has answer: http://stackoverflow.com/a/26931713
tagged with: algorithm
tagged with: java
has answer: http://stackoverflow.com/a/74713104
answer count: 6
tagged with: sorting
score: 4
has comment: http://stackoverflow.com/comment/42408327
has answer: http://stackoverflow.com/a/26931878
accepted answer: http://stackoverflow.com/a/26932693
tagged with: arrays
favorite count: 0
has answer: http://stackoverflow.com/a/26932693
has title: Sorting algorithm using bitmask and binary operators
has comment: http://stackoverflow.com/comment/42408232
upvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26931878
downvote count: 0
tagged with: bit-manipulation
has body: I'm struggling to understand how the following algorithm (in Java) works. private static void sort(int[] values, k) { int mask = 0x00000001 &lt;&lt; k; int insertIndex = 0; int ArrayList&lt;Integer&gt; big = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; values.length; ++i) { if ((values[i] &amp; mask) == 0) values[insertIndex++] = values[i]; else big.add(values[i]); } for (int i = 0; i &lt; big.size(); ++i) values[insertIndex++] = big.get(i); } public static void sort(int[] values) { for (int i = 0; i &lt; 31; ++i) sort(values, i); } Here's what I undestand so far: At first 0x00000001 (32 bit?) gets left-shifted by k. So mask now is some other number. Then we're checking if current value values[i] added with mask using Binary-And operator equals to 0. I can't understand the role of (values[i] &amp; mask) == 0 clause. Second for-loop messing with my head also. And why are we iterating in public static void sort(int[] values) only 31 times? This algorithm doesn't sort negative integers correctly. How so? How can it be modified so that negative integers get sorted too? It is said that this algorithm uses similar concepts of one the well-known sorting algorithms. Like Heap-sort, Insertion Sort, Quick-sort, Merge-Sort, Bucket-Sort or Radix-Sort. I eliminated the possibility of Quick-sort, because it uses partitions and recursion. Merge sort uses recursion and merges sub-arrays, so I eliminated it too. Insertion-Sort isn't likely to be the one either, because of the drastic time-complexity difference. Insertions sort O(n^2) and given algorithm is O(n). Bucket-sort doesn't actually sort anything, it just divides array in sub-arrays, which then can be sorted using some sorting algorithm. Heap-sort is comparison-based algorithm, and the given algorithms doesn't look like one. So the only possibility that's left is Radix-Sort, which is not a comparison-based algorithm. So my best bet is that the given algorithm is similar to Radix sort. Am I right or am I hopelessly …
has answer: http://stackoverflow.com/a/26931903
has answer: http://stackoverflow.com/a/26931885
type: Question

http://stackoverflow.com/comment/42351322
has text: Thanks! Ha cant believed I missed that I have everything working now.
comment on: http://stackoverflow.com/a/26871901
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42475844
type: QuestionComment
has text: Well, there will still be one-way SSL, so the connection will still be encrypted. It's just that tying auth to the connection causes problems. I think that SSO might well be the right way to go - then it becomes someone else's problem! Moreover there is something more natural about opening short-lived connections to a 3rd-party system for authentication and reauthentication.
comment on: http://stackoverflow.com/q/26911844
score: 0
type: Comment

http://stackoverflow.com/q/26969701
answer count: 0
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42498949
score: 0
has comment: http://stackoverflow.com/comment/42476319
has title: Is there a "file-like" serial port interface in Java8 under Windows (recent, 7 or 8)
tagged with: ftdi
tagged with: serial-port
has comment: http://stackoverflow.com/comment/42498396
has body: I'm using the following code under Java8 for MacOS X: new BufferedReader(new FileReader("/dev/cu.usbserial-A601EQIH")) .lines() .forEach(System.out::println); Provided: there is a VCP driver from FTDI installed there is an FTDI usb-serial device plugged-in and sending data to computer, line by line Then: this code will iterate the lines sent and print them on the console. Is there such a "/dev/cu.usbserial-A601EQIH" file on Windows, provided we install the right virtual com port drivers? I have no windows machine to try it, and would like to answer that question before I show off that code at a conference... PS: As is implied by code, I do not want to use any library apart standard Java8 libraries.

http://stackoverflow.com/q/26981926
type: UnansweredQuestion
has body: When updating my maven project, the java compiler is changing from 1.7 to 1.5. this is my pom.xml file 4.0.0 com.chart.simple core war 0.0.1-SNAPSHOT core Maven Webapp http://maven.apache.org 1.7 <org.springframework-version>4.0.3.RELEASE</org.springframework-version> javax.servlet javax.servlet-api 3.1.0 provided javax.servlet.jsp javax.servlet.jsp-api 2.3.1 provided jstl jstl 1.2 org.apache.commons commons-dbcp2 2.0 mysql mysql-connector-java 5.1.21 org.springframework spring-context ${org.springframework-version} org.springframework spring-webmvc ${org.springframework-version} org.springframework spring-orm ${org.springframework-version} jar compile org.hibernate hibernate-core 4.3.5.Final core Help!!
has comment: http://stackoverflow.com/comment/42497974
favorite count: 0
has title: Maven Changing Java Compiler
type: Question
has answer: http://stackoverflow.com/a/26996007
tagged with: maven
has comment: http://stackoverflow.com/comment/42497967
has comment: http://stackoverflow.com/comment/42497994
has answer: http://stackoverflow.com/a/26982526
tagged with: java
score: 0
answer count: 3
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/26981989

http://stackoverflow.com/comment/42312053
comment on: http://stackoverflow.com/a/26877367
has text: This looks promising. I will mark this as soon as I manage to implement this into my code. Thank you very much!
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26898505
answers question: http://stackoverflow.com/q/26897791
score: 0
has comment: http://stackoverflow.com/comment/42353797
type: Answer
upvote count: 1
downvote count: 1
has body: Problems in your code: for every iteration of the loop the userTotal is 100.00-userBet1. By writing code this way you don't maintain userTotal value for the next iteration. in your if-else-if ladder,if first condition match then control exit from the if-else-if construct and user will never get a triple reward. in your if-else-if blocks you are not maintaing userTotal. you are just assign it to a local variable postBetSum. Solutions: Declare and initialize a count=0 variable outside the loop. inside loop just increase the counter by 1. check if it is the first iteration i.e. count==1 , then userTotal=100.0-userBet1 . otherwise userTotal=userTotal-userBet1 make your second condition first in the if-else-if ladder. in this way you are sure if three or two(according to your code) match are there then you'll get the triple reward. if not then it will check for the next else-if block for a single match, if found then user will get double reward. you can maintain userTotal by writing this way userTotal+=doubleReward . this statement make sure that userTotal is retaining its value after getting the reward. All this, plus you can put your switch construct in a method which just returns a string instead of writing it three times. Now Try this: class SlotMachineSimulation { public static String getValName(int val){ String valName=" "; switch (val) { case 1: valName = "Cherries"; break; case 2: valName = "Oranges"; break; case 3: valName = "Plums"; break; case 4: valName = "Bells"; break; case 5: valName = "Melons"; break; case 6: valName = "Bars"; break; } return valName; } public static void main(String [] args) { Scanner user_input = new Scanner (System.in); Random randInt = new Random(); System.out.print("Welcome to the Slot Machine Simulator!\n" + "\nActions:" + "\n1. Start a new game" + "\n2. View scores" + "\n3. Exit\n"); System.out.print("\nPlease select an action: "); int userAction = user_input.nextInt(); if (userAction == 1) { System.out.print("\nBefore the game beg…

http://stackoverflow.com/q/26953810
has answer: http://stackoverflow.com/a/26953865
accepted answer: http://stackoverflow.com/a/26953865
downvote count: 2
upvote count: 1
tagged with: cloud
answer count: 1
favorite count: 0
has body: I am designing an architecture for a simple cloud based app that compiles and runs java programs. I am planning to expose services via SOAP through which a client can provide source to the server. The server would respond with Log messages like compilation failures etc or success messages. Basically the console output. Questions From an architecture point of view what are the security considerations that I should be aware of and what would be the right way to do it? What other validations should I put in before code compilations and what other things do you see that need to be taken care while implementing this in the cloud? Are there any open source APIs that might already take care of above things? I have come across javax.tools.JavaCompiler and other utilities that should do the job.
type: AnsweredQuestion
tagged with: java
has title: Online Java Compiler and runner
has comment: http://stackoverflow.com/comment/42447845
type: Question
score: -1

http://stackoverflow.com/comment/42339421
has text: other class is called Account, i'm trying to access accountNumber from this class. but want to use it's method to do so! And yeah yeah, you'll have people watching you very closely talking like that ;)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26892772

http://stackoverflow.com/comment/42338854
score: 0
type: Comment
type: QuestionComment
has text: Same task, possibly different question: http://stackoverflow.com/q/20941509/1110928 There's some other approaches; I wrote one that avoids the massive if/then clauses altogether.
comment on: http://stackoverflow.com/q/26891621

http://stackoverflow.com/a/26984640
has comment: http://stackoverflow.com/comment/42502990
has comment: http://stackoverflow.com/comment/42503141
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42503049
type: Answer
accepted answer of: http://stackoverflow.com/q/26984430
answers question: http://stackoverflow.com/q/26984430
has body: this is an interesting question, I have tried your code in the Eclipse IDE, in which it is not fine at all because Eclipse will report a warning which says: Type safety: The method add(Object) belongs to the raw type List. References to generic type List&lt;E&gt; should be parameterized This is why your following operation is not safe. Please see this example, if you do not specify the data type of the list, you can add any type of data in the list List a = new ArrayList(); a.add("abc"); //add a string object a.add('a'); //add a char a.add(1); // add a integer So when you operate the element in the list, it will be unsafe. Does this make sense to you?
downvote count: 0
score: 1

http://stackoverflow.com/comment/42323895
has text: yes code executed..up to this line System.out.println("Data is " + bytesToHex(byteArr)); After that i wait a lot of time but no result my data is repeting
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26884095

http://stackoverflow.com/a/26857980
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26857822
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26857822
type: Answer
has body: Check to see if you have an option set somewhere that the jar file in question should be a runnable jar file. Runnable jar files must have a class with a valid public static void main(String[] args) method. That method must be properly documented in the JAR manifest for runnable jar files. I imagine that since you have (somewhere) a "runnable jar file" selection on, the project won't let you progress until you specify the required "main class"; however, if you reconfigure your project to not need the "runnable" part, then you can still use the jar normally, without specifying the "main class". The only drawback is that you won't be able to java -jar &lt;jarfile&gt; it.

http://stackoverflow.com/q/26866529
tagged with: spring-security
answer count: 1
has body: I am implementing CSRF protection using Spring security as per the doc One question I have is: When this token will get invalidated by the Spring security? Does the token gets invalidated for each request submit?
favorite count: 0
score: 6
has title: Spring CSRF token life
tagged with: csrf-protection
upvote count: 6
has answer: http://stackoverflow.com/a/26883097
type: AnsweredQuestion
tagged with: java
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/26883097

http://stackoverflow.com/comment/42408225
comment on: http://stackoverflow.com/q/26929523
type: QuestionComment
score: 0
has text: Well maybe it isn't deadlock the point is I dont know where it is happening, in fact it doesnt happen for me just sometimes for customers I just want to have a timeout.
type: Comment

http://stackoverflow.com/comment/42416449
comment on: http://stackoverflow.com/a/26936042
type: Comment
has text: updated the answer. replace your `for` loop with what i put there.
type: AnswerComment
score: 0

akka
type: Tag
tags question: http://stackoverflow.com/q/26869320
tag name: akka
tags question: http://stackoverflow.com/q/26975613
tags question: http://stackoverflow.com/q/26920120

http://stackoverflow.com/q/26889970
has answer: http://stackoverflow.com/a/37430021
tagged with: java
has answer: http://stackoverflow.com/a/74117931
has answer: http://stackoverflow.com/a/39918770
tagged with: annotations
has answer: http://stackoverflow.com/a/56685319
has answer: http://stackoverflow.com/a/41766552
has answer: http://stackoverflow.com/a/72891182
has answer: http://stackoverflow.com/a/74195108
tagged with: autowired
has answer: http://stackoverflow.com/a/32579782
has answer: http://stackoverflow.com/a/77986161
type: Question
has answer: http://stackoverflow.com/a/62002382
upvote count: 287
has answer: http://stackoverflow.com/a/39481979
has answer: http://stackoverflow.com/a/47344803
has answer: http://stackoverflow.com/a/55057631
has answer: http://stackoverflow.com/a/54416903
has answer: http://stackoverflow.com/a/72976564
possible better answer: http://stackoverflow.com/a/34823996
has answer: http://stackoverflow.com/a/76225924
has answer: http://stackoverflow.com/a/48209983
has title: intellij incorrectly saying no beans of type found for autowired repository
has answer: http://stackoverflow.com/a/34823996
has answer: http://stackoverflow.com/a/51082263
accepted answer: http://stackoverflow.com/a/31891805
score: 287
has answer: http://stackoverflow.com/a/76338204
has answer: http://stackoverflow.com/a/57191555
has answer: http://stackoverflow.com/a/72007472
has answer: http://stackoverflow.com/a/70920708
has answer: http://stackoverflow.com/a/42025703
has answer: http://stackoverflow.com/a/73828597
has answer: http://stackoverflow.com/a/48421735
has answer: http://stackoverflow.com/a/66969042
has comment: http://stackoverflow.com/comment/127208333
has answer: http://stackoverflow.com/a/75648041
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/68237689
downvote count: 0
has answer: http://stackoverflow.com/a/56974548
has answer: http://stackoverflow.com/a/77207254
has answer: http://stackoverflow.com/a/51104930
has answer: http://stackoverflow.com/a/52937132
has answer: http://stackoverflow.com/a/64998232
favorite count: 0
has answer: http://stackoverflow.com/a/55482714
has answer: http://stackoverflow.com/a/37539633
has comment: http://stackoverflow.com/comment/139450632
has answer: http://stackoverflow.com/a/42202119
has answer: http://stackoverflow.com/a/62901348
has answer: http://stackoverflow.com/a/64998035
has answer: http://stackoverflow.com/a/49793605
has answer: http://stackoverflow.com/a/79076077
has comment: http://stackoverflow.com/comment/118182024
has answer: http://stackoverflow.com/a/76354832
has answer: http://stackoverflow.com/a/36758392
tagged with: spring
has answer: http://stackoverflow.com/a/62037307
has answer: http://stackoverflow.com/a/63651176
has answer: http://stackoverflow.com/a/57676672
has answer: http://stackoverflow.com/a/75935654
has body: I have created a simple unit test but IntelliJ is incorrectly highlighting it red. marking it as an error No beans? As you can see below it passes the test? So it must be Autowired?
has answer: http://stackoverflow.com/a/31891805
has comment: http://stackoverflow.com/comment/137123425
has answer: http://stackoverflow.com/a/36423457
has answer: http://stackoverflow.com/a/37936066
has comment: http://stackoverflow.com/comment/123059614
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/53476090
answer count: 53
has answer: http://stackoverflow.com/a/57944750
has comment: http://stackoverflow.com/comment/42335524
has answer: http://stackoverflow.com/a/58676431
has comment: http://stackoverflow.com/comment/134828903

http://stackoverflow.com/a/26959061
score: 0
has body: yes there is. When you are trying to do any 2 things or more at one time , then your are looking for multithreading . It's not something you can learn in 5 minutes though so you should read about it here for example : public class Printer implements Runnable{ String name; public Printer(String name){ this.name=name; } public void run(){ while(true){ System.out.println("i am thread"+name); //in your case read or write bytes to dataline here; } } public static void main(String[] args){ Printer print1= new Printer("a"); Printer print2 = new Printer("b"); new Thread(print1).start(); new Thread(print2).start(); } } this would keep printing "i am thread a" " i am thread b " in no defined order since its not synchronized , so it could give aabbbbaababaaba rather than ababababab, but the idea is that they are both running at same time . this is just a rough example on how you would use threads , its missing synchronization and safety and stuff you should read about before tackling threads .
has comment: http://stackoverflow.com/comment/42460543
has comment: http://stackoverflow.com/comment/42459819
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26958643
type: Answer
answers question: http://stackoverflow.com/q/26958643

http://stackoverflow.com/comment/42276481
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26857172
has text: Thank you very much. You don't know how much you have helped me.

http://stackoverflow.com/comment/42348584
comment on: http://stackoverflow.com/q/26897748
score: 0
type: Comment
type: QuestionComment
has text: BigInteger? https://docs.oracle.com/javase/6/docs/api/java/math/BigInteger.html

http://stackoverflow.com/comment/42254901
has text: Sorry my bad. @codebox Sorry I not really sure about the API but I guess it works for all IP addresses?
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26845344

http://stackoverflow.com/a/27013913
accepted answer of: http://stackoverflow.com/q/26988638
has body: If you suspect problems with SSL, you could try the following workaround. Once server is started (e.g. via command line), go to web admin console and then to: Global security &gt; CSIv2 inbound communications and in transport section set transport to TCP-IP. Save and restart the server. This will disable SSL for RMI/IIOP connections. In Version 9 Global security &gt; RMI/IIOP security &gt;CSIv2 inbound communications Then in RAD in Server settings change Server connection types... to Manually provide connection settings and select only RMI. Check if it will work better. As last resort you could also try to start the server, then exit the RAD and restart the RAD again, it should detect server as already running. But it's not very useful...
has comment: http://stackoverflow.com/comment/42589731
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26988638
upvote count: 6
score: 6

http://stackoverflow.com/comment/42477298
comment on: http://stackoverflow.com/a/26943153
type: Comment
has text: Thanks for this, There will be cases where every point is actually in the same grid so the distance thing will still take inordinate amounts of time. However combining all items in the grid is something we have come up with independently and i'm trying this now. If this is still taking it's time we will try doing it only for what is on screen but that will still be everything at some points.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26940461
type: Answer
has body: You need a method to get the name from the user. I presume you have that. And you need a folder within which to save the files (unless you want the user to specify folder as well). When users enter file names, they might type characters that are not allowed in file names. You must scan the characters and sanitize what they type, otherwise the file creation will fail. File folder = new File("/put/the/desired/path/here/"); String fileNameFromUser = methodToGetFilename(); fileNameFromUser = cleanBadCharacters(fileNameFromUser); File theFile = new File(folder, fileNameFromUser + ".aaa"); now you can open, read, or write, the file specified by the user. Note that the variable folder is defined by you, either a string path, or another File variable.
has comment: http://stackoverflow.com/comment/42425038
answers question: http://stackoverflow.com/q/26940426
accepted answer of: http://stackoverflow.com/q/26940426
has comment: http://stackoverflow.com/comment/42425102
has comment: http://stackoverflow.com/comment/42425084
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42425049

http://stackoverflow.com/q/26899067
has body: Is there any way in java to get conjunctions of disjunctions of strings, i.e, for example If I have two String str1="a" and str2="c or d", where "or" here is disjunction. I need to get the output of conjunction of these two strings, i.e, a and (c or d) = (a and c) or (a and d) Is this possible in java ?
has comment: http://stackoverflow.com/comment/42351351
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42351072
has comment: http://stackoverflow.com/comment/42351093
answer count: 0
has comment: http://stackoverflow.com/comment/42352218
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/42351063
score: 0
has comment: http://stackoverflow.com/comment/42351418
has title: Conjunctions of disjunction in java

http://stackoverflow.com/q/26925575
tagged with: arrays
has comment: http://stackoverflow.com/comment/42397585
has answer: http://stackoverflow.com/a/26925978
has comment: http://stackoverflow.com/comment/42397599
has comment: http://stackoverflow.com/comment/42398760
has answer: http://stackoverflow.com/a/26925920
accepted answer: http://stackoverflow.com/a/26925920
has body: In java, What is the most efficient way to decide whether two arrays contain all of the same elements. The arrays can have duplicates or can be unsorted. Most efficient meaning run time complexity and space complexity.
has answer: http://stackoverflow.com/a/26925635
score: 0
has title: Determining equivalent arrays in Java
tagged with: unique
answer count: 4
has comment: http://stackoverflow.com/comment/42397614
has answer: http://stackoverflow.com/a/26926178
tagged with: set
has comment: http://stackoverflow.com/comment/42397744
has comment: http://stackoverflow.com/comment/42397840
has comment: http://stackoverflow.com/comment/42411161
has comment: http://stackoverflow.com/comment/42397728
type: Question
possible better answer: http://stackoverflow.com/a/26925635
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42397622
tagged with: java
tagged with: duplicates

http://stackoverflow.com/comment/42509108
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26988413
has text: *"The shape that comes up on the frame is the one whose location is at center."* But the immediate problem can be fixed by `@Override public Dimension getPreferredSize() { ..` of the shape components.
score: 0

http://stackoverflow.com/comment/42417617
type: Comment
type: QuestionComment
score: 1
has text: Imagine that you want to use JSON with a legacy application that is running under java 1.4. Now, try to resolve generics with java 1.4. Backwards compatibility is a potential reason; I don't know if it is the reason.
comment on: http://stackoverflow.com/q/26936436

http://stackoverflow.com/comment/42284852
type: Comment
type: QuestionComment
has text: Because your Default constructor isn't doing anything useful for `Parent p1 = new Parent();`. At least initialise your `int num` to 0 or something inside your Parent() default constructor.
comment on: http://stackoverflow.com/q/26862311
score: 0

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/26899485
tags question: http://stackoverflow.com/q/26873608
tags question: http://stackoverflow.com/q/26898818
type: Tag

http://stackoverflow.com/q/26964288
has answer: http://stackoverflow.com/a/26964455
has answer: http://stackoverflow.com/a/26964421
has answer: http://stackoverflow.com/a/26964616
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/26964400
has comment: http://stackoverflow.com/comment/42467012
has answer: http://stackoverflow.com/a/26964307
score: 0
has comment: http://stackoverflow.com/comment/42466506
accepted answer: http://stackoverflow.com/a/26964616
has body: I created a code to generate a random credit card number and I'm using this method to return a credit card number based in the user input. For some reason I am having a problem returning a value. Help please. public String getIssuerCode(String issuerSymbol) { String creditCardNumber = null; for (int i = 0; i &lt; 15; i++) { switch (issuerSymbol) { case ISSUER_MASTER_CARD: creditCardNumber = generateMasterCard(); break; case ISSUER_AMER_EXPRESS: creditCardNumber = generateAmericanExpress(); break; case ISSUER_VISA: creditCardNumber = generateVisa(); break; // System.out.println("error"); default: break; } } return creditCardNumber; }
favorite count: 0
has comment: http://stackoverflow.com/comment/42466448
has title: how to generate a random numbers for a credit card
answer count: 5
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26964421

http://stackoverflow.com/q/26939313
has answer: http://stackoverflow.com/a/26939363
type: Question
tagged with: ubuntu
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26939363
tagged with: tomcat
tagged with: linux
has answer: http://stackoverflow.com/a/26941541
accepted answer: http://stackoverflow.com/a/26941541
has body: I start javaEE with tomcat and linux ubuntu. i installed tomcat on linux successfully and see its first page in 127.0.0.1:8080 that was : "it works..." By the first example in my book, i create a directory called jspbook in webapps and a sub directory WEB-INFin jspbook that contains this web.xml: &lt;web-app xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"&gt; And another xml file called jspbook.xml in webapps directory: &lt;Context path="/jspbook" docBase="jspbook" debug="0"/&gt; Now after restarting tomcat, it doesn't display a blank directory in browser by 127.0.0.1:8080/jspbook/ in linux But i try it in windows and it displayed a blank directory correctly!
type: AnsweredQuestion
has title: tomcat can't load my webapp in ubuntu
tagged with: java

http://stackoverflow.com/q/26925669
has comment: http://stackoverflow.com/comment/42398084
has answer: http://stackoverflow.com/a/26926335
favorite count: 0
has comment: http://stackoverflow.com/comment/42399421
has body: I am creating a Java program but am dealing with a math problem but can't seem to solve it. This is my assignment: I have infinite numbers of numbered papers(1,2,3, ..). This papers are stacked into stacks using 2 variables a and b. If a = 5 and b = 3 the stacks look like: So the first stack has "a" items (5) and each next has "b" more (3) as previous. Now I have to figure out an equation that would tell me how many papers I need to remove to get to the specific one. For example, if I want to get to the paper numbered with 20, I will need to remove 4 papers to get to it. And this is the solution I am looking for, when I would enter a number of a specific paper, I just need to know how many I need to move (in the stack that it is in) to get to it. When I have this I put all papers back and search for the next one. Since I will make a program with it, that will deal with long numbers (up to 16 digits), the best solution would be to find some "non loop" equation. For example, if I will set a = 34354 and b = 56774 and I want to know how many papers to remove to get to paper numbered with 533663634611112. My inputs will be: - numbers a and b - number of papers I want to reach (c) - regarding the above variable (c), I will input this many numbers that represent numbered papers Output: - number of papers I have to move to get to all the papers that I have inserted All number will be very long, so would be the best to make a non loop program. Thanks for all help about this issue.
answer count: 3
has comment: http://stackoverflow.com/comment/42397765
has comment: http://stackoverflow.com/comment/42398672
has title: Math "non loop" equation
upvote count: 2
type: UnansweredQuestion
downvote count: 3
tagged with: equation
has answer: http://stackoverflow.com/a/26926879
has answer: http://stackoverflow.com/a/26926984
has comment: http://stackoverflow.com/comment/42397916
tagged with: math
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42398738
type: Question

http://stackoverflow.com/comment/76223516
comment on: http://stackoverflow.com/a/27508764
score: 0
type: AnswerComment
has text: This removed the .iml file in my environment. Re-generating/Re-importing it resolved the issue though.
type: Comment

http://stackoverflow.com/a/26936964
has comment: http://stackoverflow.com/comment/42418602
score: 1
upvote count: 1
has body: Delete gen folder and rebuild your project. Do that by going to Project -&gt; Clean.
has comment: http://stackoverflow.com/comment/42418535
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26936934
type: Answer
accepted answer of: http://stackoverflow.com/q/26936934

http://stackoverflow.com/comment/45011745
has text: What device, and what ndk builds?
comment on: http://stackoverflow.com/q/26916323
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26942333
has comment: http://stackoverflow.com/comment/42428747
has comment: http://stackoverflow.com/comment/42428649
has comment: http://stackoverflow.com/comment/42432763
answers question: http://stackoverflow.com/q/26941868
has comment: http://stackoverflow.com/comment/42428269
has comment: http://stackoverflow.com/comment/42428548
has comment: http://stackoverflow.com/comment/42428629
upvote count: 1
has comment: http://stackoverflow.com/comment/42428570
has body: Everything I have read is that android is supposed to call the onDestroy() and finish() when resources get low however this is never called. There is no guarantee that onDestroy() will ever get called by the system... the operating system has the ability to kill any process it pleases without warning at any time it wants. This was an intentional design decision, as it ensures the system remains in complete control of the device even in the presence of malicious applications. Memory management on android is a disaster. The system is very good at destroying background activities to make room for others when memory becomes low. You shouldn't have to worry about how many activities are currently in the back stack and you certainly shouldn't be holding weak references to these activities just so you can manually call finish() on them at a later time. The system will do all of this for you. If you are getting an OutOfMemoryError then that means either your application has a severe memory leak that you need to fix, or your application is allocating huge chunks of memory at a time until the runtime can no longer take it.
has comment: http://stackoverflow.com/comment/42428328
has comment: http://stackoverflow.com/comment/42428594
has comment: http://stackoverflow.com/comment/42428270
has comment: http://stackoverflow.com/comment/42428738
type: Answer
has comment: http://stackoverflow.com/comment/42428603
has comment: http://stackoverflow.com/comment/42428320
downvote count: 0
has comment: http://stackoverflow.com/comment/42428372
score: 1
has comment: http://stackoverflow.com/comment/42428248
has comment: http://stackoverflow.com/comment/42428631

http://stackoverflow.com/comment/42358121
type: AnswerComment
has text: @AndreaLigious, You can find the entire source here, https://github.com/smartwatermanagement/self-healing-water-networks/tree/master/SWNBackend/src
type: Comment
comment on: http://stackoverflow.com/a/26898570
score: 0

http://stackoverflow.com/comment/42401204
comment on: http://stackoverflow.com/q/26927462
type: QuestionComment
type: Comment
score: 2
has text: It would be nice to see what you have tried so far. Even a small snippet of code makes it easier to help than to read a long text.

http://stackoverflow.com/a/26939635
downvote count: 0
has comment: http://stackoverflow.com/comment/42423558
has comment: http://stackoverflow.com/comment/42423543
has comment: http://stackoverflow.com/comment/42423677
has comment: http://stackoverflow.com/comment/42423542
type: Answer
has comment: http://stackoverflow.com/comment/42423475
answers question: http://stackoverflow.com/q/26939420
upvote count: 1
has comment: http://stackoverflow.com/comment/42423626
has body: Override onRestoreInstanceState(Bundle savedInstanceState) to restore the date there. Also, in your onSaveInstanceState method call 'super.onSaveInstanceState` as the last statement.
score: 1

http://stackoverflow.com/comment/42480743
type: QuestionComment
comment on: http://stackoverflow.com/q/26970904
score: 0
has text: You mean u want to access methods of injected object & the object is null ? To avoid this you can use `ternary operator` or `insteanceof` checking for Null object.
type: Comment

http://stackoverflow.com/q/26958270
tagged with: java
upvote count: 1
type: Question
tagged with: jena
has body: I have an RDF/XML file like this: &lt;rdf:RDF xmlns:go="http://www.geneontology.org/dtds/go.dtd#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt; &lt;go:term rdf:about="http://www.geneontology.org/go#GO:0000001"&gt; &lt;go:accession&gt;GO:0000001&lt;/go:accession&gt; &lt;go:name&gt;mitochondrion inheritance&lt;/go:name&gt; &lt;go:synonym&gt;mitochondrial inheritance&lt;/go:synonym&gt; &lt;go:definition&gt;The distribution of mitochondria, including the mitochondrial genome, into daughter cells after mitosis or meiosis, mediated by interactions between mitochondria and the cytoskeleton.&lt;/go:definition&gt; &lt;go:is_a rdf:resource="http://www.geneontology.org/go#GO:0048308" /&gt; &lt;go:is_a rdf:resource="http://www.geneontology.org/go#GO:0048311" /&gt; &lt;/go:term&gt; &lt;/rdf:RDF&gt; Then I have to convert this RDF/XML into the N-Triples format, and I have done this automatically with Jena: FileManager.get().addLocatorClassLoader(Converter.class.getClassLoader()); Model model = FileManager.get().loadModel("smallfacts.rdf"); try { File file= new File("outputsmall.txt"); model.write(new FileOutputStream(file), "N-Triples"); } catch (IOException e) { e.printStackTrace(); But then I need to shorten each predicate with a prefix. I have to obtain something like this: &lt;http://www.geneontology.org/go#GO:2000391&gt; is_a &lt;http://www.geneontology.org/go#GO:2000389&gt;. &lt;http://www.geneontology.org/go#GO:2000391&gt; accession "GO:2000391". I have read about getNSPrefix() and have made some attempts, such as: FileManager.get().addLocatorClassLoader(Converter.class.getClassLoader()); Model model = FileManager.get().loadModel("smallfacts.rdf"); try { File file= new File("outputsmall.txt"); model.getNsPrefixURI("http://www.geneontology.org/dtds/go.dtd#"); model.write(new FileOutputStream(file), "N-Triples", "http://www.geneontology.org/dtds/go.dtd#"); } catch (IOException e) { e.printStackTrace(); How do I use getNsPrefixURI() in this case? Should I use an…
has title: How to load an N-Triples model and obtain the namespaces from RDF file?(newbie)
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26962294
tagged with: http://stackoverflow.com/tag/rdf
has answer: http://stackoverflow.com/a/26962294
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42458977
score: 1

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/26834434
type: Tag
tags question: http://stackoverflow.com/q/26951851
tags question: http://stackoverflow.com/q/26891747
tags question: http://stackoverflow.com/q/26984730

http://stackoverflow.com/a/26967740
score: 1
type: AcceptedAnswer
downvote count: 0
has body: I'll do a part and for remaining you have to do. Consider, - is a button with id 'button1' and '+' has button2 Quantity is a EditText which has id qty. Right, coming to the code : public class MainActivity extends Activity { EditText quantity; Button plus,minus; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); plus = (Button) findViewById(R.id.button1); minus = (Button) findViewById(R.id.button2); quantity = (EditText) findViewById(R.id.qty); plus.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String numb = quantity.getText().toString(); int num1 = Integer.parseInt(numb); int inum = num1+1; quantity.setText(Integer.toString(inum)); } }); minus.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { String numb = quantity.getText().toString(); int num1 = Integer.parseInt(numb); int inum = num1-1; quantity.setText(Integer.toString(inum)); } }); } } For sub total, you just need to multiply quantity and the item price. For the Total Price, you just need to add all the subtotals. Hope it helps! UPDATE about Catching Zero: You are getting the quantity here. String numb = quantity.getText().toString(); int num1 = Integer.parseInt(numb); So, if the number is 0, perform if else if (num1==0) { //Create a alert showing your quantity is zero. //here i use toast to display Toast.makeText(this,"Your quantity is Zero. You can't reduce the quantity", Toast.LENGTH_LONG).show(); } else { // do the stuffs here }
has comment: http://stackoverflow.com/comment/42536641
has comment: http://stackoverflow.com/comment/42536332
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26966910
accepted answer of: http://stackoverflow.com/q/26966910

http://stackoverflow.com/comment/42260442
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26848606
score: 0
has text: Oh, yeah. It's Map<B, A>.

http://stackoverflow.com/q/26971127
has comment: http://stackoverflow.com/comment/42478824
tagged with: java
upvote count: 7
accepted answer: http://stackoverflow.com/a/26971732
type: Question
has comment: http://stackoverflow.com/comment/98080552
type: AnsweredQuestion
has title: NullPointerException in hashCode() when deserializing an object graph
has comment: http://stackoverflow.com/comment/42479207
tagged with: hashmap
has comment: http://stackoverflow.com/comment/42478168
tagged with: hashcode
has comment: http://stackoverflow.com/comment/42478320
score: 7
answer count: 2
possible better answer: http://stackoverflow.com/a/62160246
has answer: http://stackoverflow.com/a/62160246
downvote count: 0
tagged with: deserialization
has body: I have a final field in a Java class that is sure to be initialized. When I serialize and deserialize a corresponding object graph, I get a NPE because the field is used in the hashCode() method but apparently not yet read back. I created a minimal test case that also contains the serialize()/deserialize() methods (in case those are buggy), but I can't seem to be able to understand what the (underlying) problem is or how to work around it. public class TestSerializerTest { private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestSerializerTest.class); private File workDir; @Before public void setUp() { workDir = new File("target/tmp"); } @After public void tearDown() { workDir.delete(); } private static class ManagingContainer implements Serializable { private static final long serialVersionUID = 1L; private final Set&lt;Contained&gt; containedElements = new HashSet&lt;Contained&gt;(); public Contained getContained(List&lt;String&gt; descriptors) { Contained contained = new Contained(this, descriptors); containedElements.add(contained); return contained; } } private static class Contained implements Serializable { private static final long serialVersionUID = 1L; @SuppressWarnings("unused") private final ManagingContainer container; private final List&lt;String&gt; descriptors; Contained(ManagingContainer container, List&lt;String&gt; descriptors) { this.container = container; if (descriptors == null) { throw new NullPointerException(); } this.descriptors = new ArrayList&lt;String&gt;(descriptors); } @Override public int hashCode() { return descriptors.hashCode(); } @Override public boolean equals(Object other) { if (this == other) { return true; } if (other == null || !(other instanceof Contained)) { return false; } return this.descriptors.equals(((Contained) other).descriptors); } } private static class OtherContainer implements Serializable { private static final long serialVersionUID = 1L; private final ArrayList&lt;Contained&gt; conta…
has comment: http://stackoverflow.com/comment/42478899
favorite count: 0
has answer: http://stackoverflow.com/a/26971732
linked to: http://stackoverflow.com/q/1792501

http://stackoverflow.com/comment/42426206
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26922820
has text: @Ravi still doesn't work. Says "The method setOnCompletionListener(MediaPlayer.OnCompletionListener) in the type MediaPlayer is not applicable for the arguments (new OnCompletionListener(){})"?
score: 0

http://stackoverflow.com/a/26948812
answers question: http://stackoverflow.com/q/26837008
has body: ended up using this // connect to MongoDB server. Mongo mongo = new Mongo("localhost", 27017); DB database = mongo.getDB("mydb"); DBCollection collection = database.getCollection("testCollection"); // create a simple db object where counter value is 0 DBObject temp = new BasicDBObject("name", "someName").append("counter", 0); // insert it into the collection collection.insert(temp); // create an increment query DBObject modifier = new BasicDBObject("counter", 1); DBObject incQuery = new BasicDBObject("$inc", modifier); // create a search query DBObject searchQuery = new BasicDBObject("name", "someName"); // increment a counter value atomically WriteResult upRes = collection.update(searchQuery, incQuery);
score: 0
type: Answer

http://stackoverflow.com/comment/42414080
has text: This problem is very specific to what you're working on now, and I doubt it forms a corpus of useful knowledge. My advice: use your debugger. Walk through until the exception is thrown and you'll have your answer
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26934791
score: 1

http://stackoverflow.com/comment/42392567
comment on: http://stackoverflow.com/q/26922439
score: 0
type: Comment
type: QuestionComment
has text: @Pshemo Thanks! I was unaware such site existed.

http://stackoverflow.com/q/26921011
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5290141
tagged with: java
downvote count: 3
type: Question
answer count: 2
upvote count: 0
has title: Android Service to Execute a Command
has answer: http://stackoverflow.com/a/26922748
has answer: http://stackoverflow.com/a/26922866
accepted answer: http://stackoverflow.com/a/26922748
has comment: http://stackoverflow.com/comment/42390924
possible better answer: http://stackoverflow.com/a/26922866
tagged with: android
has body: I'm trying, for the first time, to write a service within Android. I'm really new to Android programming. Here's what I am trying to do: In the background, without alerting the user, execute the command "while yes|yes". Problems: The emulator opens up a window when the app is launched I'm not sure if this actually does what I want because the emulator (Eclipse) refuses to run the command. I've written, to the best of my ability, the following code using a tutorial that I found online: MainJavaActivity.java: package com.example.runningservice; import java.io.IOException; import android.support.v7.app.ActionBarActivity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; public class MainActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startService(new Intent(this, MyService.class)); } } MyService.java: package com.example.runningservice; import java.io.IOException; import android.support.v7.app.ActionBarActivity; import android.app.Service; import android.content.Intent; import android.os.Bundle; import android.os.IBinder; public class MyService extends Service { Process x; @Override public IBinder onBind(Intent intent) { // TODO Auto-generated method stub return null; } public void onCreate() { } public void onStart(Intent intent) { try { x = Runtime.getRuntime().exec("which yes|yes"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } AndroidManifest.xml: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.runningservice" android:versionCode="1" android:versionName="1.0" &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;activity android:name=".MainActivity" android:l…
tagged with: shell
favorite count: 0
tagged with: command
tagged with: service
has comment: http://stackoverflow.com/comment/42391065
linked to: http://stackoverflow.com/q/11594063
score: -3

http://stackoverflow.com/comment/42307193
comment on: http://stackoverflow.com/q/26874072
has text: p=size os the first stack, k=how much bigger is the next stack of boxes d=days(one day for each box) numBox= number of the box we want to move , base = the base number..lowest number in a stack, topNum=highest number in the stack, size=how many boxes are in a stack, movedBox= how many boxes have we moved for numOfBox ...counter=how many boxes have we moved all together for all the days
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26957941
has comment: http://stackoverflow.com/comment/42456271
has comment: http://stackoverflow.com/comment/42455560
has comment: http://stackoverflow.com/comment/42456241
accepted answer of: http://stackoverflow.com/q/26957605
answers question: http://stackoverflow.com/q/26957605
score: 0
has body: Couple of issues in your code (I just went through add,getentry and sort method): In getEntry method, Remember index always start with 0 and go after till length - 1, so you should change our method to: public T getEntry(int givenPosition) { T result = null; if ((givenPosition &gt;= 0) &amp;&amp; (givenPosition &lt; length)) { Node currentNode = firstNode; for (int i = 0; i &lt; givenPosition; ++i) { currentNode = currentNode.next; // advance currentNode to next node } result = currentNode.data; // currentNode is pointing to the node at givenPosition } return result; } Change your interface and class implementation to remove passing on the ListInterface reference and your implementation should look like: public void SortPatient() { if (firstNode == null) { return; } boolean swapped; Node patient; do { swapped = false; patient = firstNode; while (patient.next != null) { if (patient.data.compareTo(patient.next.data) &gt; 0) { swap(patient, patient.next); swapped = true; } patient = patient.next; } } while (swapped); } private void swap(Node patient, Node nextPatient) { T temp = patient.data; patient.data = nextPatient.data; nextPatient.data = temp; } Your compare to method in Patient class needs some improvements and it should be as below: @Override public int compareTo(Patient t) { int patientSeriouness = t.seriousness; Date arrival = t.date; if (this.seriousness == patientSeriouness) { return this.date.compareTo(arrival); } else { return ((Integer)this.seriousness).compareTo(patientSeriouness); } } Last but not the least, your class definition LList should take generics of type Comparable (As you are using compareTo method), so you need to mandate that and it should be defined as public class LList&lt;T extends Comparable&lt;T&gt;&gt; implements ListInterface&lt;T&gt;
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42455090
has comment: http://stackoverflow.com/comment/42455032
type: Answer

http://stackoverflow.com/q/26837204
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42239862
type: Question
has body: I'm learning java. for my GUI program need to large radio buttons (larger than the standard). What can I do? I use Java Netbeans IDE - the latest version.
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/21174997
has title: How I can define a JRadioButton with large size?
favorite count: 0
linked to: http://stackoverflow.com/q/2899935
type: UnansweredQuestion
upvote count: 1
tagged with: jradiobutton
tagged with: swing
has answer: http://stackoverflow.com/a/26838747

http://stackoverflow.com/q/26891837
upvote count: 0
has body: I have a String which can contain HTML Code like this: String description = "&lt;strong&gt; HI &lt;/strong&gt; all, &lt;br /&gt; here some other special chars &lt; &gt; \" and Html tag which is not allowed &lt;b&gt; &lt;/b&gt;; I have an Array of allowed HTML values which needs be kept in this String: String[] allowedValues = {"&lt;br /&gt;", "&lt;strong&gt;", "&lt;/strong&gt;", "&lt;u&gt;", "&lt;/u&gt;", "&lt;i&gt;", "&lt;/i&gt;", "&lt;li&gt;", "&lt;/li&gt;", "&lt;ul&gt;", "&lt;/ul&gt;", "&amp;lt;", "&amp;gt;", "&amp;amp;", "&amp;qout;" ,"&amp;apos;"}; All other HTML tags or special chars must be replaced in this way: StringUtils.replaceEach(str, new String[]{"&amp;", "\"", "&lt;", "&gt;"}, new String[]{"&amp;amp;", "&amp;quot;", "&amp;lt;", "&amp;gt;"}) But the allowedValues must not be changed. How can I avoid changing the allowedValues?
has comment: http://stackoverflow.com/comment/42337524
accepted answer: http://stackoverflow.com/a/26904905
favorite count: 0
score: -1
possible better answer: http://stackoverflow.com/a/26897950
linked to: http://stackoverflow.com/q/9364540
type: Question
has answer: http://stackoverflow.com/a/26897950
answer count: 2
has comment: http://stackoverflow.com/comment/42337848
linked to: http://stackoverflow.com/q/11229831
has comment: http://stackoverflow.com/comment/42337775
has comment: http://stackoverflow.com/comment/42338444
tagged with: java
has title: Replace chars in String but avoid allowed HTML tags
downvote count: 1
has comment: http://stackoverflow.com/comment/42338714
has answer: http://stackoverflow.com/a/26904905
linked to: http://stackoverflow.com/q/1732348
type: AnsweredQuestion

http://stackoverflow.com/q/26906324
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
has title: Hibernate composite-element is not saved to DB after change
has answer: http://stackoverflow.com/a/26960690
score: 0
has body: I faced with issue when try to save object contains composite-element to DB. I have next DB structure CREATE TABLE "Security"."USERS" ( "ID_USER" INTEGER NOT NULL PRIMARY KEY, "NAME" VARCHAR(255) NOT NULL, "PSW_HASH" VARCHAR(255) ) CREATE TABLE "Security"."OBJECTS" ( "ID_OBJECT" INTEGER NOT NULL PRIMARY KEY, "CODE" VARCHAR(50) NOT NULL, "NAME" VARCHAR(255) NOT NULL ) CREATE TABLE "Security"."USERSOBJECTSRIGHT" ( "ID_USEROBJECT" INTEGER NOT NULL PRIMARY KEY, "ID_OBJECT" INTEGER NOT NULL REFERENCES Security.OBJECTS(ID_OBJECT), "ID_USER" INTEGER NOT NULL REFERENCES Security.USERS(ID_USER), "RIGHT" SMALLINT NOT NULL ) I mapped many-to-many relationship to my model like this <column name="ID_USER" not-null="true"/> <many-to-one name="rights" column="ID_OBJECT" class="app.domain.CPRights" lazy="false"/> <property name="right" type="int" column="RIGHT"/> <property name="right" type="java.lang.Integer" column="RIGHT" /> Read is ok and if i try to change simple properties (like name) in User class, they also are changed in DB. But when i try to change data in composite element for User like this: CPUser user = userService.getCPUser(id); for (CPUserRights rights : user.getUserRights()) { rights.setRight(2); } userService.updateCPUser(user); this data isn't store to DB. I do not understand why. Please help.
accepted answer: http://stackoverflow.com/a/26960690
type: AnsweredQuestion

http://stackoverflow.com/comment/42254440
type: Comment
type: QuestionComment
has text: @sashikanta I have edited my answer, Please see if the below helps you or not
comment on: http://stackoverflow.com/q/26845212
score: 0

testing
tags question: http://stackoverflow.com/q/26856790
tags question: http://stackoverflow.com/q/26931705
tags question: http://stackoverflow.com/q/26856693
tags question: http://stackoverflow.com/q/26835461
tags question: http://stackoverflow.com/q/26942440
tag name: testing
tags question: http://stackoverflow.com/q/26974744
tags question: http://stackoverflow.com/q/26953582
tags question: http://stackoverflow.com/q/26928328
tags question: http://stackoverflow.com/q/26836448
tags question: http://stackoverflow.com/q/26882604
type: Tag
tags question: http://stackoverflow.com/q/26967036
tags question: http://stackoverflow.com/q/26844722
tags question: http://stackoverflow.com/q/26932605
tags question: http://stackoverflow.com/q/26979217
tags question: http://stackoverflow.com/q/26843079
tags question: http://stackoverflow.com/q/26859576

http://stackoverflow.com/a/26984739
answers question: http://stackoverflow.com/q/26984296
type: Answer
has comment: http://stackoverflow.com/comment/42547428
has body: The dialog tag must be wrapped, then update the wrapper instead. <h:panelGroup id='wrapper' > <p:dialog appendTo="@(body)" id="dialog" widgetVar="dialogWidget" dynamic="true" /* given that the src is evaluated during the build phase, the use of dynamic content offer a second update */> <ui:include src="#{showEn.dialog}"/> </p:dialog> </panelGroup> <p:commandButton value="Add" action="#{showEn.displaySelectedNode}" oncomplete="PF('dialogWidget').show()" update="wrapper" /> the problem with this solution is that the content will not change in case the dialog is already loaded, i suggest try this solution : java private boolean urlChanged; public boolean isUrlChanged(){ if (urlChanged){ urlChanged = false; return true; } return false; } public void displaySelectedNode(){ urlChanged = true; if(!dialogs[0].equals("-")){ this.dialog="addEn.xhtml"; }else if(!dialogs[1].equals("-")){ this.dialog="addCu.xhtml"; }else if(!dialogs[2].equals("-")){ this.dialog="addTa.xhtml"; } } xhtml <p:dialog appendTo="@(body)" id="dialog" widgetVar="dialogWidget" dynamic="false" /* no need for that */> <h:panelGroup id='wrapper' > <p:remoteCommand name="updateAgain" update="wrapper"/> <c:if test="#{showEn.isUrlChanged}"> </c:if> <ui:include src="#{showEn.dialog}"/> </panelGroup> </p:dialog> <p:commandButton value="Add" action="#{showEn.displaySelectedNode}" oncomplete="PF('dialogWidget').show()" update="wrapper" />
has comment: http://stackoverflow.com/comment/42547407
score: 0
has comment: http://stackoverflow.com/comment/42503859

http://stackoverflow.com/comment/42278430
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26858419
type: Comment
has text: @WannaBeCoder JodaTime or Java 8's Time API

http://stackoverflow.com/a/68563630
has body: this one helped me i assume you have INNODB engine: spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL8Dialect spring.jpa.properties.hibernate.dialect.storage_engine=innodb
score: 0
answers question: http://stackoverflow.com/q/26881739
type: Answer

http://stackoverflow.com/q/26899923
has answer: http://stackoverflow.com/a/26899944
has answer: http://stackoverflow.com/a/26899945
has body: im currently using Integer.parseInt(str) to convert a string to an int. How can i prevent it from converting it (and just print out unknown number) if the user inputs a letter? String numberID = userChoice; int index = Integer.parseInt(numberID) - 1;
favorite count: 0
has comment: http://stackoverflow.com/comment/42352552
upvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26899945
score: 0
tagged with: java
downvote count: 1
has title: Prevent Integer.parseInt(str) from using a letter
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26899944

http://stackoverflow.com/comment/42283430
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26860040
has text: I want to set the db count in the text value. This text value is at the footer tab. I create a nethos in newbreakfastitems class and getting count from the db and setting that value to textview its works perfectly
type: AnswerComment

http://stackoverflow.com/comment/61615128
has text: @pdem Both methods do exist as of JavaFX 8.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26929542

http://stackoverflow.com/a/45829462
upvote count: 1
has body: I had the same problem before. My problem was the Entity relationship I was trying to establish by using a "List". I knew it was the cause because the program ran fine without the list variable. In your case, I think the problem is: private List&lt;Question&gt; _questions; I am assuming you already have a class named Question. So, try having: @OneToMany private Question _questions; But the thing is, in your method, you are going to handle it so it return a list. I used Spring Data JPA with CrudRepository. So, if you decide to use it, yours may look like this: public List&lt;Question&gt; findById( Long _id ); There are more changes you will have to do, but these are pretty easy and straightforward. Refer to this Java Brains video to have a better grasp and see what else needs to be modified.
answers question: http://stackoverflow.com/q/26881739
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/26986449
has title: Getting connection time out while running Oozie workflow through Java
tagged with: workflow
has body: I am getting following error when i try to run Oozie workflow using java IO_ERROR : java.net.ConnectException: Connection timed out: connect at org.apache.oozie.client.OozieClient.validateWSVersion(OozieClient.java:234) at org.apache.oozie.client.OozieClient.createURL(OozieClient.java:300) at org.apache.oozie.client.OozieClient.access$000(OozieClient.java:71) at org.apache.oozie.client.OozieClient$ClientCallable.call(OozieClient.java:366) at org.apache.oozie.client.OozieClient.run(OozieClient.java:547) at oozieDemo.main(oozieDemo.java:27) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) Here is my code: OozieClient wc = new OozieClient("http:xxxxxxx/oozie"); System.out.println(" connection established....." + wc); Properties conf = wc.createConfiguration(); conf.setProperty(OozieClient.APP_PATH,"hdfs:foo/xxx/workflow.xml"); conf.setProperty("jobTracker", "foo:8021"); conf.setProperty("nameNode","hdfs:xxxx"); conf.setProperty("queueName", "default"); conf.setProperty("appLibLoc","hdfs:/foo/xxx/lib"); String jobId = wc.run(conf); System.out.println("Workflow job submitted"); So here I can see connection is getting established but unable to run the workflow. I am new to this. So can't figure it out where exactly it is failing.
score: 0
tagged with: oozie
answer count: 1
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26987182
type: Question

http://stackoverflow.com/comment/42319160
comment on: http://stackoverflow.com/a/26881646
type: AnswerComment
has text: yourString.replace(",",",null")
score: 0
type: Comment

http://stackoverflow.com/a/26989511
downvote count: 0
score: 3
type: Answer
answers question: http://stackoverflow.com/q/26989208
upvote count: 3
has body: PdfBox is rather a low-level API for PDF files and, as such, does not offer help with designing tables out of the box. If you don't want to re-invent the wheel yourself and come up with such functionality, you might want to have a look at the PdfLayoutManager here: https://github.com/GlenKPeterson/PdfLayoutManager It provides a higher level API for PdfBox and offers text boxes with automatic line breaks, and also tables with line breaks.

http://stackoverflow.com/comment/42406639
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26928875
type: AnswerComment
has text: Then you have some other code that is updating the field. Note that if your entity is in hibernate's L2 cache, if you refresh it from the database it'll only refresh persistent fields. So if you changed this transient field to `true` at some point, it will remain `true` after the refresh.

http://stackoverflow.com/q/26957492
has comment: http://stackoverflow.com/comment/42454187
tagged with: java
has comment: http://stackoverflow.com/comment/42473482
type: Question
tagged with: casting
score: 0
tagged with: jruby
has body: This results in a java.lang.ClassCastException error. I'm new to both Java and JRuby, which is not helping my chances. java-side code (simplified) public ParallelTopicModel implements Serializable { private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException { ... bunch of stuff deserializing objects ... } public static ParallelTopicModel read (File f) throws Exception { ParallelTopicModel goodThing = null; ObjectInputStream ois = new ObjectInputStream (new FileInputStream(f)); goodThing = (ParallelTopicModel) ois.readObject(); ois.close(); return goodThing; } } jruby-side code my_jruby_object = ParallelTopicModel::read(java.io.File.new(some_filename)) The last statement throws a java.lang.ClassCastException, claiming that another java class (InstanceList) cannot be cast to ParallelTopicModel. I haven't delved into the java-side code very deeply, but I'm guessing that InstanceList is the type of the first object serialized in the file I'm trying to read, based on what I see in the code that's writing the serialization. A lightly-edited stack trace from my IDE looks like this: 11007: Resumed Thread # cc/mallet/topics/ParallelTopicModel.java:1997:in read': java.lang.ClassCastException: cc.mallet.types.InstanceList cannot be cast to cc.mallet.topics.ParallelTopicModel from java/lang/reflect/Method.java:606:ininvoke' from /home/tom/RubymineProjects/CaseTagger/baby-jruby.rb:32:in initialize' from /home/tom/RubymineProjects/CaseTagger/baby-jruby.rb:54:in(root)' from org/jruby/debug/RubyDebugger.java:204:in debug_load' from org/jruby/RubyKernel.java:1101:inload' from /home/tom/.rvm/gems/jruby-1.7.11/gems/ruby-debug-ide-0.4.23.beta1/bin/rdebug-ide:110:in `(root)' I've tried a number of JRuby-ish tricks using to_java and its ilk, but it appears that the objection is to the type of the data being returned. The Java code is (obviously) not mine, and I am certainly no Java programmer, but it looks as though the purpose of the cast is to force the u…
has title: JRuby: data type in deserialized input stream throws casting error
tagged with: serialization
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42381403
has text: my bad it's 10 seconds delivers ANR http://developer.android.com/training/articles/perf-anr.html I'll edit the post.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26874531
type: Comment

http://stackoverflow.com/q/26908854
has answer: http://stackoverflow.com/a/26908977
accepted answer: http://stackoverflow.com/a/26908977
has comment: http://stackoverflow.com/comment/42694783
has answer: http://stackoverflow.com/a/26909188
possible better answer: http://stackoverflow.com/a/27026091
has answer: http://stackoverflow.com/a/67370441
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27010677
tagged with: oop
tagged with: configuration
tagged with: java
answer count: 11
type: Question
has answer: http://stackoverflow.com/a/27092826
upvote count: 32
tagged with: runtime
has body: Let us assume up to runtime we do not know what are the details of configuration(may user need to configure these parameters in config file before running the application. I want to read those configuration details and need to reuse them wherever I need them in my application. For that I want to make them as global constants(public static final). So, My doubt is, is there any performance implications if I read from config file directly from the required class? since,runtime values I can not directly put in separate Interface. I am thinking it will impact performance.Please suggest me any better way to do this. UPDATE: Can I use separate final class for configuration details? putting all configuration details as constants in a separate public final class (To read all configuration details at once from the configuration file and storing them as global constants for later use in application)
has answer: http://stackoverflow.com/a/27106179
favorite count: 0
has answer: http://stackoverflow.com/a/27026091
has answer: http://stackoverflow.com/a/27094219
has answer: http://stackoverflow.com/a/27108545
has answer: http://stackoverflow.com/a/26908970
has title: What is the best way of reading configuration parameters from configuration file in Java?
has answer: http://stackoverflow.com/a/27120753
tagged with: initialization
has comment: http://stackoverflow.com/comment/42731125
downvote count: 0
score: 32

http://stackoverflow.com/q/26935845
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26937046
tagged with: applicationcontext
favorite count: 0
has title: How to exactly work the Spring Inheritance-based Proxies configuration?
score: 5
tagged with: spring
tagged with: design-patterns
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26937046
has body: I am studying for the Spring Core certification and I am finding some doubts related to the proxying notion. So on the study material I find the following quiz: There is a Java configuration class that contains the following methods: @Bean public AccountRepository accountRepository(){ return new JdbcAccountRepository(); } @Bean public TransferService transferService1() { TransferServiceImpl service = new TransferServiceImpl(); service.setAccountRepository(accountRepository()); return service; } @Bean public TransferService transferService2() { return new TransferServiceImpl( new JdbcAccountRepository() ); } As you can see there are 2 different implementation of a transferService() respectively named as transferService1() and transferService2() that create and return a TransferServiceImpl object. The first one creatre a new TransferServiceImpl object and then call the setAccountRepository() method on it. The second one simply create a TransferServiceImpl passing a new JdbcAccountRepository object to its constructor. It ask to me **Which is the best implementation brween the previous 2 methods? And the answer provided is: Prefer call to dedicated method. So I think that it say that the best way is the first implementation. It explain that AccountRepository bean is a singleton (because it is the standard scope for the beans in Spring) but that the JdbcAccountRepository() could be called twice or more times (for example in the previous code snippet it is called when are called the methods transferService1() and transferService2() and if so this would be a problem because AccountRepository have to be a singleton. Is it true? Or am I missing something? So I gather that at startup time foreach configuration class (annotated with @Configuration) is created a child class that extends my configuration class. For example if I have the following configuration class: @Configuration public class AppConfig { @Bean public AccountRepository accountRepository() { ... } @Bean public T…
has comment: http://stackoverflow.com/comment/42417416
type: Question
has comment: http://stackoverflow.com/comment/49821300
upvote count: 5
tagged with: proxy-pattern

http://stackoverflow.com/q/26962814
type: Question
has body: I have that I cannot load a single image (out of many) outside of IDE. I' m using ImageLoader: private Image loadImageFile(String path){ System.out.println("Load image: "+path); URL imgPath = getClass().getResource(path); Image img = null; try { img = ImageIO.read(imgPath); } catch(IllegalArgumentException | IOException e){ System.out.println("Cannot find file."); } return img; } All my paths that are passed down to that function starts with "/". As is shown in outputs. Here is output from Netbeans: Load image: /res/uvodBG.png ... Load image: /res/userBG.png Load image: /res/ruletaTopBG.jpg ... Load image: /res/uvodRegBG.png Everything runs fine under Netbeans but when I try to run .jar file: Load image: /res/uvodBG.png ... Load image: /res/userBG.png Cannot find file. Load image: /res/ruletaTopBG.jpg ... Load image: /res/uvodRegBG.png So my question is, why, when running it from .jar file, not all but only ONE image isn't loaded properly. StackTrace: Lis 17, 2014 11:58:51 DOP. loader.ImageLoader loadImageFile SEVERE: null java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at loader.ImageLoader.loadImageFile(ImageLoader.java:40) at loader.ImageLoader.loadTexture(ImageLoader.java:31) at viewParts.inner.UserInfoPanel.&lt;init&gt;(UserInfoPanel.java:66) at viewParts.inner.RoomsInnerPanel.&lt;init&gt;(RoomsInnerPanel.java:82) at viewParts.inner.LoginInnerPanel.&lt;init&gt;(LoginInnerPanel.java:80) at viewParts.RuletteFrame.&lt;init&gt;(RuletteFrame.java:38) at starter.NURRulette.main(NURRulette.java:20) And at UserInfoPanel.java:66 is: background = loader.loadTexture(BACKGROUND_PATH); where I call the loader instance in constructor with BACKGROUND_PATH being private final String BACKGROUND_PATH = "/res/userBG.png"; in the same class. MANIFEST file Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.2 Created-By: 1.8.0_05-b13 (Oracle Corporation) Class-Path: X-COMMENT: Main-Class will be added automatically by build Main-Cla…
has comment: http://stackoverflow.com/comment/42478965
tagged with: image
has comment: http://stackoverflow.com/comment/42463736
upvote count: 1
has comment: http://stackoverflow.com/comment/42480304
favorite count: 0
has comment: http://stackoverflow.com/comment/42463697
has comment: http://stackoverflow.com/comment/42483340
type: UnansweredQuestion
has title: Java Image loading can't find one image
has comment: http://stackoverflow.com/comment/42477892
has comment: http://stackoverflow.com/comment/42477869
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42465474
has comment: http://stackoverflow.com/comment/42479978

http://stackoverflow.com/comment/42441117
has text: Include the relevant code and the necessary steps to reproduce the issue in your post.
comment on: http://stackoverflow.com/q/26949880
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/q/26872350
tagged with: opencv
tagged with: video
has title: How adjust tolerance level for OpenCV detection false positives?
tagged with: java
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26872736
has body: I'm developing a system using OpenCV, which detects objects with the haarCascades xml files. However, there are many false detections. There is a way to minimize false detections? This is part of my code: private void detecta(String arquivo) { CascadeClassifier bodyDetector = new CascadeClassifier(path+arquivo); MatOfRect faceDetections = new MatOfRect(); bodyDetector.detectMultiScale(webcam_image, faceDetections); // bodyDetector.detectMultiScale(webcam_image, faceDetections); for (Rect rect : faceDetections.toArray()) { Core.rectangle(webcam_image, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0));// mat2Buf, mat2Buf); } if (faceDetections.toArray().length == 0) { toc.getLblSaida().setText(""); } else { //java.awt.Toolkit.getDefaultToolkit().beep(); toc.getLblSaida().setText(+faceDetections.toArray().length + "objetos detectados"); try { playSound(); } catch (IOException ex) { Logger.getLogger(TestWebCam.class.getName()).log(Level.SEVERE, null, ex); } } }

http://stackoverflow.com/comment/42329707
type: AnswerComment
comment on: http://stackoverflow.com/a/26887656
score: 0
type: Comment
has text: You get it right. I'll take a look and post the results soon.

http://stackoverflow.com/q/26833830
favorite count: 0
has title: Sort all Columns independently form a 2d array java
has answer: http://stackoverflow.com/a/26834054
type: UnansweredQuestion
has body: I need to have the columns organized in increasing order. Right now I have the following done but, it is sorting the rows and not columns.Any help would be nice, ive been working on this all day. Thanks. public static double[][] sortColumns(double[][] m) { double[][] sortedArray = new double[m.length][m.length]; for (int i = 0; i &lt; m.length; i++) { double[] temp = new double[m.length]; for (int j = 0; j &lt; m.length; j++) { temp[j] = m[j][i]; } Arrays.sort(temp); for (int j = 0; j &lt; temp.length; j++) { sortedArray[j][i] = temp[j]; } } return sortedArray; }
has answer: http://stackoverflow.com/a/26833904
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: sorting
answer count: 3
has answer: http://stackoverflow.com/a/26834140
downvote count: 0

http://stackoverflow.com/comment/42854792
type: AnswerComment
comment on: http://stackoverflow.com/a/26989069
score: 0
type: Comment
has text: Hello, I can try. Can you accept the answer from this question? Then people will see that this one is solved ;)

http://stackoverflow.com/comment/42386544
comment on: http://stackoverflow.com/q/26892480
has text: @JulianReschke Oh lord, not in `Accept:`! It's for the media-type converter that handles mapping incoming JSON to DTO's (and vice-versa).
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/q/26932187
accepted answer: http://stackoverflow.com/a/27976464
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26932388
upvote count: 1
has answer: http://stackoverflow.com/a/27976464
favorite count: 0
possible better answer: http://stackoverflow.com/a/26932388
has title: Swagger Spring mvc reponsebody
tagged with: swagger-ui
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swagger
has body: Is there a way to present the request body of a complex object in swagger with each field having it's input? In simple words if one of my apis expects a Person (suppose it has just a firstname/lastname) as @RequestBody then the only way to provide this Person with swagger would be to give the entire json of Person. Is there a way to enable each separate field to have it's separate input for firstname/lastname for example?

http://stackoverflow.com/a/26838092
has comment: http://stackoverflow.com/comment/42241500
has comment: http://stackoverflow.com/comment/42241779
upvote count: 2
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42241469
has comment: http://stackoverflow.com/comment/42242118
has body: The problem is that you catch the Exception and therefore no Exception will leave your doPost() method. You will only be redirected error page if an Exception matching the &lt;exception-type&gt; (either identical or a subclass of it) leaves your doPost() method. You should rethrow the Exception bundled in a RuntimeException for example: } catch(Exception e) { e1.printStackTrace(); throw new RuntimeException(e); } Unfortunately if we're talking about a general Exception you can't just not catch it because doPost() is declared to only throw instances of ServletException or IOException. You are allowed not to catch those, but java.lang.Exception must be caught.
has comment: http://stackoverflow.com/comment/42241586
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26838036
has comment: http://stackoverflow.com/comment/42242293
answers question: http://stackoverflow.com/q/26838036
has comment: http://stackoverflow.com/comment/42241544
type: Answer

http://stackoverflow.com/q/26913426
answer count: 2
has body: I generated the keystore : keytool -genkeypair -alias jetty -keyalg RSA -validity 30 -keystore keystore.jks I generated a CSR : keytool -certreq -alias jetty -file certreq.csr -keystore keystore.jks then I use this CSR to get a free SSL certificate, after that they send 3 certificates, which I added to my keystore : keytool -import -trustcacerts -alias root -file root.cer -keystore myKeystore keytool -import -trustcacerts -alias intermediate-file intermediate.cer -keystore myKeystore keytool -import -trustcacerts -alias trial -file trial.cer -keystore myKeystore I use jetty 9 so here's the config for it in jetty-ssl.xml : &lt;Configure id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory"&gt; &lt;Set name="KeyStorePath"&gt;&lt;Property name="jetty.base" default="." /&gt;/&lt;Property name="jetty.keystore" default="etc/keystore"/&gt;&lt;/Set&gt; &lt;Set name="KeyStorePassword"&gt;&lt;Property name="jetty.keystore.password" default="ironhide"/&gt;&lt;/Set&gt; &lt;Set name="KeyManagerPassword"&gt;&lt;Property name="jetty.keymanager.password" default="ironhide"/&gt;&lt;/Set&gt; &lt;Set name="TrustStorePassword"&gt;&lt;Property name="jetty.truststore.password" default="ironhide"/&gt;&lt;/Set&gt; But when I restart the server, it still shows as it is self-signed with https on the browser with red X mark here's the keystore: Keystore type: JKS Keystore provider: SUN Your keystore contains 4 entries root, Nov 16, 2014, trustedCertEntry, Certificate fingerprint (SHA1): 51:51:B8:63:8A:4C:1F:15:54:56:ED:37:C9:10:35:CA: D3:01:B9:36 intermediate, Nov 16, 2014, trustedCertEntry, Certificate fingerprint (SHA1): BE:D1:D1:4E:25:A7:94:36:83:9E:4B:A7:CD:84:48:96: B7:0A:7F:B0 trial, Nov 16, 2014, trustedCertEntry, Certificate fingerprint (SHA1): DF:A1:52:F0:60:31:4C:DB:0C:61:3D:CA:C4:A6:85:FE: D4:4C:CD:04 getlinked, Nov 14, 2014, PrivateKeyEntry, Certificate fingerprint (SHA1): 2C:82:F7:E8:09:C2:7D:7C:71:9E:86:C0:EC:85:22:AE: 20:7D:43:14
tagged with: ssl
tagged with: jetty-9
score: 0
has answer: http://stackoverflow.com/a/27037903
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26913911
tagged with: java
type: Question
has title: Thawte SSL free Certificate not detected - jetty server

http://stackoverflow.com/q/26967036
has answer: http://stackoverflow.com/a/33964571
upvote count: 13
linked to: http://stackoverflow.com/q/18425026
has comment: http://stackoverflow.com/comment/42471460
type: UnansweredQuestion
has title: how to unit test a synchronized method?
has answer: http://stackoverflow.com/a/26967660
score: 13
tagged with: unit-testing
linked to: http://stackoverflow.com/q/25168062
type: Question
tagged with: testing
tagged with: java
has answer: http://stackoverflow.com/a/28145774
downvote count: 0
tagged with: synchronized
favorite count: 0
has body: Say I have such a method: synchronized void incrementIndex() { index++; } I want to unit test this method to see whether index's final value is set correctly if multiple threads simultaneously attempt to increment index. Assuming I don't know about the "synchronized" keyword in the method's declaration (and I only know the contract of the method), how can I do the test? p.s. I am using Mockito for writing test cases if it helps.
answer count: 3

http://stackoverflow.com/q/26848502
has title: Scala - How to use Java Singleton Object
tagged with: java
has comment: http://stackoverflow.com/comment/42269852
tagged with: scala-2.11
linked to: http://stackoverflow.com/q/4445617
type: Question
has comment: http://stackoverflow.com/comment/46972900
downvote count: 0
answer count: 1
has body: I have been successfully been using existing Java projects for my Scala project but ran into a NoClassDefFoundError when using a Java singleton: public class SpecificUser extends BasicUser { private static SpecificUser INSTANCE = new SpecificUser(); protected SpecificUser() { } public static SpecificUser getInstance() { return INSTANCE; } ... } Here is the exact error: play.api.Application$$anon$1: Execution exceptionRuntimeException: java.lang.NoClassDefFoundError: Could not initialize class SpecificUser at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.5.jar:2.3.5] at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.5.jar:2.3.5] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.11-2.3.5.jar:2.3.5] at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.11-2.3.5.jar:2.3.5] at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [scala-library-2.11.1.jar:na] Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class SpecificUser at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:523) ~[play_2.11-2.3.5.jar:2.3.5] at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.11-2.3.5.jar:2.3.5] at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4$$anonfun$apply$5.apply(Action.scala:130) ~[play_2.11-2.3.5.jar:2.3.5] at play.utils.Threads$.withContextClassLoader(Threads.scala:21) ~[play_2.11-2.3.5.jar:2.3.5] at play.api.mvc.Action$$anonfun$apply$1$$anonfun$apply$4.apply(Action.scala:129) ~[play_2.11-2.3.5.jar:2.3.5] Caused by: java.lang.NoClassDefFoundError: Could not initialize class SpecificUser at controllers.UsersController$$anonfun$usersDatatable$1.apply(UsersController.scala:36) ~[classes/:na] at controllers.Users…
has answer: http://stackoverflow.com/a/32858402
favorite count: 0
has comment: http://stackoverflow.com/comment/42259960
has comment: http://stackoverflow.com/comment/42260234
tagged with: singleton
has comment: http://stackoverflow.com/comment/43538640
upvote count: 3
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42307239
linked to: http://stackoverflow.com/q/17973970
score: 3
tagged with: sbt

http://stackoverflow.com/q/26968523
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42473577
has title: How to print a message when a user closes Windows calculator?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26968618
score: 1
tagged with: runtime.exec
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26968868
possible better answer: http://stackoverflow.com/a/26968618
accepted answer: http://stackoverflow.com/a/26968868
answer count: 2
has body: I have a program in java. The program opens Windows calculator with Runtime.exec. So far so good, but I need that when program is closed by a user, a message appears saying "Program has been closed successfully". I make it with destroy() but that isn't what I need.

http://stackoverflow.com/q/26961510
tagged with: user-interface
answer count: 1
tagged with: android
has answer: http://stackoverflow.com/a/26961526
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26961526
tagged with: java
has body: i want to develop an app like a calculator. The problem is, that the text buttons have to be in the same order on every device. I tried it like this but i doesn't work: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity" android:id="@+id/RelativeLayout1" android:background="@drawable/neon_bg"&gt; &lt;Button android:layout_width="140dp" android:layout_height="75dp" android:text="New Button" android:id="@+id/button1" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; &lt;Button android:layout_width="140dp" android:layout_height="75dp" android:text="New Button" android:id="@+id/button2" android:layout_alignTop="@+id/button1" android:layout_toRightOf="@+id/button1" android:layout_toEndOf="@+id/button1" android:layout_weight="8"/&gt; &lt;Button android:layout_width="140dp" android:layout_height="75dp" android:text="New Button" android:id="@+id/button3" android:layout_toEndOf="@+id/button2" android:layout_alignTop="@+id/button2" android:layout_toRightOf="@+id/button2" /&gt; &lt;Button android:layout_width="140dp" android:layout_height="75dp" android:text="New Button" android:id="@+id/button4" android:layout_toEndOf="@+id/button3" android:layout_alignTop="@+id/button3" android:layout_toRightOf="@+id/button3" /&gt; &lt;Button android:layout_width="140dp" android:layout_height="75dp" android:text="New Button" android:id="@+id/button5" android:layout_below="@+id/button1" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" /&gt; &lt;Button android:layout_width="140dp" android:layout_height="75dp"…
type: Question
has comment: http://stackoverflow.com/comment/42461189
score: 0
has title: How to scale text buttons android?

http://stackoverflow.com/comment/42394666
type: QuestionComment
score: 3
has text: You cannot have the same class in two jars. You have no control over which one gets loaded. You must figure out which JAR is a superset of the other one and use only that. I suspect `jersey-bundle` is a superset of `jersey-core`.
type: Comment
comment on: http://stackoverflow.com/q/26923775

http://stackoverflow.com/a/26942356
answers question: http://stackoverflow.com/q/26942330
has comment: http://stackoverflow.com/comment/42429436
type: AcceptedAnswer
downvote count: 0
has body: If you absolutely have to use NameValuePair, than yes. Only thing I would suggest is creating ArrayList of a size of pairs.size() to avoid overhead of ArrayList resizing internal array multiple times as it grows gradually: List&lt;NameValuePair&gt; nvpList = new ArrayList&lt;&gt;(pairs.size()); for (Map.Entry&lt;String, String&gt; entry : pairs.entrySet()) { nvpList.add(new NameValuePair(entry.getKey(), entry.getValue())); }
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26942330
score: 6

http://stackoverflow.com/comment/42415761
type: Comment
comment on: http://stackoverflow.com/a/26934294
type: AnswerComment
has text: I'm trying out Java as a means of building mobile apps. This was just an example to try out the concepts. Does Scala meet this requirement?
score: 0

http://stackoverflow.com/comment/42287628
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26863738
has text: @dici: Are you editing the question without reading it? "before colon only" original output was ok and you modified it!

http://stackoverflow.com/comment/42258202
type: AnswerComment
comment on: http://stackoverflow.com/a/26847708
type: Comment
has text: Okay but what if I want to format my clock like above? That is, I want to remove the AM/PM?
score: 0

http://stackoverflow.com/comment/42269099
score: 0
type: Comment
has text: @user2177940 I put an extra `.` in by accident. Updated.
comment on: http://stackoverflow.com/a/26853248
type: AnswerComment

http://stackoverflow.com/comment/42339449
comment on: http://stackoverflow.com/q/26860256
has text: @Andreas M. It is because of the face-config.xml file. I deleted that file, and every thing worked fine. I dnt know why.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/42493309
score: 2
comment on: http://stackoverflow.com/q/26979478
type: Comment
type: QuestionComment
has text: Why would printing a message change whether the guess was too low?

http://stackoverflow.com/q/26945713
has comment: http://stackoverflow.com/comment/42433861
tagged with: java
has comment: http://stackoverflow.com/comment/42433960
score: 0
accepted answer: http://stackoverflow.com/a/26945761
answer count: 2
has title: Reversing default Java LinkedList
has comment: http://stackoverflow.com/comment/42433847
has comment: http://stackoverflow.com/comment/42433984
has comment: http://stackoverflow.com/comment/42434124
possible better answer: http://stackoverflow.com/a/26945899
type: AnsweredQuestion
tagged with: linked-list
has answer: http://stackoverflow.com/a/26945899
has answer: http://stackoverflow.com/a/26945761
has body: I can write my own LinkedList and reverse it. But I am not able to reverse default java.util.LinkedList My problem is how to do something like the following for java.util.LinkedList while (CurrentNode != NULL) { Node NextNode = CurrentNode.next; CurrentNode.next = PreviousNode; /* repeat the process, but have to reset the PreviousNode and CurrentNode */ PreviousNode = CurrentNode; CurrentNode = NextNode; }
type: Question
has comment: http://stackoverflow.com/comment/42433912

http://stackoverflow.com/a/26992185
has comment: http://stackoverflow.com/comment/42517318
upvote count: 1
has comment: http://stackoverflow.com/comment/42517608
score: 1
has comment: http://stackoverflow.com/comment/42517287
type: AcceptedAnswer
downvote count: 0
has body: (too long for comment, so adding an answer) You should update the question with the code of Synonyme.createSynonyme() and Term.createTerm(). Your @OneToMany mapping is strange, that could be the cause of the problem (check out the documentation for collection mappings). In this @OneToMany the target table (Term) contains foreign key to source table (Synonyme). That said, ID is probably not the column you want, but something like SYNONYME_ID. You can also post your table structure so anyone interested can have the full picture. Once the mapping looks OK, it will be easier to look for the solution to the problem, if it doesn't get resolved when mappings are fixed.
type: Answer
accepted answer of: http://stackoverflow.com/q/26975428
answers question: http://stackoverflow.com/q/26975428
has comment: http://stackoverflow.com/comment/42515549

http://stackoverflow.com/q/26904689
has answer: http://stackoverflow.com/a/26904787
score: 2
has answer: http://stackoverflow.com/a/26904802
has title: What if a HashMap is full?
favorite count: 0
has answer: http://stackoverflow.com/a/26905213
has body: I know java Hashmap has a capacity and load factor parameter.So , if the number of items in this hashmap is more than capacity* load factor, a new hashmap will be reconstructed.I have some questions about the re-constructions of it: The previous hashmap will be reclaimed or still be in use if the reconstruction happened? since we need a larger size hashmap , so , will the hash function be changed ? For ConcurrentHashMap , what if one thread is inserting(Of cource, this insert operation has lead to a re-construction) and another thread is reading?For example, it will read from the old hashmap or from the new hashmap?
answer count: 5
upvote count: 3
type: UnansweredQuestion
tagged with: concurrenthashmap
downvote count: 1
has answer: http://stackoverflow.com/a/26904993
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/70631924
tagged with: java
has comment: http://stackoverflow.com/comment/42361021

http://stackoverflow.com/comment/42274447
comment on: http://stackoverflow.com/a/26855934
score: 0
type: AnswerComment
has text: I have added the source code. If you import it to (whatever ide) and run it. You will see that the player moves around the screen fine, but sometimes glitches. Then if you go to the player class and remove the commented code(you code) you will see what happens. That is because of the `g.translate` interfering with your code.
type: Comment

http://stackoverflow.com/q/26896880
has answer: http://stackoverflow.com/a/26898072
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
has body: Given is a set M with some elements, e.g. M={a, b} and another set F with specific numbers representing the quantity in the permutations of M. e.g. F={3, 1}, so the permutations are: P={(a, a, a, b), (a, a, b, a), (a, b, a, a), (b, a, a, a)} for this example. I want to print those but after fiddling around with recursion I still can't get it to work. My current code is like: void printPermutations(Map&lt;Integer, String&gt; m, List&lt;Integer&gt; f, List&lt;Integer&gt; cf, int size, int depth, int index, int innerindex, List&lt;String&gt; toPrint) { if(depth == size) { System.out.println(""); for(String a : toPrint) System.out.print(a + " "); System.out.println(""); } else { for(int i = index + 1; i &lt; m.size(); ++i) { if(f.get(innerindex).compareTo(Integer.valueOf(1)) &lt; 0) ++innerindex; toPrint.add(m.get(innerindex)); f.set(innerindex, f.get(innerindex) - Integer.valueOf(1)); printPermutations(m, f, f, size, depth + 1, i, innerindex, toPrint); f.set(innerindex, f.get(innerindex) + Integer.valueOf(1)); toPrint.remove(m.get(innerindex)); if(f.get(innerindex).compareTo(cf.get(innerindex)) == 0 &amp;&amp; innerindex &gt; 0) --innerindex; } } } //call //asume some cool elements in f and mAsSet // f.size() == mAsSet.size() List&lt;String&gt; toPrint = new ArrayList&lt;String&gt;(); Map&lt;Integer, String&gt; m = new HashMap&lt;Integer, String&gt;(mAsSet.size()); int counter = 0; for(String a : m) m.put(Integer.valueOf(counter++), a); int size = 0; for(Integer i : f) size += i; printPermutations(m, f, f, size, 0, -1, 0, toPrint); I don't really see whats wrong here, it prints exactly nothing. Of course I debugged this, but I really do not have any other idea to kindof archieve what I want.
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/4240080
has comment: http://stackoverflow.com/comment/42347823
has comment: http://stackoverflow.com/comment/42347024
score: 0
has comment: http://stackoverflow.com/comment/42347496
has comment: http://stackoverflow.com/comment/42347565
accepted answer: http://stackoverflow.com/a/26898072
has comment: http://stackoverflow.com/comment/42347324
has title: Print permutations of two given sets

http://stackoverflow.com/q/26943681
tagged with: filenotfoundexception
tagged with: client-server
answer count: 2
possible better answer: http://stackoverflow.com/a/26944197
has answer: http://stackoverflow.com/a/26944197
score: 0
has answer: http://stackoverflow.com/a/26947255
has title: File Not Found exception --- having issue with passing File-Reference to RMI-Client
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/26947255
type: AnsweredQuestion
tagged with: filereference
tagged with: rmi
tagged with: java
has body: I was trying yesterday to communicate one of my client with my system being the Remote Server and a Client system with Ubuntu 14.04. The code was about File transfer from Sever to client by passing File reference to the client and client downloading it using the reference,. We were connected to each other through LAN and we able to ping successfully each other's IP(my---10.0.0.2 and his---10.0.0.1). But,when we ran this code with rmiregistry &amp; on my CentOS Linux and then running Server Side class on my system &amp; his running of java Client class, our connection was done,but, we were unable to pass the file from my system to his system... The Exception thrown was :- java.io.FileNotFoundException at Java_Client_1 --- File in = u1.Uploads(); // I have printed the comment on the line having error in the class Java_client_1 class' `main()` method. Common interface residing on client and server :- import java.io.*; import java.rmi.*; public interface Upload_1 extends Remote { File Uploads() throws RemoteException; } Client Class code :- import java.io.*; import java.rmi.*; import java.rmi.registry.*; public class Java_Client_1 { public static void main(String[] args) { try{ Registry registry=LocateRegistry.getRegistry("10.0.0.2",2000); Upload_1 u1=(Upload_1)registry.lookup("Uploading"); //File in=new File("/home/ssuman/Public/KALI_LINUX/MyFavourite","something.mp4"); File out=new File("/home/asad/Music","tymaPaulMultithreaded.mp4"); System.out.println("Transferring File---Please be Patient...\n"); File in = u1.Uploads(); // exception thrown here,please check... FileInputStream fis = new FileInputStream(in); FileOutputStream fos = new FileOutputStream(out); byte[] buf = new byte[4096]; int i = 0; while ((i = fis.read(buf)) != -1) { fos.write(buf, 0, i); } if (fis != null) fis.close(); if (fos != null) fos.close(); System.out.println("File Successfully Transferred..."); System.out.println("Congratulations,RMI is working successfully!!!"); } catch(Exception e){ e.print…
downvote count: 1
type: Question

http://stackoverflow.com/comment/42308316
comment on: http://stackoverflow.com/q/26875226
type: Comment
type: QuestionComment
has text: "*but whenever I use that it throws Incompatible types, and says that Authenticator isn't a functional interface*" if `Authenticator` is not [functional interface](https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html#approach6) (note: abstract class with only one abstract method is not considered functional *interface*) then no, you can't use lambda to implement its method.
score: 2

http://stackoverflow.com/comment/42486389
comment on: http://stackoverflow.com/q/26975030
score: 0
type: Comment
type: QuestionComment
has text: The problem is not the memory allocated to te JRE. Yes i use the -Xmx command. Yhe problem is the jre under MAC OS which seems to not allow big components.

http://stackoverflow.com/comment/56494271
comment on: http://stackoverflow.com/a/26964179
type: Comment
has text: It is **not** "hiding" in the sense of the JLS. From the [JLS §8.4.8.2](http://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.4.8.2) (emphasis added): _"If a class C declares or inherits a `static` method m, then m is said to hide any method m', **where the signature of m is a subsignature (§8.4.2) of the signature of m'**, in the superclasses and superinterfaces of C that would otherwise be accessible to code in C."_ In your example, `doSomethingStatic()` in `Base` is still accessible from code in `Derived` because the args are different. Nothing is hidden.
type: AnswerComment
score: 1

hql
tag name: hql
type: Tag
tags question: http://stackoverflow.com/q/26840090
tags question: http://stackoverflow.com/q/26843776

http://stackoverflow.com/comment/42318636
type: Comment
has text: It seems that you are using Retrofit library for client. You can try adding this to your interface **@Headers({"Content-Type: image/jpeg"})**. After that you can get the inputstream with response.getBody().in(). Then you can convert this InputStream to byte array with some helper method. You can follow this link with Retrofit file support. (http://blog.pawelhajduk.net/retrofit-file-support/).
type: AnswerComment
comment on: http://stackoverflow.com/a/26875419
score: 0

http://stackoverflow.com/q/26987056
accepted answer: http://stackoverflow.com/a/26987134
answer count: 1
tagged with: swing
has body: I have a JTable with four columns, in the fourth column I placed the JTextarea.. After entering the value in text area, I will reload the table , at that time value inside text area is not get saved and text area is empty. How to solve my problem, suggestions please?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42506907
has answer: http://stackoverflow.com/a/26987134
has title: How to save the value in JTextArea into JTable?
type: Question
tagged with: jtextarea
tagged with: jtable
score: 0

http://stackoverflow.com/comment/42515571
comment on: http://stackoverflow.com/q/26986718
has text: Did you test it in eclipse? Sorry but i've not found any exeptions...
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42321170
has text: a jsp would (likely) be compiled by tomcat. If your code is being compiled from a jsp then the error you mentioned indicates you don't have access to the appropriate jar file. (though you are receiving runtime objects from it's governing classloader). however the type of code you are writing is something I would normally only expect to be compiled and packaged into a warfile before being placed in tomcat. In that case, I would expect you compile against a set of jarfiles, and then create a distribution warfile in which you package any dependencies.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26844493

http://stackoverflow.com/q/26851308
tagged with: java
tagged with: loops
upvote count: 1
type: Question
has title: Looping until a certain character is inputted?
has comment: http://stackoverflow.com/comment/42265056
has comment: http://stackoverflow.com/comment/42265009
has answer: http://stackoverflow.com/a/26851363
answer count: 3
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I took an excerpt of my code that needs working on, I know its standard practice to post all of the code but I dont think its needed here. if(playerValue &gt; 10 &amp;&amp; playerValue &lt; 21){ System.out.println("Players Value so far " + playerValue + ", Do you want to draw another card? Y/N"); // input a y or n answer decision = sob.next(); if(decision.equals("Y") || decision.equals("y")){ continue; }else if(decision.equals("N") || decision.equals("n")){ break; } } } How how I change this statement to either accept a Y or N, as right now if I input anything bar them two character, it will continue as if I have pressed Y.
has answer: http://stackoverflow.com/a/26851719
has answer: http://stackoverflow.com/a/26851762
has comment: http://stackoverflow.com/comment/42265149
has comment: http://stackoverflow.com/comment/42265051
score: 1

http://stackoverflow.com/comment/42336708
score: 2
has text: Without some code it's hard to find that out. It could be anything.
comment on: http://stackoverflow.com/q/26891341
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42281569
comment on: http://stackoverflow.com/q/26860479
score: 0
type: Comment
type: QuestionComment
has text: What's your question?

http://stackoverflow.com/a/26992519
score: 0
type: Answer
has body: Just found what my problem was, I had to extend my class to ActionBarActivity, now it`s working, thank you all.
answers question: http://stackoverflow.com/q/26979268

http://stackoverflow.com/comment/42430492
has text: You never mentioned negative numbers in your question. I'm fairly certain you can't do it more efficiently without storing the sequence of numbers which you said could not be done in your question.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26943655
type: Comment

http://stackoverflow.com/q/26906463
tagged with: eclipse
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42364342
tagged with: plugins
has answer: http://stackoverflow.com/a/26907782
type: UnansweredQuestion
score: 1
upvote count: 1
tagged with: java
has body: When i adjust the project nature of a running project WorkspaceJob job = new WorkspaceJob("AddingNature") { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { try { IProjectDescription description = activeProject .getDescription(); String[] prevNatures = description.getNatureIds(); String[] newNatures = new String[prevNatures.length + 1]; System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length); newNatures[prevNatures.length] = ID; description.setNatureIds(newNatures); activeProject.setDescription(description, new NullProgressMonitor()); return Status.OK_STATUS; } catch (CoreException e) { LOGGER.log(Level.SEVERE, WARNING_NATURE_FAIL, e.getMessage()); return Status.CANCEL_STATUS; } } job.schedule() I get an error " The resource tree is locked for modifications." An exception stack trace is not available. I thought the schuduling should avoid the resource tree from being locked. What can i do to prevent this?, is there an other way to add natures / convert projects This code is called from a menuitem using a class that extends AbstractHandler.
has title: Programmatically adding nature to existing project

http://stackoverflow.com/comment/42354581
type: QuestionComment
has text: @Obicere Yes it does. Try it. You'll get the wrong answer, just like royhowie's solution here.
comment on: http://stackoverflow.com/q/26900861
score: 0
type: Comment

http://stackoverflow.com/comment/42479575
comment on: http://stackoverflow.com/q/26971909
score: 0
type: Comment
type: QuestionComment
has text: I tried that, but that causes my app to crash when i start the activity, also, in other .java files I never had to do that and they would work fine.

http://stackoverflow.com/a/26954081
type: AcceptedAnswer
downvote count: 0
has body: You can't call start(),stop, and getElapsedTime() methods directly in the TestStopWtach class. You need to have a StopWatch Object to call these methods in different class. There must be a public static void main(String args[]) method or some other method in the TestStopWatch Class over which you be calling these things... Also, you need to invoke method calls using StopWatch Class object... Next,you need to take care that both these classes reside under the same package to call the methods of them as shown below in the code... The StopWatch class must look like :- public class StopWatch { private double startTime; private double endTime; public long start() { startTime = System.currentTimeMillis(); return startTime; } public long stop() { endTime = System.currentTimeMillis(); return endTime; } public double getElapsedTime(endTime, startTime) { return endTime - startTime; } } Also, make some changes in StopWatch class by changing the return-type of the methods start() and stop(). The TestStopWatch class must look like something :- import java.util.Arrays; public class TestStopWatch { public static void main(String args[]){ StopWatch sw=new StopWatch(); long p=sw.start(); // trying to call the start method in the previous class // code to create and sort array long q=sw.stop(); //stop method in previous class // call getElapsedtime and print System.out.println(sw.getElapsedTime((double)q,(double)p)); } }
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26954045
answers question: http://stackoverflow.com/q/26954045

http://stackoverflow.com/q/26852835
favorite count: 0
type: UnansweredQuestion
score: 6
tagged with: java-ee-7
upvote count: 6
linked to: http://stackoverflow.com/q/46419496
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/87799683
tagged with: endorsed
type: Question
tagged with: xerces2-j
downvote count: 0
has body: How do I use the endorsed standard mechanism to use xerces in a GlassFish 4.0 WAR application? According to the documentation*, you should put it into domain-dir/lib/endorsed. However, when I put xercesImpl, xml-apis as well as xml-resolver there, the classes are not available from my classes in the WAR. This is most proabably due to an inconsistency between the docs and the default config: the domain.xml does not list domain-dir/lib/endorsed. When I include it or put the files into glassfish-install-dir/lib/endorsed, the startup fails with the following exception: Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:97) at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54) Caused by: A MultiException has 5 exceptions. They are: 1. javax.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxOutputFactory not found 2. java.lang.IllegalStateException: Unable to perform operation: create on com.sun.enterprise.v3.server.DomainXmlPersistence 3. javax.xml.stream.FactoryConfigurationError: Provider com.ctc.wstx.stax.WstxInputFactory not found 4. java.lang.IllegalArgumentException: While attempting to resolve the dependencies of com.sun.enterprise.v3.server.GFDomainXml errors were found 5. java.lang.IllegalStateException: Unable to perform operation: resolve on com.sun.enterprise.v3.server.GFDomainXml at org.jvnet.hk2.internal.Collector.throwIfErrors(Collector.java:88) at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:252) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:360) at org.jvnet.hk2.internal.SystemDescriptor.creat…
has title: use endorsed standard override mechanism for xerces in GlassFish 4.0
tagged with: glassfish
linked to: http://stackoverflow.com/q/6327262

http://stackoverflow.com/comment/42501223
comment on: http://stackoverflow.com/a/26983382
type: AnswerComment
score: 0
type: Comment
has text: You can use the `Scanner.nextLine()` method. It returns an entire line of user input. I have edited the answer to add this.

http://stackoverflow.com/q/26891861
linked to: http://stackoverflow.com/q/24933007
has comment: http://stackoverflow.com/comment/42338967
has comment: http://stackoverflow.com/comment/42339232
has comment: http://stackoverflow.com/comment/42338551
has comment: http://stackoverflow.com/comment/42338033
has comment: http://stackoverflow.com/comment/42337757
accepted answer: http://stackoverflow.com/a/26893449
answer count: 1
has comment: http://stackoverflow.com/comment/42338640
has comment: http://stackoverflow.com/comment/42338541
tagged with: asynchronous
tagged with: android
has comment: http://stackoverflow.com/comment/42338601
has comment: http://stackoverflow.com/comment/42338800
has comment: http://stackoverflow.com/comment/42338314
has body: I'm trying to fetch my e-mails using IMAP on Android application. In LogCat, there are a lot of things going on; however, I know why I'm getting those errors. It basically tells me "the application may be doing too much work on its main thread". Hence, I was trying to formulate an asynchronous task for my class responsible for SSLSockets etc. My interface is like when users hit Login button, they should be able to see their emails under the login button. After that, I'm getting that error in the title. I think I should be able to do something else wrapping around my Login function, but I couldn't find it. There might be some other errors in my code. Please don't worry about it. I just want to fix that asynchronous issue right now I'd like you to call your attention to the login function a bit below. After the first code, there will be my LoginClient.java code liable for opening connection, communicating with server etc. Here is my code: (MainActivity.java) (Cropped a bit) package com.theOwl.android_imap; import java.util.ArrayList; import android.app.Activity; ------------- public class MainActivity extends Activity implements OnItemSelectedListener{ EditText servername, port, username, password; Spinner dropdown; Button blogin; public static ArrayList&lt;String&gt; listModel = new ArrayList&lt;String&gt;(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); servername = (EditText) findViewById(R.id.servername); port = (EditText) findViewById(R.id.port); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); dropdown = (Spinner) findViewById(R.id.sp1); blogin = (Button) findViewById(R.id.button); populateListView(); // clickListView(); String[] items = new String[] { "jacky@gmail.com" }; ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;( MainActivity.this, android.R.layout.simple_spinner_item, items); adapter.setDro…
type: AnsweredQuestion
has title: The application may be doing too much work on its main thread, (Android)
score: 0
tagged with: java
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42337964
has answer: http://stackoverflow.com/a/26893449
type: Question

http://stackoverflow.com/q/26935159
tagged with: java
upvote count: 1
type: Question
has body: I am following Neo4j doc here: http://neo4j.com/docs/milestone/server-unmanaged-extensions.html to Unmanaged Extensions. I am not able to compile HelloWorld example given there. I am facing problem in creating jar file. In the doc, There is a tip for compiling: "You will need to include a dependency to JAX-RS API on your classpath when you compile", I am not sure how to include this dependency with jar command. I am not using Maven.
has answer: http://stackoverflow.com/a/26941157
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
has title: Including a dependency to JAX-RS API on classpath when compiling - Neo4j
accepted answer: http://stackoverflow.com/a/26941157
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/26963258
has body: Swing doesn't know how to deal with components that have transparent background colors, you can't use panel.setBackground(new Color(0, 0, 0, 0));, instead, simply use setOpaque and pass it false Also, this panel = new JPanel(false); is not a good idea, you want to leave double buffering on, otherwise you will end up with a bunch of flickering each time the UI is updated
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26963244
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42448468
type: QuestionComment
has text: @VighaneshGursale How can you say to do that when we don't even know what the code is? I can think of a couple other ways imsocool could be displaying the array.
comment on: http://stackoverflow.com/q/26954135
score: 0
type: Comment

http://stackoverflow.com/comment/42467229
score: 0
comment on: http://stackoverflow.com/q/26964729
type: Comment
type: QuestionComment
has text: Henri, you are correct. String[][] is a collection of 2d list of students and I need to convert it into hashset

http://stackoverflow.com/comment/42454161
type: QuestionComment
type: Comment
has text: @Anony-Mousse maybe you are right. But the question maybe can be in category: "if your question generally covers… software tools commonly used by programmers then you’re in the right place to ask your question!" But If my question is really out of topic I want to apologize about that.
score: 0
comment on: http://stackoverflow.com/q/26949249

http://stackoverflow.com/comment/42303466
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26871358
has text: @DanW Yes, didn't work either.

http://stackoverflow.com/q/26857445
has answer: http://stackoverflow.com/a/26858179
has answer: http://stackoverflow.com/a/26857883
type: AnsweredQuestion
tagged with: java
type: Question
has title: How to Auto-Save after a specific time interval (~120 seconds) when edit text focus changes
possible better answer: http://stackoverflow.com/a/26857883
has body: I have an app I am working on that focuses, on similar to a notepad app, for musicians. I would like to auto-save their text content every 2 minutes from an edit text box when they put the edit text in focus (touch the text box). I tried using a CountDownTimer, but I need help on looping this every 2 minutes for the edit text AND to kill it when the app's onPause() is called. new CountDownTimer(120000, 1000) { public void onTick(long millisUntilFinished) { //every 1000 millis mTextField.setText("seconds remaining: " + millisUntilFinished / 1000); } public void onFinish() { //when 2 minutes is reached mTextField.setText("done!"); } }.start(); I can restart it in onFinish() by calling start() again, but then it just gets stuck in an infinite loop in the background. Thanks!
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/26857730
accepted answer: http://stackoverflow.com/a/26857730

http://stackoverflow.com/q/26969188
possible better answer: http://stackoverflow.com/a/69034898
has answer: http://stackoverflow.com/a/69034898
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26970217
accepted answer: http://stackoverflow.com/a/26970217
score: 1
tagged with: java
tagged with: jfreechart
type: Question
answer count: 2
upvote count: 1
favorite count: 0
has body: I'm using JFreeChart to draw chart. I have XYSeries with points (0, 0), (1, 2), (2, 5) and I want to read Y value for let's say x=1.5. Is it possible to read value for points which are not in XYSeries? I couldn't find similar topic.
downvote count: 0
has title: How to get Y value from X value in JFreeChart

http://stackoverflow.com/a/26862853
answers question: http://stackoverflow.com/q/26860173
downvote count: 0
upvote count: 8
type: Answer
has body: The thread-safety issue with StringBuilder is that method calls on a StringBuilder do not synchronize. Consider the implementation of the StringBuilder.append(char) method: public StringBuilder append(boolean b) { super.append(b); return this; } // from the superclass public AbstractStringBuilder append(char c) { int newCount = count + 1; if (newCount > value.length) expandCapacity(newCount); value[count++] = c; return this; } Now suppose that you have two thread that are sharing a StringBuilder instance, and both attempt to append a character at the same time. Suppose that they both get to the value[count++] = c; statement at the same time, and that count is 1. Each one will write its character into the buffer at value[1], and then update count. Obviously only one character can be stored there ... so the other one will be lost. In addition, one of the increments to count will probably be lost. Worse than that, the value[count++] = c; statement can fail even if the two threads don't arrive there at the same time. The reason is that the Java memory model says that unless there is proper synchronization (or more precisely, a happens before relationship), it is not guaranteed that the second thread will see the memory updates made by the first thread. What actually happens depends on whether and when the first thread's updates are written through to main memory. Now lets look at StringBuffer.append(char): public synchronized StringBuffer append(char c) { super.append(c); // calls the "AbstractStringBuilder.append" method above. return this; } Here we see that the append method is synchronized. This means two things: Two threads cannot execute the superclass append method on the same StringBuffer object at the same time. Thus the first scenario cannot happen. The synchronize means that there is a happens before between successive calls to StringBuffer.append made by different threads. That means that the later thread is guaranteed to see the updates made in the earlier …
score: 8

http://stackoverflow.com/comment/42461881
type: QuestionComment
comment on: http://stackoverflow.com/q/26961886
score: 0
has text: are you forgetting to add `http://` at beginning of your URL?
type: Comment

http://stackoverflow.com/a/26850551
answers question: http://stackoverflow.com/q/26850261
has body: Your variable i is a reference to an Integer object. The Integer object is immutable. The variable i itself is a mutable reference to an object. It's not a constant variable, which must be final and be of primitive type or type String. EDIT: Finally found the references in the Java Language Specification. First, a switch label can include either an enum or a constant expression, per 14.11: The switch statement SwitchLabel: case ConstantExpression : case EnumConstantName : default : A constant expression is well defined in 15.28: Constant expressions. The relevant item in this case is: Simple names (§6.5.6.1) that refer to constant variables (§4.12.4). Constant variables are defined by 4.12.4: final variables A constant variable is a final variable of primitive type or type String that is initialized with a constant expression (§15.28).
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26850261

http://stackoverflow.com/comment/42463485
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26962727
has text: That's not a package, that's your root directory... I'd suggest using an IDE.

http://stackoverflow.com/comment/42360615
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26904609
has text: I am sorry for that. Can you please help me with the line of that code as suggested in your first comment. Please!
type: AnswerComment

http://stackoverflow.com/a/26941331
has comment: http://stackoverflow.com/comment/42426589
upvote count: 3
answers question: http://stackoverflow.com/q/26941305
type: Answer
has comment: http://stackoverflow.com/comment/42426870
has comment: http://stackoverflow.com/comment/42426504
has body: This isn't how you replace characters in a Java string. In Java, strings are immutable, so you can't set any given index. Additionally, the charAt() method doesn't and can't do anything to the string you're calling it on - all it does is just return the char at that position. Lastly, you probably shouldn't be using void - return the String with characters replaced at the end of the method, then use the return value. You can accomplish this by iterating through your initial string and build a new string, using the static isUpperCase method of the Character class: public static String formatPlainText(String sentence) { String replacedSentence = ""; for(int i = 0; i&lt; sentence.length() ; i++){ char ch = sentence.charAt(i); if (Character.isUpperCase(ch)) { replacedSentence += ch; } else { replacedSentence += " "; } } return replacedSentence; } If you're going to be using this frequently, or for particularly long Strings, you should absolutely use a StringBuilder instead - concatenating String on a character-by-character basis is deeply inefficient.
has comment: http://stackoverflow.com/comment/42426489
score: 3
has comment: http://stackoverflow.com/comment/42426516
has comment: http://stackoverflow.com/comment/42426616
has comment: http://stackoverflow.com/comment/42426777
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26941305

http://stackoverflow.com/q/26948110
upvote count: 3
tagged with: java
tagged with: image-processing
type: Question
has answer: http://stackoverflow.com/a/26974283
score: 3
answer count: 1
tagged with: iris-recognition
downvote count: 0
favorite count: 0
has body: I must use Gabor filter in my application, but I have no clue about this OpenCV methods parameters values. I want to encoding an iris. Start of Gabor filter and get features (I want to do this for 12 sets of Gabor parameters values). Then I want to count a Hamming dystans and do authentication. If someone could write here params ranges, or way how to calculate it in function: Imgproc.getGaborKernel(new Size(kSize[j], kSize[j]), sigma, theta, lambda, gamma); I'll be very grateful. Of course I have tried to assign it myself, but without success. Example file:
accepted answer: http://stackoverflow.com/a/26974283
has title: Gabor kernel parameters in OpenCV
tagged with: opencv
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/27058057

http://stackoverflow.com/q/26945700
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26945864
score: -5
accepted answer: http://stackoverflow.com/a/26946203
possible better answer: http://stackoverflow.com/a/26945755
has body: In java main method, what's the purpose of String args[] in public static void main (String args[]) ?
tagged with: java
duplicate of: http://stackoverflow.com/q/890966
downvote count: 7
type: Question
has comment: http://stackoverflow.com/comment/42433789
has comment: http://stackoverflow.com/comment/50825699
linked to: http://stackoverflow.com/q/7443459
has title: purpose of String args[] in main method in java
has comment: http://stackoverflow.com/comment/50825658
has answer: http://stackoverflow.com/a/26945824
has answer: http://stackoverflow.com/a/26946203
has comment: http://stackoverflow.com/comment/42433796
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/2108192
has answer: http://stackoverflow.com/a/26945755
has comment: http://stackoverflow.com/comment/42433840
answer count: 4
linked to: http://stackoverflow.com/q/890966

http://stackoverflow.com/comment/42370096
type: Comment
score: 1
has text: In jacoco you don't need instrumentation cause it has an agent which can be configured accordingly.
type: AnswerComment
comment on: http://stackoverflow.com/a/26909054

http://stackoverflow.com/comment/42427371
type: Comment
type: QuestionComment
has text: What file are you trying to access, anyway?
score: 0
comment on: http://stackoverflow.com/q/26939755

http://stackoverflow.com/a/26832870
type: Answer
score: 1
upvote count: 1
has body: You're reopening your file on every iteration through the loop, which means you are only ever reading the first object from the file. But you're reading the same object over and over again. As well as opening your file only once, you really should try to detect the end of file without throwing an exception. As a matter of style, exceptions should be thrown when things go wrong, not as a matter of course.
answers question: http://stackoverflow.com/q/26832777
downvote count: 0

http://stackoverflow.com/comment/42311381
score: 0
has text: i don't know if i'm doing the correct thing. i have file which contains questions which are in the following way : "Category Questions " then question then the options and then a blank line and then the correct answer
comment on: http://stackoverflow.com/q/26876594
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42324446
type: QuestionComment
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556)
comment on: http://stackoverflow.com/q/26884369
score: 1
type: Comment

http://stackoverflow.com/a/26959187
answers question: http://stackoverflow.com/q/26958350
has body: A primary key is specified with PRIMARY KEY, not PRIMARY. Also see When is SQLiteOpenHelper onCreate() / onUpgrade() run?; you need to delete you app's old data.
score: 0
type: Answer

http://stackoverflow.com/a/26989824
accepted answer of: http://stackoverflow.com/q/26989672
answers question: http://stackoverflow.com/q/26989672
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Do you mean suggestions? Check if CTRL + Space bar is what you are looking for as these stand for suggestion by default. Please notice Android Studio is based on IntelliJ IDEA, so all IDEA's shortcuts should work in AS as well.Read more about code assistance here. By the way - you can set your shortcuts to be Eclipse-like. You may also want to read FAQ for Eclipse Users Edit. Ah, I posted so many link already, I'll post one more: Default shortcuts keymap

http://stackoverflow.com/q/26980931
tagged with: java
tagged with: swing
type: Question
score: 3
has body: I recently learned that Java FX2 is replacing Swing for GUI development in Java. I was trying to check it out in the API documentation and could not find javafx listed like javax.swing is. I found that the documentation for JavaFX was created but seperate from Java 8 docs. My question is, why would Oracle do this? Is there something about the structure of the API that I do not understand?
has answer: http://stackoverflow.com/a/26981228
accepted answer: http://stackoverflow.com/a/26981228
has comment: http://stackoverflow.com/comment/42525223
has title: Why is JavaFX Documentation seperate from Java 8 Documentation?
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 3
linked to: http://stackoverflow.com/q/18441401
tagged with: java-8
tagged with: javafx-2
type: AnsweredQuestion

http://stackoverflow.com/q/26911385
has body: I have built a Java app that uses SQLite (sqlite-jdbc-3.8.7.jar) and have rolled everything into a jar file. Running the jar file on windows works as expected however, trying to run it on Ubuntu Server 14.04 has turned into quite a task! I put together a brand new virtual machine in VirtualBox for testing. I installed Java (sudo apt-get install default-jre) and have tried installing SQLite both from the repositories and by downloading the tar and compiling. SQLite installs just fine both ways as I can access it from terminal. I created a new sub-directory within my home directory and copied over my app jar file. From terminal, I then run the command: sudo java -jar .jar and I receive a java.lang.unsatisfiedlinkerror. See the attached image, what else must be done to get this working on Ubuntu? Any help would be appreciated!
tagged with: sqlite
downvote count: 0
score: 4
tagged with: ubuntu
has answer: http://stackoverflow.com/a/40036325
favorite count: 0
has title: java.lang.UnsatisfiedLinkError: org.sqlite.core.nativeDB.open()
has answer: http://stackoverflow.com/a/42091574
answer count: 4
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27679942
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26975881
upvote count: 4

http://stackoverflow.com/q/26952078
has comment: http://stackoverflow.com/comment/80479614
has comment: http://stackoverflow.com/comment/120399407
has answer: http://stackoverflow.com/a/69714356
has answer: http://stackoverflow.com/a/29965752
has answer: http://stackoverflow.com/a/44505080
has answer: http://stackoverflow.com/a/51295047
downvote count: 0
has answer: http://stackoverflow.com/a/44369152
has answer: http://stackoverflow.com/a/71859764
has answer: http://stackoverflow.com/a/48083468
has title: Intellij Cannot resolve symbol on import
has answer: http://stackoverflow.com/a/77781897
has answer: http://stackoverflow.com/a/32371640
has comment: http://stackoverflow.com/comment/42455858
has answer: http://stackoverflow.com/a/39045182
has answer: http://stackoverflow.com/a/48759330
favorite count: 0
has answer: http://stackoverflow.com/a/41070216
has answer: http://stackoverflow.com/a/67705955
has answer: http://stackoverflow.com/a/57275198
has answer: http://stackoverflow.com/a/48589571
linked to: http://stackoverflow.com/q/11632120
has answer: http://stackoverflow.com/a/51024504
has answer: http://stackoverflow.com/a/52988743
possible better answer: http://stackoverflow.com/a/27508764
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/59473695
has comment: http://stackoverflow.com/comment/42445075
accepted answer: http://stackoverflow.com/a/75318824
has answer: http://stackoverflow.com/a/68545270
has answer: http://stackoverflow.com/a/77722309
answer count: 35
has body: This problem happens intermittently for different libraries and different projects. When trying to import a library, the package will be recognized, but the class name can't be resolved. If on the import statement, I right-click -&gt; Goto -&gt; the package's declaration, I see all the decompiled classes displayed in the side pane -- Including the ones I need -- If I try to auto-complete the import statement, I notice the class I need is not featured in the dropdown. I tried invalidating caches already, doesn't work. I cannot find any class conflicts -- there is no other jar file in my classpath with the same package name. I am able to import this class into other projects. Please see screen shots: Anyone have a clue?
tagged with: java
has answer: http://stackoverflow.com/a/46992617
has answer: http://stackoverflow.com/a/63083698
score: 245
has answer: http://stackoverflow.com/a/43565960
has answer: http://stackoverflow.com/a/67589441
upvote count: 245
tagged with: classpath
tagged with: import
type: Question
has answer: http://stackoverflow.com/a/41601719
has answer: http://stackoverflow.com/a/70834434
has answer: http://stackoverflow.com/a/43723154
has answer: http://stackoverflow.com/a/59965358
has answer: http://stackoverflow.com/a/52379579
has answer: http://stackoverflow.com/a/78692986
has answer: http://stackoverflow.com/a/75318824
has answer: http://stackoverflow.com/a/54691902
tagged with: intellij-idea
has comment: http://stackoverflow.com/comment/124560036
has answer: http://stackoverflow.com/a/57893103
has answer: http://stackoverflow.com/a/32999210
has answer: http://stackoverflow.com/a/27508764

http://stackoverflow.com/q/26944174
has title: Load EMF model instance from XMI file
tagged with: java
type: Question
answer count: 2
has body: I know there are several QnA about this subject. I have tried lots of solution, I am always getting same error. My code structure is like: Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; Map&lt;String, Object&gt; m = reg.getExtensionToFactoryMap(); m.put("xmi", new XMIResourceFactoryImpl()); ResourceSet resSet = new ResourceSetImpl(); Resource resource = resSet.getResource(URI.createURI("model/List.xmi"), true); resource.load(Collections.EMPTY_MAP); EObject root = resource.getContents().get(0); Error: Exception in thread "main" org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'List' not found. (file:///C:/Users/2/My%20Repository/UNIT%20Research%20and%20Development/com.unitbilisim.research.transformation/model/List.xmi, 6, 40) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278) at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406) at com.unitbilisim.research.transformation.ConvertEcore2Graph.main(ConvertEcore2Graph.java:61) Caused by: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'List' not found. (file:///C:/Users/2/My%20Repository/UNIT%20Research%20and%20Development/com.unitbilisim.research.transformation/model/List.xmi, 6, 40) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2625) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2458) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1335) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504) at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026) at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:77) at org.eclipse.…
downvote count: 0
has answer: http://stackoverflow.com/a/26972606
tagged with: ecore
has answer: http://stackoverflow.com/a/58104654
favorite count: 0
tagged with: model
upvote count: 2
type: UnansweredQuestion
tagged with: xmi
tagged with: emf
linked to: http://stackoverflow.com/q/2543987
score: 2

http://stackoverflow.com/a/26852383
accepted answer of: http://stackoverflow.com/q/26851488
has comment: http://stackoverflow.com/comment/42306177
type: Answer
answers question: http://stackoverflow.com/q/26851488
has body: From the error message, my guess is you are using (knowingly or not) one of the regex functions, such as any method in Pattern, String.matches(), String.replaceAll() or similar to check if a name matches the pattern passed as parameter. As a result, your pattern must follow Regular Expression syntax, in which "any name starting with mur" should be expressed as mur.* (note the dot), not mur*. If you pass the asterisk * as the only character, it results in an invalid Regular Expression, hence the error. The error message java.util.regex.PatternSyntaxException: Dangling meta character '*' near index 0 clearly sugegsts we are dealing with a Regular Expression and that the offending asterisk is the firs character in the string (index 0). So, if the above is true, you either have to pass the query in regex syntax, or change the way you match names to the pattern to match the syntax you want to use.
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42372695
comment on: http://stackoverflow.com/q/26911421
has text: Please post the stack trace and figure out which line the error is coming from.
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/a/26866777
has comment: http://stackoverflow.com/comment/42297218
has comment: http://stackoverflow.com/comment/42293501
has body: Recent versions of poi-ooxml require you to use at least java 6. The method in question was only added since java 6. Consider upgrading your java version. From the official docs, The OOXML jars require a stax implementation, but now that Apache POI requires Java 6, that is provided by the JRE and no additional stax jars are required. The OOXML jars used to require DOM4J, but the code has now been changed to use JAXP and no additional dom4j jars are required. *Emphasis mine. Since the question was edited, I'm specifying the build this method was added: java 1.6.0_18 So a minimum of this version must be used in OP's case.
score: 5
accepted answer of: http://stackoverflow.com/q/26866398
upvote count: 5
has comment: http://stackoverflow.com/comment/43918889
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26866398
has comment: http://stackoverflow.com/comment/42294578
type: Answer

http://stackoverflow.com/comment/42262380
comment on: http://stackoverflow.com/q/26849775
score: 0
has text: You are essentially trying to do this `ICollection<ICollection<int>> collection1 = new List<List<int>>()` which doesn't work in C#.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26908212
has body: Nope as transformers added and existing from 1.5
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26908066

http://stackoverflow.com/comment/42483816
type: QuestionComment
type: Comment
has text: You should probably do this somewhere else. You can just make a BitMap[] of the size you want and store your images in there
comment on: http://stackoverflow.com/q/26974313
score: 0

http://stackoverflow.com/q/26858993
has title: Error parsing data org.json.JSONException: End of input at character 0 of - LoginActivity
has body: I am developing an android application which requires user to login, when i run the LoginActivity it gives me a json parser error, i think my php code is fine but i need another pair of eyes to help me find the bug in my code, thanks Login Activity public class LoginActivity extends Activity { Button btnLogin; EditText inputMobile; EditText inputCountry; private static String KEY_SUCCESS = "success"; private static String KEY_UID = "uid"; private static String KEY_NAME = "name"; private static String KEY_MOBILE = "mobile"; private static String KEY_COUNTRY = "country"; private static String KEY_CREATED_AT = "created_at"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); inputMobile = (EditText) findViewById(R.id.phone); inputCountry = (EditText) findViewById(R.id.country); btnLogin = (Button) findViewById(R.id.login); btnLogin.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if ((!inputMobile.getText().toString().equals("")) &amp;&amp; (!inputCountry.getText().toString().equals(""))) { NetAsync(view); } else if ((!inputMobile.getText().toString().equals(""))) { Toast.makeText(getApplicationContext(), "Mobile field empty", Toast.LENGTH_SHORT).show(); } else if ((!!inputCountry.getText().toString().equals(""))) { Toast.makeText(getApplicationContext(), "Country field empty", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Mobile and Country field are empty", Toast.LENGTH_SHORT).show(); } } }); } /** * Async Task to check whether internet connection is working. **/ private class NetCheck extends AsyncTask&lt;String, String, Boolean&gt; { private ProgressDialog nDialog; @Override protected void onPreExecute() { super.onPreExecute(); nDialog = new ProgressDialog(LoginActivity.this); nDialog.setTitle("Checking Network"); nDialog.setMessage("Loading.."); nDialog.setIndeterminate(false); nDialog.setCancelable(true)…
score: 0
has comment: http://stackoverflow.com/comment/42279338
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/42279135
answer count: 0
has comment: http://stackoverflow.com/comment/42279126
type: UnansweredQuestion
tagged with: android
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/42446124
type: QuestionComment
has text: @Dici: What's the difference between `constant memory` and `constant time`?
score: 0
comment on: http://stackoverflow.com/q/26950004
type: Comment

http://stackoverflow.com/a/26967176
has body: From your post i assumed Location is the parent entity and User is the child entity. @Entity public class Location extends Model { @Id public Long id; // Following field won't persist in database, it will fetch the matching user object based on location_id in the user table. @OneToOne(mappedBy = "location") public User user; // ............. } The above mappedBy will be helpful when you fetch the location entity, at the same time you can fetch associated user entity. @Entity public class User extends Model { @OneToOne @JoinColumn(name = "location_id") // Above annotation will create a new column in the name of location_id in user table, will be the foreign key of id in the Location table. public Location location; // ............. } You can finally retrieve location name by user.location.name
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26963576

http://stackoverflow.com/q/26853775
tagged with: java
has comment: http://stackoverflow.com/comment/42288079
type: Question
has title: How do I get the item from each row of a listview?
tagged with: listview
has answer: http://stackoverflow.com/a/26853825
downvote count: 0
answer count: 1
has body: I wanna get the data in the clicked row in listView. This is my code , I want to access to "ID" Value in each row od list View. How do I get the item from each row of a listview? How do I get the item from each row of a listview? public class ActivityBookMark extends Activity { private SQLiteDatabase database; private ListView lv; private int ID; public ArrayAdapter&lt;String&gt; adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.book_mark); lv = (ListView) findViewById(R.id.BookMarkListView); Animation animation = AnimationUtils.loadAnimation(this, R.anim.translate); lv.setLayoutAnimation(new LayoutAnimationController(animation)); ArrayList&lt;String&gt; data = geData(); adapter = new ArrayAdapter&lt;String&gt;(this, R.layout.bookmark_item, R.id.TXTbookmarkItem, data); lv.setAdapter(adapter); } public ArrayList&lt;String&gt; geData() { // TODO Auto-generated method stub database = SQLiteDatabase.openDatabase(DBHelper.DB_PATH + DBHelper.DB_NAME, null, 0); Cursor localCursor = database .rawQuery( "SELECT `rowid`,* FROM `TABLE1` WHERE 1=1 AND `FAV` LIKE '%TRUE%' ORDER BY `rowid` ASC LIMIT 0, 50000", null); ArrayList&lt;String&gt; result = new ArrayList&lt;String&gt;(); int TITLE = localCursor.getColumnIndex("TITLE"); //↓ i want to access ID value onto OnClickUI method ID = localCursor.getColumnIndex("ID"); for (localCursor.moveToFirst(); !localCursor.isAfterLast(); localCursor .moveToNext()) { result.add(localCursor.getString(TITLE)); } return result; } public void OnClickUI(View v) { switch (v.getId()) { case R.id.DelFromBookMark: { //Code to retrive ID of each Row .... . Toast.makeText(ActivityBookMark.this,v.getViewTreeObserver()+"", Toast.LENGTH_SHORT).show(); database.execSQL("UPDATE TABLE1 SET FAV='FALSE' WHERE ID=" + ID + ""); List&lt;String&gt; newItems = geData(); adapter.clear(); adapter.addAll(newItems); adapter.notifyDataSetChanged(); Toast.makeText(getApplicationContext(), "از ل…
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
score: 1

http://stackoverflow.com/comment/42414271
type: AnswerComment
comment on: http://stackoverflow.com/a/26934909
score: 0
type: Comment
has text: the dependency:tree is a good suggestion to find the issue, but this is not a agood answer because doesn't give the user a solution to the problem... please post it as a comment

http://stackoverflow.com/comment/42476740
comment on: http://stackoverflow.com/a/26969098
score: 0
type: AnswerComment
type: Comment
has text: Okay i tried a few things and its working properly now thanks!

http://stackoverflow.com/q/26929352
has answer: http://stackoverflow.com/a/26929407
score: 0
tagged with: java
type: Question
tagged with: google-cloud-messaging
answer count: 1
has title: Main statement for sending information from HTTP server to GCM(Google cloud Messaging)
has body: This document (https://developer.android.com/google/gcm/http.html) describes the Google Cloud Messaging (GCM) HTTP connection server. Connection servers are the Google-provided servers that take messages from the 3rd-party application server and sending them to the device. Consider i prepared a HTTP server for GCM based on this document. how i can send information to GCM with PHP? should i use POST method? how? or it doesn't related to PHP?
type: UnansweredQuestion
tagged with: jetty
tagged with: web-services
tagged with: php

http://stackoverflow.com/comment/42373685
score: 0
comment on: http://stackoverflow.com/q/26912032
type: QuestionComment
type: Comment
has text: I have full source and WSDLs.

http://stackoverflow.com/a/26881712
has body: write a like : String str= new String("aaa,,bbb,,ccc,"); String[] strArray= str.split(","); for(int i=0;i&lt;strArray.length;i++) System.out.print(strArray[i]); or System.out.print(Arrays.toString(strArray)); output: [aaa, , bbb, , ccc]
answers question: http://stackoverflow.com/q/26881573
type: Answer
score: 0

http://stackoverflow.com/comment/51721371
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27976464
type: Comment
has text: what if instead of setters there is the constructor - the class is Immutable. Is that supposed to work?

http://stackoverflow.com/a/26901637
type: Answer
answers question: http://stackoverflow.com/q/26886394
has body: I resolved my problem by using substring .The code is while (rs.next()) { // Just get the value of the column, and add it to the list timeStr.add(rs.getString(1).substring(11, 16)); }
score: 0

http://stackoverflow.com/q/26968773
has answer: http://stackoverflow.com/a/26969222
has comment: http://stackoverflow.com/comment/42474684
has title: View database in Derby inside java project
has answer: http://stackoverflow.com/a/26969184
linked to: http://stackoverflow.com/q/11796697
score: 0
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26969184
type: Question
answer count: 2
has body: I use Derby as my java game desktop database. My database save inside the project folder. Now I am having troubled in viewing my tables. Is there a way to view database inside the eclipse project folder?
possible better answer: http://stackoverflow.com/a/26969222

http://stackoverflow.com/q/26911670
has title: Java, Polymorphism, Static Typing and the "QueryInterface" pattern
tagged with: oop
has answer: http://stackoverflow.com/a/26912127
tagged with: java
tagged with: api-design
downvote count: 0
type: UnansweredQuestion
score: 6
tagged with: polymorphism
favorite count: 0
has answer: http://stackoverflow.com/a/26911863
type: Question
answer count: 2
has body: I'm working on an API design, and there's something about Java and polymorphism that I didn't think about until now. If I create an API like this: interface FooFactory { public Foo getFoo(); } interface Foo { public void sayFoo(); } then the only thing that my FooFactory implementation can be relied upon to provide is a Foo implementation. If I decide to provide some enhanced methods, like this: interface EnhancedFoo extends Foo { public void patHeadAndRubBelly(); } class EnhancedFooImpl implements EnhancedFoo { ... implementation here ... } class EnhancedFooFactoryImpl implements FooFactory { @Override public EnhancedFoo getFoo() { return new EnhancedFooImpl(); } } and the only way my API clients can use the EnhancedFoo interface is if they obtain a Foo interface and try to cast it as the EnhancedFoo. I remember the way Microsoft handled COM in the IUnknown interface: HRESULT QueryInterface( [in] REFIID riid, [out] void **ppvObject ); The idea is that you pass in a GUID for the interface you want, if it succeeds, you get back a pointer that guarantees you can safely cast it to the interface you were looking for. I could do something similar in a typesafe way with Java: interface FooFactory { public &lt;T extends Foo&gt; T getFoo(Class&lt;T&gt; fooClass); } where I provide an implementation on request that either returns an instance of the desired subinterface, or returns null if none is available. My question, is: is the QueryInterface pattern reasonable? should I just use casting? or is the only right way to handle polymorphism in the API to restrict clients to strictly using the plain methods in question? (e.g. the methods in Foo in my example and not any EnhancedFoo methods) Clarification: The factory implementation isn't going to be known by client code. (Let's say it uses dependency injection or some service provider architecture like java's ServiceLoader or NetBeans Lookup.) So as a client, I don't know what's available. The factory might have access to sever…
upvote count: 6

http://stackoverflow.com/comment/42443313
score: 0
type: AnswerComment
type: Comment
has text: @Tom Or it would be 19 null(s).
comment on: http://stackoverflow.com/a/26950912

http://stackoverflow.com/q/26835108
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/42236095
tagged with: loops
has comment: http://stackoverflow.com/comment/42236184
has body: This is what I have so far. I have to write a for loop that prints the first 1000 perfect squares and also determines the time of execution. the timer is working but I don't really know how to show the 1000 perfect squares. public class WhileLoop { public static void main(String[] args) { long time_start, time_finish; time_start = time(); int i; for( i =0; i&lt; 1000; i++){ { System.out.print(""); } System.out.println(i); } time_finish = time(); System.out.println(time_finish - time_start + " milli seconds"); } public static long time(){ Calendar cal = Calendar.getInstance(); return cal.getTimeInMillis(); } }
has title: how do I create a program that uses a for loop to print the first 1000 perfect squares?
type: Question
downvote count: 5
has comment: http://stackoverflow.com/comment/42237281
tagged with: for-loop
has answer: http://stackoverflow.com/a/26835982
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42334253
has text: No point in looping until 1 < bottles and checking the condition every cycle, loop until it's 2 (including) and print the last line at the end.
type: Comment
comment on: http://stackoverflow.com/q/26890024
type: QuestionComment
score: 0

http://stackoverflow.com/q/26883914
has comment: http://stackoverflow.com/comment/42323247
downvote count: 0
favorite count: 0
has title: Java: Is it possible to compare a Class<?> object with a generic type parameter?
has comment: http://stackoverflow.com/comment/42323195
has answer: http://stackoverflow.com/a/26883985
tagged with: generics
has answer: http://stackoverflow.com/a/26884029
upvote count: 1
possible better answer: http://stackoverflow.com/a/26884029
type: AnsweredQuestion
score: 1
has body: Suppose i have a list of classes: List&lt;Class&lt;?&gt;&gt; classes; If i now take one of these classes, lets say... the second, and would want to know if it represents the String class, i would do the following: classes.get(1).equals(String.class) but how can i know if it represents a generic type... say T? class Foo&lt;T&gt; { void someMethod(){ System.out.println(classes.get(1).equals(T)); //error: T cannot be resolved to a variable } } i tried T.class (Class&lt;T&gt;)T But nothing works. I would really like to know if this is possible, and if it is, how to achieve it. Thanks for your attention! =)
tagged with: java
accepted answer: http://stackoverflow.com/a/26883985
type: Question
answer count: 2

http://stackoverflow.com/comment/42267506
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26851050
type: Comment
has text: I'm trying to pass the information from my H2 database to the Jasper Report from within my Java code.

http://stackoverflow.com/comment/42537556
type: Comment
has text: eh, I was hoping just to get a log.warning(exc, "Server startup failed") out the door is all. Nope, don't know subclasses ahead of time. this issue is more common in scala when people define fields in subclasses that call methods that could throw exceptions and that won't exist now in our log files. in java, I never hit that situation before.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26897379

http://stackoverflow.com/comment/42398721
type: Comment
comment on: http://stackoverflow.com/a/26925920
has text: It's not clear from the question whether order matters, you could be right.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42545828
comment on: http://stackoverflow.com/q/26913321
type: QuestionComment
score: 0
has text: Sounds like a database problem, not an application problem. Which version of h2db are you using?
type: Comment

http://stackoverflow.com/comment/42512437
comment on: http://stackoverflow.com/a/26989828
has text: So is it possible to handle this exception ??
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42325087
score: 0
type: QuestionComment
type: Comment
has text: Sorry I'm not quite sure what you mean by 'insert the byte values' I don't have much control over this section of the application, and should just be able to display the byte array as a string.
comment on: http://stackoverflow.com/q/26864427

http://stackoverflow.com/comment/42368983
type: Comment
type: QuestionComment
has text: If I understand your needs (not sure at all), your problem is not you need to build a distributed transactions manager. See the Oracle documentation [link] https://docs.oracle.com/cd/B28359_01/java.111/b31224/xadistra.htm
score: 0
comment on: http://stackoverflow.com/q/26906102

http://stackoverflow.com/q/26959710
type: AnsweredQuestion
score: 2
tagged with: enums
tagged with: java
tagged with: set
type: Question
has comment: http://stackoverflow.com/comment/42458786
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42458721
has answer: http://stackoverflow.com/a/26959800
accepted answer: http://stackoverflow.com/a/26959800
has comment: http://stackoverflow.com/comment/42459073
has title: Java Static Method to Parse Generic Enum Set from String
tagged with: generics
favorite count: 0
has body: I have a lot of classes which define some Enum whose values I want loaded from a user-entered String. So I find myself repeating the method: public final class Status { public static enum TYPE { Slow, Haste, Sleep, Stop, Stone, Invis, Rage, Conf, Bleed, Weak, Dumb, Sil, Rot, Lev, Clumsy }; public static Set&lt;Status.TYPE&gt; typesFromString(String string) { EnumSet&lt;Status.TYPE&gt; set = EnumSet.noneOf(Status.TYPE.class); if (string == null) return set; String[] elements = string.split(","); for (String element : elements) { element = element.trim(); for (TYPE type : EnumSet.allOf(Status.TYPE.class)) { if (type.toString().equalsIgnoreCase(element)) { set.add(type); break; } } } return set; } Which is to say, given a string which contains comma-separated elements which match the enum entries, return a set populated with each match. I'd love to make this generic, so I wouldn't have to maintain ten different copies of it, but I can't quite figure out how to make this generic while returning a set of enums. I think it would look vaguely like the following method: public static Set&lt;[Enum Class Specified in Argument]&gt; setFromString(String string, [Class of Enum to Work With]) { Set&lt;E extends Enum&lt;E&gt;&gt; set = EnumSet.noneOf([Class of Enum]); if (string == null) return set; for (String element : string.split(",")) { element = element.trim().toLowerCase(); for ([Element of Enum] type : EnumSet.allOf([Class of Enum])) { if (type.toString().trim().toLowerCase().equals(element)) set.add(type); } } } return set;
upvote count: 2
has comment: http://stackoverflow.com/comment/42459279

android-listview
tags question: http://stackoverflow.com/q/26858468
tags question: http://stackoverflow.com/q/26897173
tags question: http://stackoverflow.com/q/26916678
tags question: http://stackoverflow.com/q/26942269
tags question: http://stackoverflow.com/q/26899531
tags question: http://stackoverflow.com/q/26840701
tags question: http://stackoverflow.com/q/26886049
tags question: http://stackoverflow.com/q/26935450
tags question: http://stackoverflow.com/q/26945004
tags question: http://stackoverflow.com/q/26851689
tags question: http://stackoverflow.com/q/26945948
tags question: http://stackoverflow.com/q/26882183
tags question: http://stackoverflow.com/q/26946811
tag name: android-listview
type: Tag
tags question: http://stackoverflow.com/q/26849984
tags question: http://stackoverflow.com/q/26955056

http://stackoverflow.com/q/26917902
has comment: http://stackoverflow.com/comment/42385768
type: Question
has answer: http://stackoverflow.com/a/26933516
has comment: http://stackoverflow.com/comment/42384387
score: 0
has body: I have a problem with my code trying to generate @Autowired. The Class: public class ConsultasMDMWSClientImpl implements ConsultasMDMWSClient { @Autowired ConsultasMDMWSPortype consultasMDMWSPortype; public ConsultarClienteResponseMDM consultarClienteEnMdm(ConsultarClienteRequest clienteReq) { ConsultarClienteResponseMDM response = new ConsultarClienteResponseMDM(); ConsultasMDMWSService consultasMDMWSService = new ConsultasMDMWSService(); ConsultarClienteResponse clienteResp = null; clienteResp = consultasMDMWSPortype.consultarCliente(clienteReq); ListaCursoresMDM listaCursores; listaCursores = new ObjectMapper().readValue(clienteResp.getListaCursoresResponse(), ListaCursoresMDM.class); response.getListaCursoresResponse().add(listaCursores); return response; } } My applicationContext.xml &lt;context:annotation-config/&gt; &lt;context:component-scan base-package="pe.com.claro.eai.esb.ws.jira.mdm"/&gt; &lt;import resource="wsclients-config.xml"/&gt; My wsclients-config.xml &lt;bean id="consultasMDMWSPortype" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean"&gt; &lt;property name="serviceInterface" value="pe.com.claro.eai.consultasmdmws.ConsultasMDMWSPortype"/&gt; &lt;property name="wsdlDocumentUrl" value="http://limdeseaiv28.tim.com.pe:8909/ConsultasMDMWS/ConsultasMDMPortSB11?wsdl"/&gt; &lt;property name="namespaceUri" value="http://eai.claro.com.pe/ConsultasMDMWS"/&gt; &lt;property name="serviceName" value="ConsultasMDMWSService"/&gt; &lt;property name="portName" value="ConsultasMDMPortSB11"/&gt; &lt;property name="lookupServiceOnStartup" value="false"/&gt; &lt;/bean&gt; &lt;bean id="consultasMDMWSClient" class="pe.com.claro.eai.esb.ws.jira.mdm.service.client.ConsultasMDMWSClientImpl"&gt; &lt;property name="consultasMDMWSPortype" ref="consultasMDMWSPortype"/&gt; &lt;/bean&gt; I don't know what I'm doing wrong, I've mapped everything like an example of my work I'm new on Spring, my web method works without Spring. The error just appear when I use @…
tagged with: web-services
tagged with: spring
has answer: http://stackoverflow.com/a/26919253
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26925747
has answer: http://stackoverflow.com/a/27131873
answer count: 4
has title: Autowired Spring NullPointerException
tagged with: webservices-client

http://stackoverflow.com/a/26854326
type: Answer
answers question: http://stackoverflow.com/q/26854165
score: 0
has body: s = sc.nextInt(); // Gets your input // If you don't want to use ArrayList use following: int ss[] = new int[s]; // This uses arrays // If you want Lists, use the following: List&lt;int&gt; mylist = new ArrayList&lt;int&gt;(); // If you want a list of your integers (flexible) for (int i = 0; i&lt;s; i++){ int st = sc.nextInt(); mylist.add(new Integer(st)); // if you are interested only in Lists //ss[i] = sc.nextInt(); // if you are interested only in arrays } Does that suit you? You have the option to use either one (comment out accordingly :D)

http://stackoverflow.com/q/26963425
has body: I created this class with a method that receives an Spannable object and applies an style to whatever objects it receives. I am using it on a forum message parser which have these Spoiler tags, where the content is only shown when the mouse cursor is over it. For android, I wanted to make it work with clicks on the hidden area, and for that I wrote this: public static class TextRuleStartSpoiler extends TextRuleStart { protected TextRuleStartSpoiler() { super("spoiler"); } ArrayList&lt;Spannable&gt; hiddenSpannables = new ArrayList&lt;Spannable&gt;(); boolean hidden = false; @Override public void apply(Spannable s, TextView tv) { hiddenSpannables.add(s); s.setSpan(new BackgroundColorSpan(Color.parseColor("#0A1238")),0,s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); s.setSpan(getForegroundColorSpanShown(), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); s.setSpan(getClickableSpanLink(),0,s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); } public static TextRuleEnd getRuleEnd() { return new TextRuleEnd("spoiler"); } ForegroundColorSpan foregroundColorSpanHidden = null; private synchronized ForegroundColorSpan getForegroundColorSpanHidden() { if(foregroundColorSpanHidden == null) { foregroundColorSpanHidden = new ForegroundColorSpan(Color.parseColor("#0A1238")); } return foregroundColorSpanHidden; } ForegroundColorSpan foregroundColorSpanShown = null; private synchronized ForegroundColorSpan getForegroundColorSpanShown() { if(foregroundColorSpanShown == null) { foregroundColorSpanShown = new ForegroundColorSpan(Color.WHITE); } return foregroundColorSpanShown; } ClickableSpan clickableSpan = null; private synchronized ClickableSpan getClickableSpanLink() { if(clickableSpan == null) { clickableSpan = new ClickableSpan() { @Override public void onClick(View widget) { hidden = !hidden; if(hidden) { for(Spannable s : hiddenSpannables) { s.setSpan(getForegroundColorSpanHidden(), 0, s.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); s.removeSpan(getForegroundColorSpanShown()); } } e…
upvote count: 1
accepted answer: http://stackoverflow.com/a/26972305
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: How to toggle Spannable foreground color using ClickableSpan
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26972305
tagged with: android

http://stackoverflow.com/q/26990712
score: 5
has answer: http://stackoverflow.com/a/27058674
has answer: http://stackoverflow.com/a/27153838
has answer: http://stackoverflow.com/a/27055367
tagged with: java
has answer: http://stackoverflow.com/a/27055739
has body: i have a class which reads the list available in particular location, the following is my code, import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class ExceptionInFileHandling { @SuppressWarnings({ "rawtypes", "unchecked" }) public static void GetDirectory(String a_Path, List a_files, List a_folders) throws IOException { try { File l_Directory = new File(a_Path); File[] l_files = l_Directory.listFiles(); for (int c = 0; c &lt; l_files.length; c++) { if (l_files[c].isDirectory()) { a_folders.add(l_files[c].getName()); } else { a_files.add(l_files[c].getName()); } } } catch (Exception ex){ ex.printStackTrace(); } } @SuppressWarnings("rawtypes") public static void main(String args[]) throws IOException { String filesLocation = "asdfasdf/sdfsdf/"; List l_Files = new ArrayList(), l_Folders = new ArrayList(); GetDirectory(filesLocation, l_Files, l_Folders); System.out.println("Files"); System.out.println("---------------------------"); for (Object file : l_Files) { System.out.println(file); } System.out.println("Done"); } } in this the file path can be passed as argument and that should be taken up based on the OS, filePath.replaceAll("\\\\|/", "\\" + System.getProperty("file.separator")) is this correct?
has answer: http://stackoverflow.com/a/27095111
has answer: http://stackoverflow.com/a/26991131
linked to: http://stackoverflow.com/q/3548775
favorite count: 0
has answer: http://stackoverflow.com/a/27164764
has title: how to change the file path based on the OS
tagged with: linux
upvote count: 5
type: UnansweredQuestion
tagged with: windows
answer count: 10
has answer: http://stackoverflow.com/a/27061501
has answer: http://stackoverflow.com/a/27141747
downvote count: 0
linked to: http://stackoverflow.com/q/13039645
has answer: http://stackoverflow.com/a/27177122
tagged with: file
type: Question

http://stackoverflow.com/q/26886703
type: Question
answer count: 2
upvote count: 19
favorite count: 0
has body: I use the new java.time implementation of Java 8 and wonder about the output of a UTC to CET time conversion result. ZonedDateTime utcTime = ZonedDateTime.of(2014, 7, 1, 8, 0, 0, 0, ZoneId.of("UTC")); ZonedDateTime cetTime = ZonedDateTime.ofInstant(utcTime.toInstant(), ZoneId.of("CET")); System.out.println("Summer-UTC-Time: " + utcTime); System.out.println("Summer-CET-Time: " + cetTime); System.out.println(); utcTime = ZonedDateTime.of(2014, 1, 1, 8, 0, 0, 0, ZoneId.of("UTC")); cetTime = ZonedDateTime.ofInstant(utcTime.toInstant(), ZoneId.of("CET")); System.out.println("Winter-UTC-Time: " + utcTime); System.out.println("Winter-CET-Time: " + cetTime); I expected that the CET time would always be +1 of the UTC time but instead I got: Summer-UTC-Time: 2014-07-01T08:00Z[UTC] Summer-CET-Time: 2014-07-01T10:00+02:00[CET] -&gt; +2 **Unexpected** Winter-UTC-Time: 2014-01-01T08:00Z[UTC] Winter-CET-Time: 2014-01-01T09:00+01:00[CET] -&gt; +1 Expected So apparently I have to deal with daylight saving time which I did not expect when using CET. Is the java.time CET in truth CEST? And if yes, what zone should I use if I need CET?
has answer: http://stackoverflow.com/a/27618073
accepted answer: http://stackoverflow.com/a/27618073
downvote count: 0
possible better answer: http://stackoverflow.com/a/26886942
has comment: http://stackoverflow.com/comment/42342525
has title: java.time: Does the CET time zone considers daylight saving time?
has answer: http://stackoverflow.com/a/26886942
score: 19
tagged with: java-8
has comment: http://stackoverflow.com/comment/43045623
type: AnsweredQuestion
tagged with: java
tagged with: java-time

http://stackoverflow.com/q/26939771
tagged with: arrays
has comment: http://stackoverflow.com/comment/42423751
has title: Some errors when working with arrays in Java
has answer: http://stackoverflow.com/a/26939828
score: 0
has comment: http://stackoverflow.com/comment/42423822
answer count: 3
linked to: http://stackoverflow.com/q/338206
has answer: http://stackoverflow.com/a/26939994
has answer: http://stackoverflow.com/a/26939814
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42423900
has comment: http://stackoverflow.com/comment/42423736
has comment: http://stackoverflow.com/comment/42423800
has body: I am trying to get this to work but I keep getting errors, primarily C:\Users\Carter\OneDrive\Documents\Programs\Assignment7\Assignment7.java:26: error: '.class' expected Quiz myQuiz = new Quiz(int count, String name); ^ C:\Users\Carter\OneDrive\Documents\Programs\Assignment7\Assignment7.java:26: error: ';' expected Quiz myQuiz = new Quiz(int count, String name); ^ C:\Users\Carter\OneDrive\Documents\Programs\Assignment7\Assignment7.java:26: error: not a statement Quiz myQuiz = new Quiz(int count, String name); ^ C:\Users\Carter\OneDrive\Documents\Programs\Assignment7\Assignment7.java:26: error: ';' expected Quiz myQuiz = new Quiz(int count, String name); ^ 4 errors Any help would be much appreciated! What I posted is just the driver program, I can also post the class definition if necessary! Thanks in advance! //Driver program import java.util.*; public class Assignment7 { public static void main (String[] args) { Quiz myQuiz = new Quiz(int count, String name); Scanner console = new Scanner (System.in); String choice; char command; // print the menu printMenu(); do { // ask a user to choose a command System.out.println("\nPlease enter a command or type ?"); choice = console.next().toLowerCase(); command = choice.charAt(0); switch (command) { case 'n': //asks and prints the quiz size and name of student System.out.println("n [Create a new Quiz]"); System.out.println("[Input the size of quizzes]: "); scores.length = console.nextInt(); System.out.print(scores.length); System.out.println("[Input the name of student]: "); name = console.nextString(); System.out.print(name); break; case 'a': // adds a score System.out.println("a [Add a score]: "); numAdd = console.nextInt(); System.out.print(numAdd); break; case 'd': // deletes a score System.out.println("d [Delete a score]: "); numDelete = console.nextInt(); System.out.print(numDelete); break; case 'p': //prints the information System.out.println("p [Print the information]: "); System.out.println(name); System.out.printl…
tagged with: java
type: Question

http://stackoverflow.com/comment/42489538
comment on: http://stackoverflow.com/q/26977403
type: QuestionComment
type: Comment
has text: How is an instance of an object created in Java?
score: 0

http://stackoverflow.com/comment/42368420
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26909176
has text: do you have a problem while scrolling using wheel ??
score: 0

http://stackoverflow.com/q/26835548
answer count: 2
has answer: http://stackoverflow.com/a/26836017
tagged with: sql
upvote count: 1
has comment: http://stackoverflow.com/comment/42237716
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has title: Hibernate Criteria / Oracle - Join - Return only if all associated data match conditions
downvote count: 0
score: 1
has body: I have the following (approximate) SQL Schema: brand model equipment brand_id model_id equipment_id brand_name model_name equipment_nickname equipment_brand_id equipment_model_id Then I have a N-N relation between a equipment and a equipment group, like so: equipment &lt;----&gt; equipment_equipment_group &lt;----&gt; equipment_group So, a equipment can belong to different groups and all the shebang. Thing is, the filtering conditions to this thing is kinda strange to me. I only will return any conditions if every equipment in the group fills up the conditions. For example: I can have 10 Brand X and 20 Brand Y equipments in on a group. On another group I only have 30 Brand Y equipments. If I filter my equipments by Brand Y, only the second group will be filtered, because every equipment in it meet my criteria. I am building this with Hibernate Criteria, but I would be more than happy to see the SQL for this too, no need to know Java on this one. So, is this doable ?
type: Question
has answer: http://stackoverflow.com/a/26836025
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42237581

http://stackoverflow.com/q/26927225
linked to: http://stackoverflow.com/q/6368704
has body: I am creating an email sending application in android phone using smtp. For that I included three jar file activation.jar, mail.jar and additionnal.jar. But when try to send the email, I get following exception. java.lang.NoClassDefFoundError: javax.activation.DataHandler so I am not able to figure out this issue. please Help me. Thanks
has comment: http://stackoverflow.com/comment/42402041
has comment: http://stackoverflow.com/comment/42403646
type: Question
has comment: http://stackoverflow.com/comment/42400557
duplicate of: http://stackoverflow.com/q/6368704
tagged with: smtp
has comment: http://stackoverflow.com/comment/42403590
has comment: http://stackoverflow.com/comment/42400617
tagged with: email
has comment: http://stackoverflow.com/comment/42403616
has comment: http://stackoverflow.com/comment/42403623
has title: Android sending emails java.lang.NoClassDefFoundError: javax.activation.DataHandler
has comment: http://stackoverflow.com/comment/42403752
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42402382
tagged with: android-intent
has comment: http://stackoverflow.com/comment/42401363
answer count: 0
score: 0
has comment: http://stackoverflow.com/comment/42401444
tagged with: java

http://stackoverflow.com/q/26848719
downvote count: 0
favorite count: 0
tagged with: eclipse-rcp
accepted answer: http://stackoverflow.com/a/26848871
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26848922
upvote count: 2
tagged with: java
tagged with: multithreading
type: Question
possible better answer: http://stackoverflow.com/a/26848922
has answer: http://stackoverflow.com/a/26848871
tagged with: eclipse
has body: I want to check if a Job has finished. Currently I do this: if ( traceJob.getState() != Job.WAITING &amp;&amp; traceJob.getState() != Job.RUNNING){ But I think there should be a better way to check. Anyone has any good idea ?
has title: Eclipse RCP: check if a job has finished
answer count: 2
score: 2
tagged with: user-interface

http://stackoverflow.com/comment/42452483
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26956562
has text: @Makara a static variable means a single variable for all instances of the class, so all PairScore objects would use this single variable.
type: AnswerComment

http://stackoverflow.com/q/26978069
has answer: http://stackoverflow.com/a/26993106
accepted answer: http://stackoverflow.com/a/26993106
type: Question
has comment: http://stackoverflow.com/comment/42491142
has body: I'm having some trouble with this. I'm trying to list some data about the queries that failed during an executeUpdate() and I have read that BatchUpdateException can be caught and then get the updateCount, that tell you which queries worked and which not, but when a query fails because a bad data conversion, it launches an SQLException and I can't catch the whole batch execution error. The data to make the queries is fetched from a XML without any kind of validations. Here's the code: try { pSt_insertCabecera.executeBatch(); } catch (BatchUpdateException buex){ int[] updateCounts = buex.getUpdateCounts(); for (int i = 0; i &lt; updateCounts.length; i++) { if (updateCounts[i] == Statement.EXECUTE_FAILED) { logger.error(nombreClase + "[ESB_P]: Ha fallado la inserción de la cabecera de pedidos: " + cabecerasAInsertar.get(i).toString()); throw new SQLException(); } } } The SQLException thrown besides the if it's because later on the code I catch it to perform a rollback. The StackTrace looks as this: com.microsoft.sqlserver.jdbc.SQLServerException: Error al convertir una cadena de caracteres en fecha y/u hora. at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatementBatch(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtBatchExecCmd.doExecute(Unknown Source) at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source) at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(Unknown Source) I'm using SQLServer 2012. If you need more code or information please ask. So much thanks…
answer count: 1
has comment: http://stackoverflow.com/comment/42499699
score: 4
tagged with: sql-server
has comment: http://stackoverflow.com/comment/42490806
tagged with: jdbc
upvote count: 4
has comment: http://stackoverflow.com/comment/42491202
has comment: http://stackoverflow.com/comment/42490788
favorite count: 0
downvote count: 0
has title: SQLException during executeBatch() when I'm handling BatchUpdateException
has comment: http://stackoverflow.com/comment/42490686
has comment: http://stackoverflow.com/comment/42494688
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42407677
has text: @Eran -- and what about custom objects?? objects of my custom class?
type: Comment
comment on: http://stackoverflow.com/a/26930253
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42242253
comment on: http://stackoverflow.com/q/26836648
has text: @BobSmitherson Update the Question itself when you have more information rather than post comments. Notice the "edit" link just below your Question, on the left (if using a web browser to view this). But don't change the nature of your Question.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42383877
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26917597
score: 1
has text: you need to move the return false outside the for loop

http://stackoverflow.com/comment/42421926
type: QuestionComment
comment on: http://stackoverflow.com/q/26938780
has text: tissue is the array passed in the method
score: 0
type: Comment

http://stackoverflow.com/q/26978656
has answer: http://stackoverflow.com/a/26979099
has comment: http://stackoverflow.com/comment/42493076
tagged with: file-io
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26979099
has body: So i'm studying for my upcoming java exam, and on the study guide one of the short answer questions pertains to when to use a Buffer and when not to. I did a pretty comprehensive search on the topic and nothing concrete came up, so I figured I would ask for my own benefit as well as others who may have a similar question. From what i've gathered, using a buffer is generally preferred as it is less resource expensive than reading from a disk byte-for-byte(which is how files are read from disk without a buffer). Now, my question is, when is it NOT preferred to use a buffer when handling files in java? My best guess would be if the file is extremely small, making the need for a buffer somewhat redundant, but i'm not entirely sure on this. Also, a quick rundown on what buffering actually is would be awesome(another short answer question). I've read that it is just a space in memory where the data being read/written is stored in large chunks, as apposed to directly on the disk. Is this a correct description? Perhaps too ambiguous? Clarification here would be awesome as well. Thanks :)
has comment: http://stackoverflow.com/comment/42493169
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42493208
has title: Understanding when to use a Buffer for handlings files in java and when NOT to
linked to: http://stackoverflow.com/q/15984789

http://stackoverflow.com/comment/42468202
type: Comment
has text: Actualy there were 2 problems. I did not post it above, but there was - and had to be - call to locMngr.requestLocationUpdates(). Originally I called it before initializing all the vars. Stupid ha? :-). But even after I fixed that - the problem did not go away. The second cause of unfinished initailization was an exception that happened during initialization of marker2. which lead me to another question: How do I vew contents of System.err in Eclipse?
type: AnswerComment
comment on: http://stackoverflow.com/a/26965015
score: 0

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/26889183
tags question: http://stackoverflow.com/q/26837293
tags question: http://stackoverflow.com/q/26896316
tags question: http://stackoverflow.com/q/26832437
tags question: http://stackoverflow.com/q/26977011
tags question: http://stackoverflow.com/q/26851941
tags question: http://stackoverflow.com/q/26963361
tags question: http://stackoverflow.com/q/26942208
tags question: http://stackoverflow.com/q/26862195
tags question: http://stackoverflow.com/q/26835985
tags question: http://stackoverflow.com/q/26873495
tags question: http://stackoverflow.com/q/26841972
tags question: http://stackoverflow.com/q/26849245
tags question: http://stackoverflow.com/q/26986783
tags question: http://stackoverflow.com/q/26945720
tags question: http://stackoverflow.com/q/26940295
tags question: http://stackoverflow.com/q/26957233
tags question: http://stackoverflow.com/q/26991136
tags question: http://stackoverflow.com/q/26915079
tags question: http://stackoverflow.com/q/26908282
tags question: http://stackoverflow.com/q/26897819
type: Tag
tags question: http://stackoverflow.com/q/26942160

http://stackoverflow.com/a/26955107
accepted answer of: http://stackoverflow.com/q/26954827
answers question: http://stackoverflow.com/q/26954827
type: AcceptedAnswer
downvote count: 0
has body: Just add this line to the void. ID=student_ID.getText().toString();
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/q/26865828
has title: How to test a method that calls different methods inside?
has body: I have a method to unit test called addSong(song,userId) in service class. I am calling three methods inside it from Dao class. I am using Easy mock to mock dao class. In the setup I first mock all the methods I am calling in addSong(song,userId), and then calling the service.addsong(song,userId) method fot test. But I am getting the following error: Java.lang.IllegalStateException: missing behavior definition for the preceding method call: MusicPlayerDao.addSong(song) Usage is: expect(a.foo()).andXXX() at org.easymock.internal.MockInvocationHandler.invoke(MockInvocationHandler.java:42) at org.easymock.internal.ObjectMethodsFilter.invoke(ObjectMethodsFilter.java:94) at org.easymock.internal.ClassProxyFactory$MockMethodInterceptor.intercept(ClassProxyFactory.java:97) at service.MusicPlayerDao$$EnhancerByCGLIB$$45bc3ca1.addSong(&lt;generated&gt;) at service.MusicPlayerServiceImpl.addSong(MusicPlayerServiceImpl.java:43) at AddSongTest.addSongs(AddSongTest.java:90) Here is my code: private void addSongSetup() throws SQLException{ this.album = new Album(); album.setAlbumName("album"); this.genre = new Genre(); genre.setGenreName("genre"); this.song = new Song("song",this.album,3,"artist","composer",this.genre); EasyMock.expect(this.dao.addSong(song)).andReturn(1).anyTimes(); EasyMock.expect(this.dao.addGenre(genre, 1)).andReturn(1).anyTimes(); EasyMock.expect(this.dao.addAlbum(album, 1)).andReturn(1).anyTimes(); EasyMock.expect(this.dao.userIdSongsMapping(1,1)).andReturn(1).anyTimes(); } @Test public void addSongs(){ this.album = new Album(); album.setAlbumName("album"); this.genre = new Genre(); genre.setGenreName("genre"); this.song = new Song("song",this.album,3,"artist","composer",this.genre); try { System.out.println(this.dao.addSong(song)); boolean status = this.service.addSong(song, 1); assertEquals(true,status); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } My addSong method in service class: public boolean addSong(Song song,…
score: 0
answer count: 2
tagged with: junit
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26872048
tagged with: java
has answer: http://stackoverflow.com/a/26866039
tagged with: easymock
has comment: http://stackoverflow.com/comment/42291065
tagged with: unit-testing
type: Question

http://stackoverflow.com/comment/42463877
type: AnswerComment
has text: oki,and me I got to part now! I shoud modify this code you find it soon as possible good luck
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26962504

http://stackoverflow.com/q/26894230
has comment: http://stackoverflow.com/comment/42342431
has comment: http://stackoverflow.com/comment/65402708
has comment: http://stackoverflow.com/comment/46622259
has comment: http://stackoverflow.com/comment/42343200
tagged with: tomcat
has comment: http://stackoverflow.com/comment/42364203
has comment: http://stackoverflow.com/comment/42342042
answer count: 0
type: UnansweredQuestion
has title: Eclipse and remote Tomcat 8 server
linked to: http://stackoverflow.com/q/17254839
has body: After some time of research I didn't find a complete answer to this. My scenario is as follow: 1 Windows client with Eclipse. 1 Debian server with Tomcat 8. The idea is to use the remote Tomcat server in the Windows machine to avoiding install the local Tomcat plugin on it, and deploy the projects directly to the remote server vía Eclipse. Is this possible? As the information I've read, I'm afraid that the local Tomcat server is mandatory in order to get access to de Java Servlets API (package javax.servlet.*). I have a project in Eclipse without any Tomcat (remote nor local) and this package is not available so can't compile. So, there is a way to achieve what I want? I'm a bit lost in this, so may I have some misleading concepts and simply this is not possible for some good reason :). Thank you in advance.
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42342050
type: Question
score: 0

http://stackoverflow.com/q/26954824
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42449449
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42449921
has title: EDITED: JSP not opening from servlet using a database
tagged with: servlets
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42449740
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42449534
has body: Im having a problem in opening my JSP from my servlet.. i am trying to use my database to output it in my jsp.. I have also a class named Item.java to put it on the HashMap and put it to session to be able to use it on my next JSP.. here is my JSP that im trying to open <%@page import="classes.Item"%> <%@page import="java.util.HashMap"%> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <% String User = null; HashMap<String,Item> currentInventory = null; if(session.getAttribute("username") == null) response.sendRedirect("Login.html"); else { User = (String) session.getAttribute("username"); if(session.getAttribute("currentInventory") != null) { currentInventory = (HashMap<String,Item>) session.getAttribute("currentInventory"); } } %> <%@include file="block/header.html"%> Inventory List Stock ID Name Price On Stock <% for(int i = 0; i < currentInventory.size(); i++) { %> <%= currentInventory.get(i).getStockID() %> <%= currentInventory.get(i).getItemName() %> <%= currentInventory.get(i).getUnitPrice() %> <%= currentInventory.get(i).getOnStock() %> <% } %> <%@include file="block/footer.html"%> and here is my code in my Servlet package servlets; import java.io.*; import java.sql.*; import java.util.HashMap; import classes.Item; import javax.servlet.http.*; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; @WebServlet("/ShowInventoryListServlet") public class ShowInventoryListServlet extends HttpServlet { private static final long serialVersionUID = 1L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HashMap<String,Item> currentInventory = new HashMap<String,Item>(); HttpSession session = request.getSession(); Connection conn = null; Statement stmt = null; ResultSet rs = null; response.setContentType("text/html"); PrintWriter out = response.getWriter(); String url = "jdbc:mysql://localhost:3306/inventory"; String user = "ro…

http://stackoverflow.com/a/26993692
score: 3
answers question: http://stackoverflow.com/q/26990618
has comment: http://stackoverflow.com/comment/42523177
downvote count: 0
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/42524561
has body: I suspect that your analysis is correct, and that could be seen as a bug in Java: once you call delete, it would be fair to expect the reference created by deleteOnExit to be be removed. However, we are at least warned (sort of). The Javadoc for deleteOnExit says: Once deletion has been requested, it is not possible to cancel the request. This method should therefore be used with care. So I guess calling delete after deleteOnExit would be considered careless. However, it seems to me that your question implies its own solution. You say: If I remove delete(), then I will have to wait until VM stops to get tempFiles deleted(which is a very rare case in Production Server). If the JVM is very rarely ended, then deleteOnExit will very rarely do you any good. Which suggests that the solution is to handle your own deletions, by having your application call delete when it is finished with a file, and note use deleteOnExit at all.

http://stackoverflow.com/q/26840220
has title: How do I sort String value taken from database (primary key) as integer in table?
answer count: 4
has answer: http://stackoverflow.com/a/26840645
type: AnsweredQuestion
tagged with: user-interface
tagged with: resultset
type: Question
linked to: http://stackoverflow.com/q/4379592
has answer: http://stackoverflow.com/a/26840476
possible better answer: http://stackoverflow.com/a/26840273
accepted answer: http://stackoverflow.com/a/26840645
has answer: http://stackoverflow.com/a/26840273
has answer: http://stackoverflow.com/a/26840769
score: 0
has body: I have taken value from my database and put it into resultset and display it in JTable,but I am facing some sorting problem which is my primary key e.g. A1,A2,A3....A10,A11.But in my JTable,that primary key column has been displayed incorrectly. A11 A10 A1 A2 A3 A4 A11 should be at the last.Is there anyway to solve this issue??
tagged with: java
tagged with: database
has comment: http://stackoverflow.com/comment/42245259
tagged with: jtable

http://stackoverflow.com/comment/42445350
comment on: http://stackoverflow.com/q/26952375
has text: Seems like you are adding an object, which has not been instantiated, to your Queue. Make sure that the object you are adding to the Queue is instantiated and has a valid reference. Also, you haven't given the full code here. Where is the Queue?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26839085
has comment: http://stackoverflow.com/comment/42244139
has comment: http://stackoverflow.com/comment/42243409
has title: Error during ant startting
score: 0
has comment: http://stackoverflow.com/comment/42242889
has comment: http://stackoverflow.com/comment/42243104
has body: I want to run ant as: $JAVA_HOME/bin/java -Xmx512m -Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl -classpath $TEST_HOME/implementation/lib/dbflux3.1.5.jar:$JAVA_HOME/lib/tools.jar:$CLASSPATH org.apache.tools.ant.Main -buildfile build.xml $* My CLASSPATH variable is echo $CLASSPATH /opt/Oracle/Middleware/modules/org.apache.ant_1.7.0/lib/ant.jar When I am starting ant.sh as ./ant.sh test I get error: The java class is not found: org/apache/tools/ant/launch/AntMain How can I fix it? Or where is I can read about it? I read JDK Development tools documenation, but didn't find answer for my issue. Thanks. Update. Thanks for help Suresh Sajja. The answer might be found on https://ant.apache.org/manual/running.html Running Ant via Java
has comment: http://stackoverflow.com/comment/42245955
tagged with: unix
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42243463
has comment: http://stackoverflow.com/comment/42244741
type: Question
tagged with: ant

http://stackoverflow.com/comment/42420029
type: Comment
score: 1
has text: `this.file = file` are you assigning uninitialized `file` to itself?
type: QuestionComment
comment on: http://stackoverflow.com/q/26937823

http://stackoverflow.com/a/26951012
answers question: http://stackoverflow.com/q/26950704
type: Answer
has body: According to this Java Icon tutorial only GIF, JPEG and PNG image formats are supported by ImageIcon. You might need to change the format of the image, or use the ImageIO class to load the imgae first instead.
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26950704

http://stackoverflow.com/comment/42243596
has text: I do call callable.call(), i just immediately .toString() it. At the top of the for loop, just before the switch. The runnable is there to keep that JavaFX UI thread from becoming unresponsive. And Pinger already implements Callable.
comment on: http://stackoverflow.com/a/26839495
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26956459
has answer: http://stackoverflow.com/a/26956602
tagged with: java
has body: I'm having a code in Java where two objects wait and notify each other when one finished processing. I'll keep my code simple with the following example and assuming there are no syntax error (I just want you to know the logic is more important here rather than the syntax). Assuming I have object A which is a thread having this pseudo code class A is Thread { run() { while(true) { wait(); // wait for signal from B // then do something if signal received B.signal(); // let B know that we're done and wait again } } } Then we have here B which is also a thread having this pseudo code class B is Thread { run() { while(true) { // Do something A.signal(); // Let A know to continue processing wait(); // Wait for signal from A before doing something again } } } So as you can see there's a cycle. The problem is I am having a dead-lock and the reason here is because when A is finished processing, it signals B to work before it waits.. But by the time B is notified, there are chances that A still haven't reached the wait() code and B is already calling A.signal() and leads to a dead lock. How do I properly solve this problem? The solution I have in mind is that when B is notified to work, I will let the thread of B sleep for a number of milliseconds but I don't think this is ever a good idea. Any help is appreciated, thanks in advance.
type: Question
has comment: http://stackoverflow.com/comment/42452412
has title: Java Threading Cyclic Notify() and Wait()
has comment: http://stackoverflow.com/comment/42452426
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42452507
has answer: http://stackoverflow.com/a/26956540
tagged with: monitor
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/26956507
has comment: http://stackoverflow.com/comment/42452355

http://stackoverflow.com/a/26835243
has comment: http://stackoverflow.com/comment/42236399
has body: Base on this snippet code from Program: Implement quick sort in java. private void exchangeNumbers(int i, int j) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } you are exchanging element in i index with element in j index , so it seems you forget to put value of temp to j index of arrvector if (i &lt;= j) { Vector&lt;Personne&gt; temp = new Vector&lt;Personne&gt;(); temp.add(arr.get(i)); arr.get(i).add(arr.get(j)); arr.add(temp.get(j)); &lt;--------forget this line i++; j--; } Note: Your Personne class does not have add method When a Java program is being compiled the compiler creates a list of all the identifiers in use. If it can't find what an identifier refers to (e.g., there is no declaration statement for a variable) it cannot complete the compilation. This is what the cannot find symbol error message is saying, it doesn't have enough information to piece together what the Java code wants to execute.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26835190

http://stackoverflow.com/comment/42362673
comment on: http://stackoverflow.com/a/26898570
score: 0
type: Comment
has text: Those changes in my struts.xml are a result of some expermentation. Apologies for making you and @RomanC run around with me not giving you guys proper data. I did not think of all the other stuff and the duplicate result definition to be relevant.
type: AnswerComment

http://stackoverflow.com/comment/42452504
type: Comment
has text: Oh! just find out I wasn't using .equals method. :)
comment on: http://stackoverflow.com/q/26956306
score: 0
type: QuestionComment

http://stackoverflow.com/a/27108545
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/26908854
type: Answer
has body: There are different types of configuration. Usually some sort of bootstrapping configuration, for example to connect to a database or service, is needed to be able to start the application. The J2EE way to specify database connection parameters is via a 'datasource' specified in your container's JNDI registry (Glassfish, JBoss, Websphere, ...). This datasource is then looked up by name in your persistence.xml. In non-J2EE applications it is more common to specify these in a Spring context or even a .properties file. In any case, you usually need something to connect your application to some sort of data store. After bootstrapping to a data store an option is to manage config values inside this datastore. For example if you have a database you can use a separate table (represented by e.g. a JPA Entity in your application) for configuration values. If you don't want/need this flexibility you can use simple .properties file for this instead. There is good support for .properties files in Java (ResourceBundle) and in frameworks like Spring. The vanilla ResourceBundle just loads the properties once, the Spring helper offers configurable caching and reloading (this helps with the performance aspect which you mentioned). Note: you can also use Properties backed by a data store instead of a file. Often both approaches coexist in an application. Values that never change within a deployed application (like the application name) can be read from a properties file. Values that might need to be changed by an application maintainer at runtime without redeployment (e.g. the session timeout interval) might better be kept in a reloadable .properties file or in a database. Values that can be changed by users of the application should be kept in the application's data store and usually have an in-application screen to edit them. So my advise is to separate your configuration settings into categories (e.g. bootstrap, deployment, runtime and application) and select an appropriate mechan…
upvote count: 5

http://stackoverflow.com/comment/42490519
comment on: http://stackoverflow.com/a/26962242
score: 0
type: AnswerComment
type: Comment
has text: @Andy Only use reducers when you **need** to aggregate data. Otherwise, use map-only jobs, which are faster.

http://stackoverflow.com/q/26959343
tagged with: java
has answer: http://stackoverflow.com/a/43515115
has answer: http://stackoverflow.com/a/66332492
tagged with: jaxb
downvote count: 1
has answer: http://stackoverflow.com/a/34902666
possible better answer: http://stackoverflow.com/a/43083865
type: Question
has answer: http://stackoverflow.com/a/26959399
has answer: http://stackoverflow.com/a/55367343
upvote count: 116
has answer: http://stackoverflow.com/a/61112102
has answer: http://stackoverflow.com/a/26959543
has answer: http://stackoverflow.com/a/76071332
has answer: http://stackoverflow.com/a/36882937
has answer: http://stackoverflow.com/a/52291184
has title: Convert Java object to XML string
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/69288402
has answer: http://stackoverflow.com/a/38002217
has answer: http://stackoverflow.com/a/37002820
accepted answer: http://stackoverflow.com/a/26959543
score: 115
answer count: 15
type: AnsweredQuestion
has body: Yes, yes I know that lots of questions were asked about this topic. But I still cannot find the solution to my problem. I have a property annotated Java object. For example Customer, like in this example. And I want a String representation of it. Google reccomends using JAXB for such purposes. But in all examples created XML file is printed to file or console, like this: File file = new File("C:\\file.xml"); JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); Marshaller jaxbMarshaller = jaxbContext.createMarshaller(); // output pretty printed jaxbMarshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); jaxbMarshaller.marshal(customer, file); jaxbMarshaller.marshal(customer, System.out); But I have to use this object and send over network in XML format. So I want to get a String which represents XML. String xmlString = ... sendOverNetwork(xmlString); How can I do this?
has answer: http://stackoverflow.com/a/43083865
has answer: http://stackoverflow.com/a/41854322

http://stackoverflow.com/q/26934049
score: 3
has comment: http://stackoverflow.com/comment/42477815
tagged with: sorting
has body: I am trying to write a test to put under stress the behaviour of the following class. It is a comparator for a website, but for some reason the section of 'propertiesCreatedBy' is not working. This is a very strange issue as long as the rest of fields are working and can be sorted properly, but when trying to sort by this column the order seems to be random: import java.io.Serializable; import java.util.Comparator; import java.util.HashMap; import java.util.Map; public class CaseNoteDTOComparator implements Comparator, Serializable { /** * */ private static final long serialVersionUID = 1L; protected class CaseNoteDTOComparatorInternal implements Serializable { private String[] properties = null; boolean[] shouldReverse = null; public CaseNoteDTOComparatorInternal(String[] properties, boolean[] shouldReverse) { this.properties = properties; this.shouldReverse = shouldReverse; } public int compare(Object obj1, Object obj2) { int result = 0; for (int i = 0; i < properties.length; i++) { JavaBeanNamedPropertyComparator comparator = new JavaBeanNamedPropertyComparator(properties[i], shouldReverse[i]); result = comparator.compare(obj1, obj2); if(result != ComparatorConstants.EQUAL) { return result; } } //actually object are equals.... return ComparatorConstants.LESS_THAN; } public void setDescending(boolean descending) { for (int i = 0; i < shouldReverse.length; i++) { shouldReverse[i] = descending; } } } private static Map comparators = new HashMap(); //statically initialise comparators { final String[] propertiesEffectiveDate = { EFFECTIVE_DATE_NAME, CREATED_ON }; boolean[] shouldReverseEffectiveDate= {false, false}; comparators.put(EFFECTIVE_DATE_NAME, new CaseNoteDTOComparatorInternal(propertiesEffectiveDate, shouldReverseEffectiveDate)); final String[] propertiesId = { ID_NAME }; boolean[] shouldReverseId = {false}; comparators.put(ID_NAME, new CaseNoteDTOComparatorInternal( propertiesId, shouldReverseId)); final String[] propertiesType = { TYPE_NAME, ID_NAME }; boo…
tagged with: tdd
tagged with: comparator
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33557091
has title: Comparator not sorting properly
upvote count: 3
tagged with: java
tagged with: unit-testing
type: Question

http://stackoverflow.com/a/26935858
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26918374
has comment: http://stackoverflow.com/comment/48489718
accepted answer of: http://stackoverflow.com/q/26918374
type: Answer
downvote count: 0
has body: To serve static files like images, html, or javascript application needs to have file serving enabled. You can do it by editing ibm-web-ext.xml file in the WEB-INF folder, and ensuring that enable-file-serving is set to true.
score: 1
has comment: http://stackoverflow.com/comment/48494271
upvote count: 1

cassandra
tags question: http://stackoverflow.com/q/26908159
type: Tag
tag name: cassandra
tags question: http://stackoverflow.com/q/26904467
tags question: http://stackoverflow.com/q/26852413
tags question: http://stackoverflow.com/q/26969148
tags question: http://stackoverflow.com/q/26856235

http://stackoverflow.com/comment/42241059
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26837740
score: 1
has text: @St.Antario Yes... it also writes the buffered data when it's closed or flushed. The default buffer size is several kilobytes, so you don't write enough to fill the buffer. Then you close the stream without giving the `BufferedWriter` a chance to write what it buffered.

http://stackoverflow.com/comment/42465713
type: QuestionComment
comment on: http://stackoverflow.com/q/26963865
score: 0
type: Comment
has text: You mean in the while loop?

http://stackoverflow.com/q/26983841
has title: Returning a string from a if-statement and for-loop
tagged with: for-loop
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/26983899
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42501660
tagged with: string
tagged with: return
has comment: http://stackoverflow.com/comment/42501696
has answer: http://stackoverflow.com/a/26983899
type: AnsweredQuestion
tagged with: java
type: Question
has body: I have the following code and instead of using the System.out.println() method, I need to instead return a string that includes stars and minuses in the same way that the code below does. Essentially, instead of just returning the "" at the end, I need the stars and minuses to be included in the actual return string itself! I am very new to Java and have no idea of how to do this. I would appreciate any advice. public static String starMinusLine(int stars, int minuses){ if(minuses ==1){ for (int j= 0; j&lt; stars; ++j){ System.out.print("*"); } for (int i = 0; i &lt; (minuses); ++i){ System.out.print("-"); } } if (minuses % 2 == 0){ for (int i = 0; i &lt; (minuses*0.5); ++i){ System.out.print("-"); } for (int j= 0; j&lt; stars; ++j){ System.out.print("*"); } for (int k=0; k &lt; (minuses*0.5); ++k){ System.out.print("-"); } } if (minuses % 2 == 1 &amp;&amp; minuses != 1){ for (int i = 0; i &lt; ((minuses*0.5)-0.5); ++i){ System.out.print("-"); } for (int j= 0; j&lt; stars; ++j){ System.out.print("*"); } for (int k=0; k &lt; ((minuses*0.5)); ++k){ System.out.print("-"); } } return ""; }

http://stackoverflow.com/comment/42464680
type: QuestionComment
comment on: http://stackoverflow.com/q/26963361
has text: It's blocked, it's waiting for the OS to wake it for I/O.
score: 1
type: Comment

http://stackoverflow.com/a/26870486
upvote count: 2
answers question: http://stackoverflow.com/q/26870444
type: Answer
has body: Comparable is a generic type, so when declaring that the type parameter V extends Comparator, the interface should be parameterized: public class Graph&lt;K, V extends Comparable&lt;V&gt;&gt; {
score: 2
has comment: http://stackoverflow.com/comment/42312928
downvote count: 0

http://stackoverflow.com/q/26960611
type: UnansweredQuestion
tagged with: android
answer count: 0
has comment: http://stackoverflow.com/comment/42459718
type: Question
tagged with: java
has title: Using Location Data in a Fragments using ViewPager
score: 0
tagged with: google-maps
has body: I've managed to get the Map to display correctly while still being able to use the ViewPager to make tabbed Swipe Views however now I would like to use location data and I'm stuck on how I'd go about doing it. Main Activity: package com.nathan.trackrun; //Import Libraries import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.ActionBar.TabListener; import android.app.FragmentTransaction; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.os.Bundle; //Create main class public class MainActivity extends FragmentActivity implements TabListener { //Declare ViewPager and ActionBar variables ViewPager viewPager; ActionBar actionBar; public static FragmentManager fragmentManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); fragmentManager = getSupportFragmentManager(); //Initialise ViewPager viewPager = (ViewPager) findViewById(R.id.pager); viewPager.setAdapter(new MyAdapter(getSupportFragmentManager())); //Listen for changes in screen viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int arg0) { // TODO Auto-generated method stub actionBar.setSelectedNavigationItem(arg0); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { // TODO Auto-generated method stub } @Override public void onPageScrollStateChanged(int arg0) { // TODO Auto-generated method stub } }); //Setup ActionBar (the bar that holds the Tabs on it) actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); //Create new tab called tabMap ActionBar.Tab tabMap = actionBar.newTab(); //Set tab text to 'Map' tabMap.setText("Map"); tabMap.setTabListener(this); //Create new tab called tabStats Actio…
has comment: http://stackoverflow.com/comment/42459555

http://stackoverflow.com/q/26869639
type: Question
has body: I have a Java web application with two servlets. One servlet is used to create a new user account, the other one is used to edit an existing user account (given its unique id). If servlet 1 is called ("/create-user"), it generates a new user account with a unique id and then issues a redirect to servlet 2: "/edit-user?uid=123". Servlet 2 then loads the data for the given user account. Now the special thing: All operations executed by the two servlets are performed in a kind of transaction. The transaction is started and finally committed by a servlet filter (pseudo code): public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Transaction t = Transaction.startTransaction(); try { chain.doFilter(request, response); } finally { t.commit(); } } The user account generated by servlet 1 is not visible to the outside world (and therefore servlet 2) until the transaction has been committed. This works perfect on 100+ installations based on various versions of Tomcat, WebSphere and JBoss. But there is one installation based on WebLogic 10.3.5.0 where we get an exception in servlet 2 because it is not able to find the user account. It seems as if the redirect instruction is sent back to the client and that the client sends it to the server BEFORE the original request is post-processed by the servlet filter. As a result, the new user account has not been committed yet and servlet 2 fails to load its data. I know that a redirect is implemented as "Location" HTTP response header. I also know that a web server may start to send back data to the client (starting with the response header) before the complete response has been generated on server side. But is a client allowed to follow the redirect before the original HTTP request has been processed completely? Is there no guarantee that the original request has been fully processed (including all servlet filters) before the redirect takes place?
tagged with: weblogic
has answer: http://stackoverflow.com/a/26897190
has comment: http://stackoverflow.com/comment/42300523
tagged with: servlets
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26897190
has comment: http://stackoverflow.com/comment/42319036
tagged with: http-redirect
upvote count: 1
tagged with: servlet-filters
type: AnsweredQuestion
has title: Is a redirect guaranteed to be delayed until all servlet filters have been processed?
score: 1
tagged with: java

http://stackoverflow.com/q/26941961
has body: I want to make a BlackJack game in Java. I'm using arrays to represent the cards. I'm having a problem of getting the card value and using the card values each player has to calculate the hand of each player. I have four classes, Card, Player, Dealer, and BlackJackGame - the driver. I'll post Card with its relevant Value method, Player, and BlackJackGame as dealer is pretty identical to Player. // Card.Java public class Card { private String suit, rank; private int value; public Card(String suit, String rank) { this.suit = suit; this.rank = rank; } public String getRank() { return rank; } public int Value() { if(rank.equals("2")) { value=2; } else if(rank.equals("3")) { value=3; } else if(rank.equals("4")) { value=4; } else if(rank.equals("5")) { value=5; } else if(rank.equals("6")) { value=6; } else if(rank.equals("7")) { value=7; } else if(rank.equals("8")) { value=8; } else if(rank.equals("9")) { value=9; } else if(rank.equals("10")) { value=10; } else if(rank.equals("A")) { value=11; } else if(rank.equals("Q")) { value=10; } else if(rank.equals("J")) { value=10; } else if(rank.equals("K")) { value=10; } return value; } public String toString() { return(rank + " of " + suit); } } // Player.java //Player.java public class Player { private int cValue; // [Card Value] I use this in a method to equal what deck[int] produces and try to use in the getValue method to no avail private int cCount; //Card count used to count how many 'cards' added Card[] deck= new Card[52]; // 52 card objects private int sum; A temporary int I add the cValues into and assign the value to cValue and return it public Player() { cCount=0; } public void addCard(Card a) //Everytime addCard is executed so I know how many cards are drawn at this point in the program everyone( 3 players and a dealer) has two cards { deck[cCount] = a; cCount++; } public int getcCount() //Get the card count from the void method { return cCount; } public Card getCard(int a) //Return the deck integer each player has {…
upvote count: 1
tagged with: arrays
answer count: 1
has title: Java Issue calculating value of player hands in BlackJack program
favorite count: 0
type: AnsweredQuestion
tagged with: blackjack
downvote count: 0
has answer: http://stackoverflow.com/a/26942076
accepted answer: http://stackoverflow.com/a/26942076
type: Question
score: 1
tagged with: java

http://stackoverflow.com/comment/42365291
score: 0
type: Comment
has text: almost there, just unsure how to out.println on the desired page. see comments for other answer below
comment on: http://stackoverflow.com/a/26907106
type: AnswerComment

http://stackoverflow.com/q/26931116
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42407444
upvote count: 1
has answer: http://stackoverflow.com/a/26931398
has answer: http://stackoverflow.com/a/26931331
tagged with: content-management-system
tagged with: javascript
accepted answer: http://stackoverflow.com/a/26931451
favorite count: 0
has title: How would I do an Angular JS ng-repeat on this JSON parse?
has body: How would I do an Angular JS ng-repeat on this JSON parse? .controller('TeamsCtrl', function($scope) { var text = '{"employees":[' + '{"name":"John Doe"},' + '{"name":"Sam Doe"},' + '{"name":"Jack Doe"}]}'; /* create scope property that will be recognized in view*/ $scope.tasks = JSON.parse(text); }); Here is the area I want populated with the new content: <ion-content class="has-header" ng-controller="TeamsCtrl"> {{employee.name}}
score: 0
downvote count: 1
has answer: http://stackoverflow.com/a/26931451
answer count: 4
tagged with: angularjs
possible better answer: http://stackoverflow.com/a/26931331
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26931356
tagged with: hybrid-mobile-app

http://stackoverflow.com/a/26970204
has comment: http://stackoverflow.com/comment/42481377
has body: You can set the widthHint attribute on the GridData instance. It's not a perfect solution, but maybe it helps: Label l = new Label(composite, SWT.WRAP); l.setText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut" + "labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo" + "duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum" + "dolor sit amet."); GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false, 3, 1); l.setLayoutData(gd); If you won't set the widthHint attribute to a static value, the only way I figured out is to override the setVisible method of the DialogPage. If you do so, you need to keep the label instance as member variable in the class. @Override public void setVisible(boolean visible) { int widthHint = getControl().getSize().x - 16; l.setText("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut" + "labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo" + "duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum" + "dolor sit amet."); ((GridData)l.getLayoutData()).widthHint = widthHint; getControl().pack(); super.setVisible(visible); } Hope that helps.
accepted answer of: http://stackoverflow.com/q/26968414
type: Answer
answers question: http://stackoverflow.com/q/26968414
has comment: http://stackoverflow.com/comment/42476603
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42480384

http://stackoverflow.com/a/26948379
has body: It's just that you allocating the space with new operator for your HelloWorldV3 object. It's always good to define state in constructor. By state i mean is, if you have say int field, you could initialize it to say default value that might be appropriate when you create your object (say to value 10)
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26948343

http://stackoverflow.com/comment/103934803
comment on: http://stackoverflow.com/a/26864791
has text: Add ignore
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/a/26967053
score: 1
has body: I won't post code for you, as this is homework, but your pos method should return the relative position of the char in the alphabet. So 'a' would return 0, 'b' returns 1, 'c' returns 2,... Myself, I'd change the char upper case or lower case, your choice, then subtract a number (or actually a char) from it, and return it. Then the pos(...) method will be used in the countletters(...) method inside of the for loop to determine which array index to increment. Note that you should discared your charAt() method since it serves no purpose other than to confuse.
accepted answer of: http://stackoverflow.com/q/26964744
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26964744
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42434059
type: AnswerComment
comment on: http://stackoverflow.com/a/26945771
score: 0
has text: Oh my bad, it should rather have been a varargs `doInBackground(String... params)`, I believe because the `AsyncTask` class itself which is the super type must be having a vararg argument in its `doInBackground`. Doesn't matter in my program even though I am passing a String array, because varargs are treated just like arrays I believe. Thank you, this solves my problem.
type: Comment

http://stackoverflow.com/comment/42427610
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26941730
has text: @ProgLearner you should comment the line coursePanel.add(en_course_btn); and add the line picLabel.add(en_course_btn); (see updated code)

http://stackoverflow.com/q/26951643
score: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42444071
has comment: http://stackoverflow.com/comment/42444732
has comment: http://stackoverflow.com/comment/42444094
type: Question
has body: I need to create a triangle of at least 5 rows. I know how to create the top and bottom but I can't figure out the middle part. I don't know how to find the algorithms to express the changes in spaces added to each subsequent row following the first. Can I get hints? This problem is from my teacher.
has comment: http://stackoverflow.com/comment/42444746
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/42444632
has answer: http://stackoverflow.com/a/26952344
has answer: http://stackoverflow.com/a/26951808
has comment: http://stackoverflow.com/comment/42444079
has title: Create Isoceles Triangle using asterisks and only while loops
tagged with: geometry

http://stackoverflow.com/q/26971541
type: UnansweredQuestion
has body: EditText lEditText; LinearLayout mLinearLayout = new LinearLayout(getApplicationContext()); mLinearLayout = (LinearLayout)findViewById(R.id.mylinearlayout); lEditText = new EditText(getApplicationContext()); lEditText .setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT)); lEditText.setId(8); lEditText.setHint("Text View"); lEditText.setEms(10); lEditText.setInputType(InputType.TYPE_CLASS_TEXT); lEditText.setWidth(200); // change width lEditText.setHeight(20); //chng hight lEditText.setPadding(50, 20, 20, 500); mLinearLayout.addView(lEditText); i have already made XML for this activity. this code showing me just edit text but i cant enter input in this.
tagged with: android
has title: unable to enter text in dynamically created edit text field in android
has answer: http://stackoverflow.com/a/26971744
has comment: http://stackoverflow.com/comment/42479196
tagged with: android-edittext
downvote count: 0
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/42459308
comment on: http://stackoverflow.com/q/26959666
has text: :D you are right thankss alot for your help
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26981256
answers question: http://stackoverflow.com/q/26981119
has comment: http://stackoverflow.com/comment/42496627
has body: You can easily achieve this using a Handler that runs a Runnable that calls itself again after some time. So, you can declare a Handler and a Runnable like so private Handler mHandler = new Handler(); private Runnable mRunnable = new Runnable() { @Override public void run() { mTextView.setText("wtv"); mHandler.postDelayed(this, 1000); } }; So, onCreate you clear the textview and start the runnable mTextView.setText(""); mHandler.postDelayed(mRunnable, 1000);
has comment: http://stackoverflow.com/comment/42496968
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26981119
type: Answer

http://stackoverflow.com/q/26933066
type: Question
has title: Java class Function doesnt work right
score: -2
has answer: http://stackoverflow.com/a/26933275
tagged with: class
downvote count: 2
has answer: http://stackoverflow.com/a/26933142
possible better answer: http://stackoverflow.com/a/26933147
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/42411194
has comment: http://stackoverflow.com/comment/42410964
upvote count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26933220
has answer: http://stackoverflow.com/a/26933185
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26933147
tagged with: java
accepted answer: http://stackoverflow.com/a/26933275
has body: I have some very crazy Problem with my java class. The code will explan it: This is my class: public class myclass { public int myint; public String mystring; public myclass() { myint = 0; mystring = "Test"; } public void setStringInt(String s) { s = String.valueOf(myint); } public void somefunc() { setStringInt(mystring); } } This is a Part of the MainActivity: //... public myclass thisismyclass; public String mysecondstring; //... thisismyclass = new myclass(); thisismyclass.myint = 5; thisismyclass.somefunc(); //... The Output of thisismyclass.mystring is "Test". Why doesn't the code set it to "5"? I tried something out. This works: //... thisismyclass.myint = 5; thisismyclass.setStringInt(thisismyclass.mystring); //... But why did the other code not work? mfg lolxdfly Edit: I am sorry.. I wrote it wrong.. I my code it was mystring!

http://stackoverflow.com/a/26985826
has body: Check this. An alternative to instanceof operator ArrayList arr=new ArrayList(); arr.add(new Traingle()); arr.add(new Rectangle()); arr.add(new Sphere()); for(Object obj:arr){ int value=0; switch (obj.getClass().getSimpleName()){ case "Rectangle": value=((Rectangle) obj).getPerimeter(); break; case "Traingle": value=((Traingle) obj).getArea(); break; case "Sphere": value=((Sphere) obj).getVolume(); break; default: break; } System.out.println("Object "+obj.getClass().getSimpleName()+":"+value); }
type: Answer
answers question: http://stackoverflow.com/q/26985120
score: 0

http://stackoverflow.com/q/26868469
answer count: 1
has body: I am trying to develop an Atlassian JIRA gadget, that will get values from .java files using the REST module. To manage this, I read the JIRA documentation (for REST, gadgets and many more) and took the examples. So I got i.a. following code: gadget.xml: ... <Content type="html" view="profile"> #requireResource("com.atlassian.jira.gadgets:common") #includeResources() RestHelloWorldService.java: package com.atlassian.jira.plugin.tutorial; import com.atlassian.jira.plugin.tutorial.*; import javax.ws.rs.*; import javax.ws.rs.core.*; @Path("/") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public class RestHelloWorldService { @GET @Path("users") public Response getUncompletedUsers() { return Response.ok(new User("Fred","Bloggs")).build(); } } And the User.java: package com.atlassian.jira.plugin.tutorial; import com.atlassian.jira.plugin.tutorial.*; import javax.xml.bind.annotation.*; @XmlRootElement public class User { @XmlElement private String firstName; @XmlElement private String lastName; // This private constructor isn't used by any code, but JAXB requires any // representation class to have a no-args constructor. private User() { } public User(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } } BUILD SUCCESS! But my gadget still shows nothing. And the data are at the URL location: Fred Bloggs What could be wrong? I am out of ideas...
type: AnsweredQuestion
tagged with: java
has title: JIRA gadget REST module wont give value back
tagged with: jira
type: Question
accepted answer: http://stackoverflow.com/a/26889355
has answer: http://stackoverflow.com/a/26889355
linked to: http://stackoverflow.com/q/6383846
score: 0
tagged with: rest

http://stackoverflow.com/a/26969614
type: Answer
has comment: http://stackoverflow.com/comment/42479897
has comment: http://stackoverflow.com/comment/42481255
downvote count: 1
has comment: http://stackoverflow.com/comment/42481587
has body: You can have 2 ArrayLists, one contains your strings, and the other can be populated by their double values. So you can do the work through looping instead of writing a million line of code. List&lt;String&gt; strings ... List&lt;Double&gt; doubles ... for (String s : strings) { doubles.add(Double.parseDouble(s)); } That way it's dynamic in population and size
answers question: http://stackoverflow.com/q/26929676
score: -1
upvote count: 0
has comment: http://stackoverflow.com/comment/42481376

http://stackoverflow.com/comment/42467412
score: 0
has text: what called onLocationChanged()? has something called onCreate() first?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26964857

http://stackoverflow.com/comment/42334271
score: 0
type: AnswerComment
type: Comment
has text: SPI as in https://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html. The frameworks were designed to (currently) work in three different ways: SPI, OSGi or manual configuration. If jboss has a custom service system that can be tacked on with configuration files, I would be happy to add those to the frameworks as well.
comment on: http://stackoverflow.com/a/26886702

http://stackoverflow.com/comment/42488298
type: QuestionComment
comment on: http://stackoverflow.com/q/26974516
has text: i can turn my question like this: how can i add a validator to check if the Double is in range of 0.0 to 1000.0, how can i do this with validator? ;)
score: 0
type: Comment

http://stackoverflow.com/comment/42304558
score: 0
type: Comment
has text: I tried this `(?<![ABC])` on these two strings: ABC and abc and both show match. I don't understand how..
comment on: http://stackoverflow.com/a/26833127
type: AnswerComment

http://stackoverflow.com/a/26919326
answers question: http://stackoverflow.com/q/26919058
upvote count: 1
score: 1
has body: As far as I can tell, you can't. I don't think it even makes sense. An attribute event is not a characters event, so you shouldn't be able to use asCharacters() on it successfully at all. You are meant to pick out the XMLEvent representing the start of the element of interest, use asStartElement() to get a view of it as a javax.xml.stream.events.StartElement, and examine its attributes via either StartElement.getAttributeByName() or StartElement.getAttributes().
downvote count: 0
type: Answer

http://stackoverflow.com/q/26954119
possible better answer: http://stackoverflow.com/a/26954378
type: Question
has answer: http://stackoverflow.com/a/26954378
duplicate of: http://stackoverflow.com/q/214741
linked to: http://stackoverflow.com/q/3700459
has body: I am trying to solve a problem which asks to find the smallest prime palindrome, which comes after a given number which means that if the input is 24, the output would be 101 as it is the smallest number after 24 which is both prime and a palindrome. Now my code works perfectly for small values but the moment I plug in something like 543212 as input, I end up with a StackOverFlowError on line 20, followed by multiple instances of StackOverFlowErrors on line 24. Here is my code : package nisarg; import java.util.Scanner; public class Chef_prime_palindromes { public static void main(String[] args) { Scanner input = new Scanner(System.in); long num = input.nextLong(); isPalindrome(num + 1); } public static boolean isPrime(long num) { long i; for (i = 2; i &lt; num; i++) { if (num % i == 0) { return false; } } return true; } public static void isPalindrome(long num) { String word = Long.toString(num); int i; for (i = 0; i &lt; word.length() / 2; i++) { if (word.charAt(i) != word.charAt(word.length() - i - 1)) { isPalindrome(num + 1); } } if (i == word.length() / 2) { if (isPrime(num)) { System.out.println(num); System.exit(0); } else { isPalindrome(num + 1); } } } }
has answer: http://stackoverflow.com/a/26955396
tagged with: stack-overflow
favorite count: 0
has answer: http://stackoverflow.com/a/26954274
linked to: http://stackoverflow.com/q/6020619
answer count: 3
accepted answer: http://stackoverflow.com/a/26954274
upvote count: 2
downvote count: 1
tagged with: recursion
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/214741
score: 1
tagged with: java
has title: StackOverFlowError in java program

http://stackoverflow.com/q/26856094
favorite count: 0
has body: I am trying to find a definitive answer to using Hamcrest matchers in non test code. I have done a bit of research, and have some contrasting quotes: Hamcrest on Wikipedia: Hamcrest is a framework that assists writing software tests in the Java programming language. [snip] These matchers have uses in unit testing frameworks such as JUnit 2 and jMock. Hamcrest on Github: Hamcrest is a library of matchers, which can be combined in to create flexible expressions of intent in tests. Hamcrest on Google Code: Note: Hamcrest it is not a testing library: it just happens that matchers are very useful for testing. Personally, I associate Matchers with tests, so I tend to avoid using them outside of tests. That said though, I can see no limitations which would prevent them being used outside of a test scope. Does this then come down to a personal preference?
possible better answer: http://stackoverflow.com/a/27280620
has title: Is it acceptable to use Hamcrest matchers in non test code
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26864194
score: 6
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/42274350
has answer: http://stackoverflow.com/a/27280620
has answer: http://stackoverflow.com/a/26864194
upvote count: 6
answer count: 2
tagged with: hamcrest
tagged with: junit

http://stackoverflow.com/comment/42446275
type: AnswerComment
comment on: http://stackoverflow.com/a/26952748
has text: And also yes, it is very common
type: Comment
score: 2

http://stackoverflow.com/comment/42455671
comment on: http://stackoverflow.com/a/26958384
score: 0
type: AnswerComment
type: Comment
has text: @IWasSoLost your question is unclear. You didn't say anything about returning any of these values.

http://stackoverflow.com/comment/42422405
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/26939111
has text: Was there a question associated with this?

http://stackoverflow.com/q/26870890
favorite count: 0
tagged with: defensive-copy
linked to: http://stackoverflow.com/q/18146319
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: selenium
possible better answer: http://stackoverflow.com/a/26871110
type: Question
answer count: 2
has title: Cloning "By": Defensive Programming with Selenium
upvote count: 1
accepted answer: http://stackoverflow.com/a/26874403
has body: So I'm writing a Panel Object API for a website I'm testing with Selenium, and since this one is likely to be used by many people outside of my control in the future, I thought I may as well make it defensive (as seen in Effective Java). However, I've hit a wall when it comes to returning a clone of By. I was expecting a method like arrayList has: By newBy = new By(oldBy); Doesn't exist as By is made statically. Further, I don't know of any way to get the information out of a By once the information is in there except for toString(). So I can write a parser for By.toString(), but that seems like a lot of effort for what the job is, and not very elegant to boot. Can anyone suggest a less cumbersome way of cloning a By locator in selenium?
has answer: http://stackoverflow.com/a/26874403
has answer: http://stackoverflow.com/a/26871110

http://stackoverflow.com/a/40302911
downvote count: 0
answers question: http://stackoverflow.com/q/26916598
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/113216490
score: 3
has body: Does your Spring application context file contains more than one propertyPlaceholder beans like below: &lt;context:property-placeholder ignore-resource-not-found="true" ignore-unresolvable="true" location="classpath*:/*.local.properties" /&gt; &lt;context:property-placeholder location="classpath:/config.properties" /&gt; If so, then property lookup for: props.isFPL will only take place for the first property file (.local.properties), if property not found, the default value (true) will take effect and the second property file (config.properties) is effectively ignored for this property.

http://stackoverflow.com/comment/54655956
type: Comment
has text: for clarification: R.raw.sound means your sound file sits in res/raw/sound.jpg . And this sound can be reached as R.raw.sound from android
comment on: http://stackoverflow.com/q/26931490
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42443329
score: 2
type: AnswerComment
has text: @qed: You could have two static factory methods with different names which both call to the same constructor.
comment on: http://stackoverflow.com/a/26951112
type: Comment

http://stackoverflow.com/comment/42507189
has text: `public abstract Person class` - what?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26987185
score: 1

http://stackoverflow.com/comment/42366048
has text: Why do you need the second format?
score: 0
comment on: http://stackoverflow.com/q/26907475
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42451875
type: QuestionComment
comment on: http://stackoverflow.com/q/26955733
has text: Eclipse, export-> executable jar file -> package libraries into generated jar -> finsih
score: 0
type: Comment

http://stackoverflow.com/q/26889764
tagged with: java
has comment: http://stackoverflow.com/comment/42333846
score: 0
has comment: http://stackoverflow.com/comment/42333710
has answer: http://stackoverflow.com/a/26891045
has answer: http://stackoverflow.com/a/26890320
has answer: http://stackoverflow.com/a/26890131
has title: I need to get the wordcount, charcount, and linecount:
has body: The result correctly gives the words, but not the characters or lines. How can I make the Scanner go back to the beginning of the file? Using three Scanners did not work. public static void main (String[] args) throws FileNotFoundException { int iCharCount = 0; int iWordCount = 0; int iLineCount = 0; Scanner scConsole = new Scanner(System.in); System.out.println("Input File:"); String sInputFile = scConsole.next(); File inputFile = new File(sInputFile); Scanner in = new Scanner(inputFile); //gets the number of words while(in.hasNext()) { String sInput = in.next(); iWordCount++; } System.out.println("Words: " + iWordCount); //gets the number of characters while(in.hasNext()) { char ch = in.next().charAt(0); iCharCount++; } System.out.println("Characters: " + iCharCount); //gets the number of lines while(in.hasNextLine()) { String sLine = in.nextLine(); iLineCount++; } System.out.println("Lines: " + iLineCount); scConsole.close(); in.close(); } So, when I input a text file containing the Sentence: "The cat is in the hat." The result is: Words: 6 Characters: 0 Lines: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26889930
has comment: http://stackoverflow.com/comment/42333869
answer count: 4
linked to: http://stackoverflow.com/q/2788080
linked to: http://stackoverflow.com/q/16027229
type: Question

http://stackoverflow.com/comment/42313682
score: 0
has text: Not to mention the fact that he said it was working, accepted an answer, then discovered that restarting his computer (effectively clearing out the caches in Eclipse) was the solution to his problem. This flow is illogical...
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26878127

http://stackoverflow.com/comment/42326879
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26885763
type: AnswerComment
has text: java version "1.8.0_25"

android-emulator
tags question: http://stackoverflow.com/q/26929713
type: Tag
tag name: android-emulator

http://stackoverflow.com/a/26949629
has comment: http://stackoverflow.com/comment/42441495
has comment: http://stackoverflow.com/comment/42441861
answers question: http://stackoverflow.com/q/26949611
has comment: http://stackoverflow.com/comment/42440738
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/44942404
has comment: http://stackoverflow.com/comment/42441697
upvote count: 5
has comment: http://stackoverflow.com/comment/42440972
type: Answer
has comment: http://stackoverflow.com/comment/42441777
has comment: http://stackoverflow.com/comment/42441543
downvote count: 0
has comment: http://stackoverflow.com/comment/42441609
score: 5
has comment: http://stackoverflow.com/comment/42440697
has body: Immediately off the bat I see that you're making Swing calls from within the SwingWorker's doInBackground, something which completely defeats the purpose of using a SwingWorker or background thread. Also, the call you're making, one that displays a modal dialog: waitingDialog.setVisible(true); // **** here **** MyCustomClass.run(); // **** not sure what this does or if this makes Swing calls or not. will pause all code flow below it until the dialog is no longer visible, as that is how modal dialogs function. This is what is blocking your SwingWorker. You must try to separate your code so that Swing calls are only made on the Swing event thread, and use the worker for only the background work. Instead Create your SwingWorker Execute your SwingWorker Then call setVisible(true) on your modal dialog In pseudocode: create modal dialog create SwingWorker Attach any PropertyChangeListeners to the SwingWorker (if needed) Execute the SwingWorker Display the modal dialog So, the first quick change I would make in your code above would be to remove waitingDialog.setVisible(true); from your SwingWorker doInBackground() method, and then call the waitingDialog.setVisible(true); method AFTER executing the SwingWorker, i.e., after backgroundThread.execute(); in particular. I know it seems counter-intuitive to call dispose on it seemingly before making it visible, but trust me, it will work better this way, since the dispose call will be blocked by the time it takes to run the background thread.
accepted answer of: http://stackoverflow.com/q/26949611
has comment: http://stackoverflow.com/comment/42440760
has comment: http://stackoverflow.com/comment/42441846

http://stackoverflow.com/comment/42258200
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26847286
has text: Thanks a million finally figured it out!
score: 0

http://stackoverflow.com/comment/42255458
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26846219
has text: This is the way to go
type: AnswerComment

http://stackoverflow.com/q/26866765
answer count: 2
has comment: http://stackoverflow.com/comment/42292769
score: 0
accepted answer: http://stackoverflow.com/a/26866873
linked to: http://stackoverflow.com/q/16871367
has title: converting a string to date in Java
has comment: http://stackoverflow.com/comment/42294012
has body: import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class TesterA { public static void main(String[] args) { SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy"); String dateInString = "7-Jun-2013"; try { Date date = formatter.parse(dateInString); System.out.println(date); System.out.println(formatter.format(date)); } catch (ParseException e) { e.printStackTrace(); } } } I was trying to run this sample code copy from a web, but it doesn't work. How should I change it? This is the error I got java.text.ParseException: Unparseable date: "7-Jun-2013" at java.text.DateFormat.parse(DateFormat.java:366) at TesterA.main(TesterA.java:14)
possible better answer: http://stackoverflow.com/a/26866843
has answer: http://stackoverflow.com/a/26866843
has comment: http://stackoverflow.com/comment/42293492
linked to: http://stackoverflow.com/q/999172
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42299687
tagged with: java
has answer: http://stackoverflow.com/a/26866873

http://stackoverflow.com/a/26922909
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42394160
answers question: http://stackoverflow.com/q/26922846
has comment: http://stackoverflow.com/comment/42393207
score: 0
accepted answer of: http://stackoverflow.com/q/26922846
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42394112
has body: Exceptions should be for exceptional circumstances. I suggest you use a Scanner and hasNextInt() to just continue when it isn't an int. That is make a Scanner like, Scanner input = new Scanner(System.in); and then something like this would work, do { System.out.print("Enter your ID#: "); if (!input.hasNextInt()) { System.out.printf("%s is not an int.%n", input.nextLine()); continue; } custid = input.nextInt(); System.out.print("Enter your Account Number#: "); custacctnum = input.nextInt(); if (!input.hasNextInt()) { System.out.printf("%s is not an int.%n", input.nextLine()); continue; } If you really want to use try-catch it should look something like, do { try { System.out.print("Enter your ID#: "); custid = Integer.parseInt(input.readLine()); System.out.print("Enter your Account Number#: "); custacctnum = Integer.parseInt(input.readLine()); //validate the choice for(int i=0; i&lt;people.length; i++) { if ((people[i].custid == custid) &amp;&amp; (people[i].custacctnum == custacctnum)) { match = true; System.out.println("Welcome " +people[i].firstname + " to JJ Dealership!"); for(int p=0; p&lt;cluster.length; p++) System.out.println("" + (p+1) + ": " +cluster[p].year+"," + cluster[p].make+ "," +cluster[p].model); System.out.println(people[i].firstname + ", what color car would you like?"); break; } } } catch (NumberFormatException nfe) { nfe.printStackTrace(); } } while (!(match));
has comment: http://stackoverflow.com/comment/42393312
has comment: http://stackoverflow.com/comment/42393197

http://stackoverflow.com/comment/42265828
type: QuestionComment
comment on: http://stackoverflow.com/q/26851689
has text: This isn't really how onItemClicked should be used. You should use onItemClicked in conjunction with your adapter to get the item at that position and use it's data that way.
score: 0
type: Comment

http://stackoverflow.com/q/26874776
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42307408
tagged with: java
has answer: http://stackoverflow.com/a/26874861
accepted answer: http://stackoverflow.com/a/26874845
tagged with: loops
possible better answer: http://stackoverflow.com/a/26874840
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/26874840
downvote count: 4
has comment: http://stackoverflow.com/comment/42307607
has title: Java: why is there a difference in memory usage between for- and while-loops?
has answer: http://stackoverflow.com/a/26874845
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/26874841
has body: I am reading an XML file and pushing its contents into a ByteArrayOutputStream as follows: static final MY_XML_FILE = new File("..."); byte[] buffer = new byte[(int) MY_XML_FILE.length()]; int bytesRead; ByteArrayOutputStream output = new ByteArrayOutputStream(); while ((bytesRead = fileInputStream.read(buffer)) != -1) output.write(buffer, 0, bytesRead); which works fine. I didn't like the scope of bytesRead to be visible outside the while-loop, so I changed it to a for-loop: for (int bytesRead = fileInputStream.read(buffer); bytesRead != -1; ) output.write(buffer, 0, bytesRead); But this throws the following error: java.lang.OutOfMemoryError: Requested array size exceeds VM limit at java.util.Arrays.copyOf(Arrays.java:3236) at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:113) at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:140) My question is this: should the two ways of looping not be identical? If not, then I would like to know how a for and while loop differ in memory usage in Java.
score: -3
upvote count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/42307457
has comment: http://stackoverflow.com/comment/42307441

http://stackoverflow.com/comment/42267373
comment on: http://stackoverflow.com/a/26852200
type: AnswerComment
type: Comment
score: 1
has text: Does SO have an ESP badge for figuring out what a question means even when it's poorly stated? If so, I nominate you for it.

http://stackoverflow.com/q/26894383
has body: I decided to make an application that uses a Navigation Drawer. I created the app. using the built-in Navigation Drawer Activity ( Android Studio ) just to make an idea of what it contains, then I launched it on my phone.It works smooth but, I want a new activity to show up when I press on an item from the Drawer Panel. How do I do that? This is the MainActivity.java import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.app.FragmentManager; import android.content.Context; import android.os.Build; import android.os.Bundle; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.support.v4.widget.DrawerLayout; import android.widget.ArrayAdapter; import android.widget.TextView; public class MainActivity extends Activity implements NavigationDrawerFragment.NavigationDrawerCallbacks { /** * Fragment managing the behaviors, interactions and presentation of the navigation drawer. */ private NavigationDrawerFragment mNavigationDrawerFragment; /** * Used to store the last screen title. For use in {@link #restoreActionBar()}. */ private CharSequence mTitle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mNavigationDrawerFragment = (NavigationDrawerFragment) getFragmentManager().findFragmentById(R.id.navigation_drawer); mTitle = getTitle(); // Set up the drawer. mNavigationDrawerFragment.setUp( R.id.navigation_drawer, (DrawerLayout) findViewById(R.id.drawer_layout)); } @Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.container, PlaceholderFragment.newInstance(position + 1)) .commit(); } public void onSectionAttached(int number) { sw…
type: Question
answer count: 2
tagged with: android
has title: Built-in Navigation Drawer Activity (on click event)
accepted answer: http://stackoverflow.com/a/26894926
has comment: http://stackoverflow.com/comment/42370792
tagged with: java
upvote count: 1
tagged with: drawer
tagged with: navigation
possible better answer: http://stackoverflow.com/a/26895304
has comment: http://stackoverflow.com/comment/42343709
has answer: http://stackoverflow.com/a/26895304
has answer: http://stackoverflow.com/a/26894926
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42371915
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42376013
has comment: http://stackoverflow.com/comment/42375310
favorite count: 0
has comment: http://stackoverflow.com/comment/42370592

http://stackoverflow.com/comment/42329240
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26887411
has text: Are you using the command 'java File.java' from the command prompt? does your File.java have a package declaration?

http://stackoverflow.com/q/26926316
upvote count: 1
favorite count: 0
has body: I have a main class and two sub class in java language.how can access xx in class Y?please help me ,I need it in my project. import class X,Y; public static void main(String[] args) { xx=new X; example=new Y; } public class Y{ change xx.value;//how can change it? }
has title: How can access a object in main class from another class in java?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42399181
has answer: http://stackoverflow.com/a/26926520
tagged with: java
has answer: http://stackoverflow.com/a/26926581
type: Question
score: -2
has answer: http://stackoverflow.com/a/26926590
answer count: 3
downvote count: 3

http://stackoverflow.com/q/26886966
type: Question
has comment: http://stackoverflow.com/comment/42328566
linked to: http://stackoverflow.com/q/5797688
tagged with: http://stackoverflow.com/tag/r
score: 0
answer count: 1
tagged with: web
has title: How can I send an R file through the web server using java?
has body: I have a Java web application running. Now, I have this R sample script: zz &lt;- file(outputTarget, "w") cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n") cat("One more line\n", file = zz) close(zz) When "outputTarget" = D://R-Stuff//dataOut.txt the file is created fine. Now, I need to send this file to my web server. The only thing that comes to my mind is to change "outputTarget" to http://myhost:8080/myapplication/mystrutsaction/dataOut.txt but I'm sure this will not work because Struts cannot handle this. What I need to do (in generic way, how can I handle a file saved to URL in Java Web application)?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26887656
accepted answer: http://stackoverflow.com/a/26887656
tagged with: java

http://stackoverflow.com/comment/42297793
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26866759
has text: @Durandal, I'd agree with you, however we are seeing more or less 'impossible' NPEs a few times a week and not all of them are as easy to diagnose as the one in question. For this reason, I'm trying to understand possible reasons for these NPEs and hoping to find counter-measures (maybe the VM can be forced to better verify references).

http://stackoverflow.com/comment/42362776
has text: @Darpan, Thanks to your comments. It give me some ideas. Thanks! The problem is solved.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26902338

http://stackoverflow.com/q/26989366
has answer: http://stackoverflow.com/a/26989581
answer count: 5
linked to: http://stackoverflow.com/q/573970
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/35604063
has title: Java - which objects are being garbage collected?
has answer: http://stackoverflow.com/a/26989419
tagged with: garbage-collection
has body: My application has a lot of garbage collection and I would like to analyze that. What I want to see is which objects are being garbage collected. I think that will give me idea where to look for optimization (adding cache or whatever). Is there an option to print detailed GC information, including how many objects from each class were garbage collected? I'm using the G1GC, if that's important. Thanks!
type: Question
has answer: http://stackoverflow.com/a/26989417
tagged with: java
accepted answer: http://stackoverflow.com/a/35604063
upvote count: 4
possible better answer: http://stackoverflow.com/a/26989417
tagged with: g1gc
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26991525

http://stackoverflow.com/comment/42472996
type: Comment
type: QuestionComment
has text: I want to connect my jTable with database i can insert the record into database using jTextfiled etc. but i have no idea that how save the data into database using jTable please help me if you can thanks
comment on: http://stackoverflow.com/q/26967055
score: 0

http://stackoverflow.com/comment/70802440
type: Comment
score: 0
type: AnswerComment
has text: @naXa Why you think so?
comment on: http://stackoverflow.com/a/26867119

http://stackoverflow.com/q/26947916
type: Question
tagged with: null
tagged with: java
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/31581028
type: UnansweredQuestion
tagged with: android
has title: Getting null from 'getLatitude' Maps Android Studio
has answer: http://stackoverflow.com/a/26948080
has body: I recently started using Android Studio, and I'm just starting with the basics. I tried to load in a google maps page, which is working fine. However, whenever I try to load in my location, i get a Null error: java.lang.NullPointerException at com.example.wakelicious.MYPROJECTNAME.MapsActivity.setUpMap(MapsActivity.java:71) Here is my MapsActivity: package com.example.wakelicious.MYPROJECTNAME; import com.example.wakelicious.MYPROJECTNAME.util.MyCurrentLocationListener; import com.example.wakelicious.MYPROJECTNAME.util.SystemUiHider; import android.content.Context; import android.provider.SyncStateContract; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import android.view.Window; import android.view.View; import android.view.WindowManager; import android.location.Criteria; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.widget.TextView; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.LocationSource; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.CameraPosition; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MapsActivity extends FragmentActivity { private static final boolean AUTO_HIDE = true; private static final int AUTO_HIDE_DELAY_MILLIS = 3000; private static final boolean TOGGLE_ON_CLICK = true; private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION; private SystemUiHider mSystemUiHider; private GoogleMap mMap; // Might be null if Google Play services APK is not available. private TextView latituteField; private TextView longitudeField; private LocationManager locationManager; private String provider; @Override protected void onCreate(Bundle savedInstanceState) { …
tagged with: maps

numbers
tags question: http://stackoverflow.com/q/26878117
tags question: http://stackoverflow.com/q/26948858
tags question: http://stackoverflow.com/q/26972588
tags question: http://stackoverflow.com/q/26902941
tags question: http://stackoverflow.com/q/26896630
tags question: http://stackoverflow.com/q/26851538
tags question: http://stackoverflow.com/q/26942396
tags question: http://stackoverflow.com/q/26944185
type: Tag
tag name: numbers

actionscript
tags question: http://stackoverflow.com/q/26845806
type: Tag
tag name: actionscript

http://stackoverflow.com/comment/46622259
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26894230
has text: I've read over the Internet that using Maven Tomcat this can be accomplished.
score: 0

http://stackoverflow.com/comment/42269157
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26852254
has text: Sorry, I will illustrate the expected output and the actual output in my post. One moment.
score: 0

constants
tags question: http://stackoverflow.com/q/26912785
type: Tag
tags question: http://stackoverflow.com/q/26862948
tag name: constants

http://stackoverflow.com/q/26943548
has comment: http://stackoverflow.com/comment/42430598
has comment: http://stackoverflow.com/comment/42430672
tagged with: algorithm
has body: I want to create a class that represents an infinite (2^32 can be considered as infinite) strip on which there are pseudo-random numbers. The interface should be very simple; the constructor should get an instance of Random; and there should be a method to get the random number for an index. Note that I don't want to store a huge lookup table and precalculate it; I want it to be done on the fly. public class InfiniteRandomStrip { public InfiniteRandomStrip(Random r) { ... } public int getNumber(int index) { // magic code here } } Note that the code should pass the following test: Random seed = new Random(123); Random seed2 = new Random(123); InfiniteRandomStrip strip = new InfiniteRandomStrip(seed); InfiniteRandomStrip strip2 = new InfiniteRandomStrip(seed2); int first = strip.getNumber(454); // consume the random if(strip.getNumber(5) == strip2.getNumber(5) ) System.out.println("TEST1 OK"); if(first == strip.getNumber(454) ) System.out.println("TEST2 OK"); I've had no luck finding any example or algorithm for such a random list case. If such a problem has no solution, I will be glad to hear an explanation why.
tagged with: java
possible better answer: http://stackoverflow.com/a/26944732
has comment: http://stackoverflow.com/comment/42430697
has answer: http://stackoverflow.com/a/26944732
has comment: http://stackoverflow.com/comment/42430241
tagged with: random
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42430615
has answer: http://stackoverflow.com/a/26943655
type: Question
accepted answer: http://stackoverflow.com/a/26943655
has title: pseudo-random for index on an infinite strip
score: 0
answer count: 2

http://stackoverflow.com/comment/61090020
type: Comment
has text: So is there no way to improve the resolution of the bufferedImage? Is there any update on ability to print or store in another object the bufferedImage for quality 3D nodes to print?
comment on: http://stackoverflow.com/a/26873570
type: AnswerComment
score: 0

http://stackoverflow.com/a/26926189
answers question: http://stackoverflow.com/q/26926098
has comment: http://stackoverflow.com/comment/42398664
has body: From b_erb: Use a ScheduledExecutorService: private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(yourRunnable, 0, 5, MINUTES); private final ScheduledExecutorService scheduler1 = Executors.newScheduledThreadPool(1); scheduler1.scheduleAtFixedRate(yourRunnable1, 0, 15, MINUTES); private final ScheduledExecutorService scheduler2 = Executors.newScheduledThreadPool(1); scheduler2.scheduleAtFixedRate(yourRunnable2, 0, 30, MINUTES);
score: 0
type: Answer

http://stackoverflow.com/q/26894245
has body: I'm trying to memorize design patterns as best as I can. I understood the best way is to see where design patterns being used in the Java API. Can someone provide me other Java API examples of the command pattern other than classics like Java Swing and the Runnable interface?
type: Question
linked to: http://stackoverflow.com/q/1673841
tagged with: command-pattern
has comment: http://stackoverflow.com/comment/42342131
score: 0
has title: Command pattern java API usage
answer count: 1
has answer: http://stackoverflow.com/a/26928394
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42342183
tagged with: java
tagged with: design-patterns

http://stackoverflow.com/a/26914651
type: Answer
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/26914623
has body: In order to define variables you must give them types, e.g.: OutpustStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("dec.dat"))); InputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream("enc.dat")));
downvote count: 0

http://stackoverflow.com/a/26985284
accepted answer of: http://stackoverflow.com/q/26938250
answers question: http://stackoverflow.com/q/26938250
score: 0
type: AcceptedAnswer
type: Answer
has body: This does not answer the question exactly as written, but is the final solution to my problem. I have refactored my code, which ultimately has led to some code reduction. I no longer map the JSON to a java object. After inspecting my code, I realized I do very little processing on the java object, before it is reseralied back into JSON and sent out of a Jersey REST service to the front end. So I am now simply directly returning the JSON string as a string instead of a java object to be serialized into JSON by Jersey. That being said, I still have no idea what the actual issue is (was). I would still be open to hearing others' thoughts on the exception. For now though, I have a better solution.

http://stackoverflow.com/a/26841769
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26841699
type: Answer
score: 1
upvote count: 1
has body: Replace Thread.currentThread().sleep(500); with for (Thread thread : threads) { thread.join(); } This will make main thread to wait until all the created threads get completed. Also you can refer wait until all threads finish their work in java
has comment: http://stackoverflow.com/comment/42247608
accepted answer of: http://stackoverflow.com/q/26841699

http://stackoverflow.com/comment/42275996
type: QuestionComment
comment on: http://stackoverflow.com/q/26856897
type: Comment
has text: @ollaollu Sure, answer added. Don't feel obligated to accept mine though; accept whichever answer you feel best answers the question. Ankur-singhal also has some excellent information which may help.
score: 0

http://stackoverflow.com/q/26871568
downvote count: 0
score: 1
tagged with: java
tagged with: jax-ws
tagged with: web-services
has answer: http://stackoverflow.com/a/26883102
accepted answer: http://stackoverflow.com/a/26883102
type: Question
has body: I'm building a small SOAP Web Service using JAXWS-RT; I have a simple class that looks like this: public class Task { public String name; public String context; public String project; public PriorityType priority; public Task(String name, String context, String project, PriorityType priority) { this.name = name; this.context = context; this.project = project; this.priority = priority; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } // ... etc (setters and getters) } and here's the method in my Web Service where I use this Task Class: @WebMethod() public Task addTask(String taskName, String taskContext, String taskProject, PriorityType taskPriority) { ToDoList taskList = new ToDoList(); // some ToDoList class taskList = // some method from which I get an existing To-Do List // ADDING a Task to my To-Do List Task task = new Task(taskName, taskContext, taskProject, taskPriority); taskList.addTask(task); // Returning the created task as a result of calling this method return task; } While compiling my code, I am getting this Exception output: Exception in thread "main" com.sun.xml.ws.spi.db.DatabindingException: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions La clase tiene dos propiedades con el mismo nombre "context" this problem is related to the following location: at public java.lang.String bigws.todows.Task.getContext() at bigws.todows.Task at public bigws.todows.Task bigws.todows.jaxws.AddTaskResponse._return at bigws.todows.jaxws.AddTaskResponse this problem is related to the following location: at public java.lang.String bigws.todows.Task.context at bigws.todows.Task at public bigws.todows.Task bigws.todows.jaxws.AddTaskResponse._return at bigws.todows.jaxws.AddTaskResponse La clase tiene dos propiedades con el mismo nombre "name" this problem is related to the following location: at public java.lang.String bigws.todows.Task.getName() at bigws.todows.Task at …
possible better answer: http://stackoverflow.com/a/26878345
answer count: 2
upvote count: 1
favorite count: 0
tagged with: soap
has title: JAXWS-RT: getting com.sun.xml.ws.spi.db.DatabindingException binding a simple class
has answer: http://stackoverflow.com/a/26878345
type: AnsweredQuestion

http://stackoverflow.com/q/26896065
has answer: http://stackoverflow.com/a/26896727
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42346926
accepted answer: http://stackoverflow.com/a/26896727
tagged with: swing
has body: I have around 10 sets of coordinates for 10 polygons that I need to draw on an image Label. This is what I have coded so far: But since I cannot call paintComponent separately , I am calling it while instantiating the JLabel and that leads to the problem. At the end , I am just getting the last Polygon drawn on the image because everytime the new jLabel is created. Can someone point out how can this be improved so that I could draw multiple polygons on the same JLabel. private void setMapImage() { Queries queries = new Queries(dbConnection, connection); List&lt;ArrayList&lt;Integer&gt;&gt; allGeo = queries.getBuilding(); for(int i = 0; i &lt; allGeo.size(); i++) { int[] xPoly = queries.separateCoordinates(allGeo.get(i),0); int[] yPoly = queries.separateCoordinates(allGeo.get(i),1); poly = new Polygon(xPoly, yPoly, xPoly.length); poly = new Polygon(xPoly, yPoly, xPoly.length); background=new JLabel(new ImageIcon("image.JPG"),SwingConstants.LEFT) { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.YELLOW); g.drawPolygon(poly); } @Override public Dimension getPreferredSize() { return new Dimension(820, 580); } }; } background.setVerticalAlignment(SwingConstants.TOP); frame.add(background); background.setLayout(new FlowLayout()); frame.setVisible(true); }
type: AnsweredQuestion
tagged with: java
type: Question
has title: Draw multiple polygons on a JLabel Java Swing

http://stackoverflow.com/comment/42338444
score: 2
comment on: http://stackoverflow.com/q/26891837
has text: @BheshGurung OP could also look into sanitizing with JSoup http://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42312301
score: 0
type: Comment
type: QuestionComment
has text: @kryger Thank you for looking at this. In production, the files are going to come from a different server. But in testing, I am just going to put them somewhere on the development machine and write code to import them into the application. **This question, right now, is about where to put them when they are imported into the app, and then how to find them programmatically.** I do very much appreciate resources for reading. I read all day long every day. But I am working on a deadline and I would really appreciate it if you would be kind enough to help me with a more specific answer.
comment on: http://stackoverflow.com/q/26876405

http://stackoverflow.com/q/26991839
type: Question
has comment: http://stackoverflow.com/comment/42532180
has answer: http://stackoverflow.com/a/27001806
has body: I try to filter all elements of type AddReport but when putting a breakpoint in the Predicate body, I see the code there is not executed. Is it lazy? I see all kind of sub-classes. Not just AddReport Iterable&lt;BaseClass&gt; filtered = Iterables.filter(myList, new Predicate&lt;BaseClass&gt;() { @Override public boolean apply(@Nullable BaseClass input) { AddReport addReport = (AddReport) input; return ((addReport != null) &amp;&amp; addReport.description.equals(messageBody)); } }); Collection&lt;BaseClass&gt; filtered2 = Collections2.filter(myList, new Predicate&lt;BaseClass&gt;() { @Override public boolean apply(@Nullable BaseClass input) { AddReport addReport = (AddReport) input; return ((addReport != null) &amp;&amp; addReport.description.equals(messageBody)); } });
score: 0
tagged with: filter
answer count: 1
has comment: http://stackoverflow.com/comment/42515958
has title: Are Iterables.filter and Collections2.filter lazy executed?
has comment: http://stackoverflow.com/comment/42514942
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42515348
tagged with: guava
tagged with: java
tagged with: collections

http://stackoverflow.com/q/26972364
has comment: http://stackoverflow.com/comment/42491974
has comment: http://stackoverflow.com/comment/42487557
score: 1
tagged with: java
has body: We need fonts in out GAE app for rendering charts. We draw the charts to bitmaps and we need the fonts both for the metrics to determine placement and the font itself to draw in the bitmap. GAE appears to have no concept of a font. Is there any Java library or something out there that provides this functionality on GAE? thanks - dave
type: Question
has comment: http://stackoverflow.com/comment/42481815
downvote count: 0
has comment: http://stackoverflow.com/comment/42486822
has title: How can we get fonts in the GAE system
has comment: http://stackoverflow.com/comment/42488577
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/42491049
favorite count: 0
answer count: 0
tagged with: fonts
type: UnansweredQuestion
upvote count: 1

apache-poi
tags question: http://stackoverflow.com/q/26986962
tags question: http://stackoverflow.com/q/26887269
tags question: http://stackoverflow.com/q/26964473
tags question: http://stackoverflow.com/q/26866398
type: Tag
tags question: http://stackoverflow.com/q/26885834
tags question: http://stackoverflow.com/q/26960729
tag name: apache-poi
tags question: http://stackoverflow.com/q/26841819
tags question: http://stackoverflow.com/q/26942297
tags question: http://stackoverflow.com/q/26927824
tags question: http://stackoverflow.com/q/26918280
tags question: http://stackoverflow.com/q/26833829
tags question: http://stackoverflow.com/q/26854838
tags question: http://stackoverflow.com/q/26881400
tags question: http://stackoverflow.com/q/26845867

http://stackoverflow.com/a/26850347
has comment: http://stackoverflow.com/comment/42263600
has comment: http://stackoverflow.com/comment/42263386
has body: You are showing a lot of misunderstandings with this one line if (a = char || b = char) I assume you mean to use the equal to operator, rather than the assignment operator == instead of = a and b (and c) are ints, as declared in main. So we know they will never be chars, unless you convert them to chars - but then they would always be chars. int and char are different types, and the 1 character could be either type - so trying to do it as you are just won't work. A google search for check if string is number returns Determine if a String is an Integer in Java, However, in this case @ElliottFrisch's answer is the method you probably want to use. Learning to look at the Documentation whenever you use a new Java class (like Scanner) is very valuable and can lead to a lot better understanding and knowledge of the classes you are using.
answers question: http://stackoverflow.com/q/26849787
score: 0
type: Answer

http://stackoverflow.com/a/26953027
has comment: http://stackoverflow.com/comment/126428210
type: Answer
score: 2
upvote count: 3
downvote count: 1
has comment: http://stackoverflow.com/comment/126426378
answers question: http://stackoverflow.com/q/26952783
has body: You can use FileChannel truncate: try { File file = new File("fileToTruncate"); FileChannel fileChannel = new FileOutputStream(file, true).getChannel(); fileChannel.truncate(fileChannel.size() - 1); //Removes last character fileChannel.close(); } catch (FileNotFoundException ex) { } catch (IOException ex) { }
has comment: http://stackoverflow.com/comment/42460373
has comment: http://stackoverflow.com/comment/126436137

http://stackoverflow.com/comment/42330703
type: Comment
has text: @Peter, the answer was given before I mentioned about database independence.
comment on: http://stackoverflow.com/a/26887207
score: 0
type: AnswerComment

http://stackoverflow.com/comment/134782172
type: AnswerComment
comment on: http://stackoverflow.com/a/31891805
has text: Still present the error for me with [IntelliJ IDEA 2023.1.2 (Ultimate Edition)]
type: Comment
score: 4

http://stackoverflow.com/q/26890878
type: UnansweredQuestion
has title: How distinguish from which test suite was junit test run in case the same tests are run more times?
tagged with: tycho
tagged with: java
type: Question
tagged with: automated-tests
score: 0
has answer: http://stackoverflow.com/a/26894028
answer count: 1
tagged with: junit
has body: I have JUnit main test suite. This suite contains many suites - for each testing configuration @RunWith(ProgressSuite.class) @SuiteClasses({ SimpleTest.class, AboutTest.class, CDH4_JDBC_TestSuite.class, CDH5_JDBC_TestSuite.class, CDH4_Metastore_TestSuite.class, CDH5_Metastore_TestSuite.class, CDH4_JDBC_Kerberos_TestSuite.class, CDH5_JDBC_Kerberos_TestSuite.class, CDH4_Metastore_Kerberos_TestSuite.class, CDH5_Metastore_Kerberos_TestSuite.class, }) public class TestSuite { } Suites for each testing configuration contains the same test cases, but contains different setUpClass() and tearDownClass() methods @RunWith(Suite.class) @SuiteClasses({ PerspectiveSwitchTest.class, NewFolderFromToolbarTest.class, RenameFolderFromToolbarTest.class, RenameFileFromToolbarTest.class, OpenFilePropertiesFromToolbarTest.class, OpenFolderPropertiesFromToolbarTest.class, DeleteFileFromToolbarTest.class, DeleteFolderFromToolbarTest.class, CopyPasteFolderFromToolbarTest.class, CopyPasteFileFromToolbarTest.class, CutPasteFolderFromToolbarTest.class, CutPasteFileFromToolbarTest.class, }) public class CDH4_JDBC_Kerberos_TestSuite { private static SWTWorkbenchBot bot = new SWTWorkbenchBot(); private static AddNewEcosystemNavigator addNewEcosystemNavigator; private static EcosystemConfigurationLoader ecosystemConfigurationLoader; private static EcosystemConfiguration ecosystemConfiguration; private static GenericNavigator genericNavigator; @BeforeClass public static void setUpClass() { bot = new SWTWorkbenchBot(); addNewEcosystemNavigator = new AddNewEcosystemNavigator(); ecosystemConfigurationLoader = new EcosystemConfigurationLoader(); genericNavigator = new GenericNavigator(); ecosystemConfiguration = ecosystemConfigurationLoader .getDefaultCDH4JDBCKerberosEcosystemConfiguration(); addNewEcosystemNavigator.addNewEcosystemManually(bot, ecosystemConfiguration); } @AfterClass public static void tearDownClass() { genericNavigator.closeDialogWindow(); addNewEcosystemNavigator.discardEcosystem(bot,…
tagged with: jenkins

http://stackoverflow.com/comment/42358394
has text: <beans xmlns="http://www.springframework.org/schema/beans"...... ...... ...... <jee:jndi-lookup id="webDS" jndi-name="jdbc/web"/> <jee:jndi-lookup id="webSecureDS" jndi-name="jdbc/secure"/> <jee:jndi-lookup id="webStorageDS" jndi-name="jdbc/storage"/> </beans>
score: 0
comment on: http://stackoverflow.com/q/26903186
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42405607
has text: @AbdiTem Whats your new Question?
comment on: http://stackoverflow.com/q/26929739
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26924219
favorite count: 0
tagged with: security
score: 0
has comment: http://stackoverflow.com/comment/42395763
has comment: http://stackoverflow.com/comment/42400123
tagged with: email
has comment: http://stackoverflow.com/comment/42395601
linked to: http://stackoverflow.com/q/12743846
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42401283
has title: Resolve the exception generated while sending email using javamail api from java swing
upvote count: 1
has answer: http://stackoverflow.com/a/27457834
downvote count: 1
has body: I have written a code for sending email from java swing using javamail api . Properties props = new Properties(); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.port", "587"); Session session = Session.getInstance(props,new javax.mail.Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password); } }); try { Message message = new MimeMessage(session); message.setFrom(new InternetAddress("melbino1992@gmail.com")); message.setRecipients(Message.RecipientType.TO,InternetAddress.parse("melbino1992@gmail.com")); message.setSubject("Testing Subject"); message.setText("Hello"); MimeBodyPart messageBodyPart; Multipart multipart = new MimeMultipart(); messageBodyPart = new MimeBodyPart(); multipart.addBodyPart(messageBodyPart); message.setContent(multipart); Transport.send(message); System.out.println("sent mail"); } catch (Exception e) { //System.out.println(e); e.printStackTrace(); } System.out.println("hello!!!!!!!!"); } But it shows an exception as javax.mail.MessagingException: Could not convert socket to TLS; The stack trace is as follows javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1907) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:666) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at workregistration.Send.main(Send.java:59) Caused by: javax…
has comment: http://stackoverflow.com/comment/42402152
has comment: http://stackoverflow.com/comment/42395581
tagged with: java
tagged with: ssl
has answer: http://stackoverflow.com/a/26924280
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42395416

http://stackoverflow.com/comment/42306759
has text: Not so. Fields, even private ones, can in general be reflectively modified. Security policy can affect that, but the compiler cannot make assumptions about runtime security policy.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/26874205
type: AnswerComment

http://stackoverflow.com/comment/42488897
score: 2
has text: Declare it at class level
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26977158

http://stackoverflow.com/a/26869273
answers question: http://stackoverflow.com/q/26868941
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: Use the replace method on the String object to do this. Since String is immutable it will return a new object instance with the replaced text. Example: String myString = "Congrats {{customer}}"; myString = myString.replace("{{customer}}","John"); System.out.println(myString); Output: Congrats John See also the String javadoc for many more useful utility methods.

http://stackoverflow.com/comment/42424730
type: Comment
has text: I needed to allow both `unchecked` and `nls` suppressions, so I used the `^(?!(unchecked)|(nls)).*$` pattern. Thank you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26933256

http://stackoverflow.com/a/26880656
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26880584
has body: Try This : Use a try catchfor Scanner otherwise it shows the error unreported exception java.io.FileNotFoundException; import java.io.*; import java.util.*; class Entry1 { static Scanner s ; public static void main( String[] args ) { int sum = 0; try { s = new Scanner (new File("patch.txt")); } catch(Exception e) { System.out.print(e); } while (s.hasNextLine()) { String [] str = s.nextLine().split("/r"); for (int i=0; i&lt;str.length; i++){ sum+=Integer.parseInt(str[i]); } } System.out.print(sum); s.close(); } }
has comment: http://stackoverflow.com/comment/42317923
downvote count: 0

http://stackoverflow.com/comment/42492052
type: Comment
has text: Thanks. I appreciate the help. As an iOS guy, I'm used to the Interface Builder, which kind of sucks, so I guess I wrongly assumed that XML building would also suck. I'll read up. Thanks again!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26978775

http://stackoverflow.com/q/26896100
answer count: 1
has comment: http://stackoverflow.com/comment/42345587
favorite count: 0
has comment: http://stackoverflow.com/comment/42345633
type: UnansweredQuestion
has body: I am running this on a mac and it compiles in the terminal but after i type in java Lab9 it doesn't do anything. Below is exactly what i put into the terminal Last login: Wed Nov 12 15:29:48 on ttys000 Roberts-MacBook-Pro-3:~ robertsemulka$ cd /Users/robertsemulka/Desktop Roberts-MacBook-Pro-3:Desktop robertsemulka$ javac Lab9.java Roberts-MacBook-Pro-3:Desktop robertsemulka$ java Lab9 //compiles but does not run import java.util.Scanner; import java.util.Random; public class Lab9 { public static void main(String[] args) { //Create arrays int[] lotteryNum = new int[5]; int[] userNum = new int[5]; //Create Scanner and Random objects Scanner keyboard = new Scanner(System.in); Random randomGenerator = new Random(); //Declare and initialize a variable to track correct digits int numCorrectDigits = 0; //TODO: Using a for-loop, generate 5 random numbers; store numbers in the lotteryNum array for(int i=0;i&lt;5;i++) { int randomInt = randomGenerator.nextInt(10); lotteryNum[i] = randomInt; } //TODO: Using a for-loop, prompt user for 5 digits; store digits in userNum array for(int i=0;i&lt;5;i++) { int UserInt = keyboard.nextInt(); userNum[i] = UserInt; } //TODO: Using a for-loop, compare lotteryNum array and userNum array; increment variable numCorrectDigits //each time you find a matching pair of corresponding numbers for(int i=0;i&lt;5;i++) { if(lotteryNum[i] == userNum[i]) numCorrectDigits++; } //TODO: Display the winning number and the user's number //Example: //The winning number is: 12771 //Your number is: 30781 System.out.print("The winning number is: "); for(int i=0; i&lt;5; i++) { System.out.println(lotteryNum[i]); } System.out.println(); System.out.print("Your number is: "); for(int i=0; i&lt;5; i++) { System.out.println(userNum[i]); } //Print a blank line System.out.println(); //TODO: Display the number of correct digits //Example: //Number of correct digits is: 2 //TODO: Complete the switch statement below to display results to the user switch(numCorrectDigits) …
has comment: http://stackoverflow.com/comment/42345604
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/42345628
type: Question
upvote count: 0
has title: This compiles but does not run..any idea why?
score: -3
has answer: http://stackoverflow.com/a/26896145

http://stackoverflow.com/q/26889120
score: 0
has body: In java is it possible to convert non-english characters into their english characters. For example, I want: Zdeborová --&gt; Zdeborova Krząkała --&gt; Krzakala Sr´amek --&gt; Sramek so on.. When i try the methods below String t1 = Normalizer.normalize("Krząkała", Normalizer.Form.NFD); String t2 = t1.replaceAll("[^\\p{ASCII}]", ""); String t3 = t2.replaceAll("\\p{M}", ""); OR String t4 = org.apache.commons.lang3.StringUtils.stripAccents("Krząkała"); They all give Krz?ka?a as a result? I can do this process in oracle sql simly saying : select REGEXP_REPLACE(replace(convert(trim(upper('Krząkała')), 'us7ascii'), '_', ' '), '[^A-Z ]', '') std from dual; and get KRZAKALA. I think in java it must also so simple???
has comment: http://stackoverflow.com/comment/42332445
has comment: http://stackoverflow.com/comment/42333359
has comment: http://stackoverflow.com/comment/42339731
has title: Is it possible to get metaphones for those non-english characters?
has comment: http://stackoverflow.com/comment/42336338
answer count: 0
linked to: http://stackoverflow.com/q/1008802
tagged with: metaphone
has comment: http://stackoverflow.com/comment/42333660
type: UnansweredQuestion
tagged with: java
tagged with: javascript
has comment: http://stackoverflow.com/comment/42333292
type: Question

http://stackoverflow.com/q/26901134
has body: I have this jar: /weekly/ /database.class /report.class /META-INF /MANIFEST.MF The MANIFEST.MF Manifest-Version: 1.0 Main-Class: weekly.report Class-Path: /root/java In this jar i used two external jar files, postgresql-9.1-901.jdbc4.jar, javax.mail.jar. I also put those into /root/java. but when i run it use java -jar weekly.jar It shows those two jars class can't find Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/internet/AddressException Caused by: java.lang.ClassNotFoundException: javax.mail.internet.AddressException at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) even i try to put those two jars to my $CLASSPATH /usr/java/jdk1.6.0_21/lib:/usr/java/jdk1.6.0_21/jre/lib It also shows same error result. I can successfully run it in my Mac, but when i try to remove it to my server CentOS system ,it shows those NoclassDefFounderror.
answer count: 1
accepted answer: http://stackoverflow.com/a/26901554
has title: Unable load jar from my jar: NoClassDefFoundError
type: AnsweredQuestion
score: 0
has answer: http://stackoverflow.com/a/26901554
type: Question
tagged with: java

http://stackoverflow.com/q/26854446
has answer: http://stackoverflow.com/a/26855180
score: 0
answer count: 1
type: UnansweredQuestion
has title: LibGDX dragging a texture
has body: I am experimenting with LibGDX and Java and I am wanting to have a texture move along the x axis according to the users finger position if their finger is touching another texture. Below is my code, which works but only when moving your finger to the right game.batch.begin(); game.batch.draw(userCar, carCord.x, carCord.y); game.batch.draw(touchBound, touchCord.x, touchCord.y); game.batch.end(); if (Gdx.input.isTouched()) { Vector3 touchPos = new Vector3(); Rectangle textureBounds=new Rectangle(touchCord.x,touchCord.y,touchCord.width,touchCord.height); touchPos.set(Gdx.input.getX(), Gdx.input.getY(), 0); camera.unproject(touchPos); if(textureBounds.contains(touchPos.x,touchPos.y) { carCord.x = touchPos.x; } }
tagged with: java
type: Question
tagged with: game-physics
tagged with: libgdx

http://stackoverflow.com/comment/42378991
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26914833
score: 0
has text: I can just do something like /walmart/x/code/* ?

http://stackoverflow.com/comment/42248915
comment on: http://stackoverflow.com/q/26842078
score: 0
type: Comment
type: QuestionComment
has text: are you still facing problem? no any answer helped?

http://stackoverflow.com/q/26838110
tagged with: java
has comment: http://stackoverflow.com/comment/42241238
has comment: http://stackoverflow.com/comment/42241351
type: Question
has comment: http://stackoverflow.com/comment/42241248
accepted answer: http://stackoverflow.com/a/26838454
answer count: 1
score: 0
has title: Schedule Task in java using Timer
tagged with: scheduled-tasks
has comment: http://stackoverflow.com/comment/42242509
tagged with: timer
tagged with: timezone
has answer: http://stackoverflow.com/a/26838454
has body: I have created timezone specific schedule task event using java. My code is bellow. Timer timer = new Timer(); Calendar date = Calendar.getInstance(TimeZone.getTimeZone("Asia/Colombo")); date.set(Calendar.HOUR_OF_DAY, 0); date.set(Calendar.MINUTE, 0); date.set(Calendar.SECOND, 0); timer.schedule(new TimerTask() { public void run() { System.out.println("Runs everday morning 12.00 AM"); } }, date.getTime(), 1000 * 60 * 60 * 24); But the problem is when call to this method it runs this task soon. I need to run this job 12.00 in Asia/Colombo time zone every day. How to do that?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42241304

camera
tags question: http://stackoverflow.com/q/26951719
tags question: http://stackoverflow.com/q/26926671
tags question: http://stackoverflow.com/q/26869282
type: Tag
tag name: camera

http://stackoverflow.com/comment/42503378
has text: How would you go about translating backward Maxqueue? Also documentation: [HashMap](https://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html) and a basic tutorial: [HashMap Tutorial](http://www.tutorialspoint.com/java/java_hashmap_class.htm)
score: 0
comment on: http://stackoverflow.com/q/26984676
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42357794
score: 0
type: Comment
has text: @TimPietzcker But I don't palce value into string like this `String rx = "////E////"`, I get it from ResultSet, so why would it build regex with half of the backslashes?
type: AnswerComment
comment on: http://stackoverflow.com/a/26902978

http://stackoverflow.com/a/26884301
has body: You can use a second Shell and position it just next to the Button: public static void main(String[] args) { final Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); Button button = new Button(shell, SWT.PUSH); button.setText("Button"); final Shell popup = new Shell(shell, SWT.NONE); popup.setLayout(new FillLayout()); Text input = new Text(popup, SWT.BORDER); button.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if(popup != null &amp;&amp; !popup.isDisposed()) popup.close(); } }); shell.pack(); shell.open(); popup.pack(); popup.open(); popup.setLocation(button.toDisplay(button.getBounds().width, 1)); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); } Looks like this: Of course you'd need to handle resize and move events of your original shell to keep it in place.
upvote count: 3
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26883687
answers question: http://stackoverflow.com/q/26883687
type: AcceptedAnswer

http://stackoverflow.com/comment/42401363
type: Comment
type: QuestionComment
has text: I am using all three jar files. But still getting error.
comment on: http://stackoverflow.com/q/26927225
score: 0

http://stackoverflow.com/comment/42470944
comment on: http://stackoverflow.com/q/26966960
type: QuestionComment
has text: I have one file ...! first block is to upload file on s3 and second block to copy that file two hdfs using ssh . what I want to create one abstract level design to decide task run async or in sync and also decide task will wait for all previous task or not (based on some flag).
score: 0
type: Comment

http://stackoverflow.com/q/26896742
score: -1
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26897712
downvote count: 1
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/29891847
tagged with: algorithm
upvote count: 0
has answer: http://stackoverflow.com/a/29891847
has title: Infix to postfix convert algorithm error in java
has answer: http://stackoverflow.com/a/26897712
favorite count: 0
tagged with: infix-notation
tagged with: postfix-notation
has body: This code has to convert insfix expressions to postfix while(!infixStack.isEmpty() &amp;&amp; infixStack.top() != '(' &amp;&amp; Precedence(infixStack.top(),st)) { postfix += infixStack.top(); infixStack.pop(); } I guess my mistake is in this lines or in the precedence method. Because I give the input : 35+6*2-3/(3*5) and my output is : 356+2*3-35*/ but it has to be : 3562*+335*/- public String InfixToPostfix(String element) { SLLStack&lt;Character&gt; infixStack = new SLLStack&lt;Character&gt;(); String postfix = ""; for(int i = 0 ; i &lt; element.length() ; i++){ char st = element.charAt(i); if(st == ' ' || st == ',') {continue;} else if(Operator(st)){ while(!infixStack.isEmpty() &amp;&amp; infixStack.top() != '(' &amp;&amp; Precedence(infixStack.top(),st)) { postfix += infixStack.top(); infixStack.pop(); } infixStack.push(st); } else if(Operand(st)){ postfix += st; } else if (st == '(') { infixStack.push(st); } else if(st == ')') { while(!infixStack.isEmpty() &amp;&amp; infixStack.top() != '(') { postfix += infixStack.top(); infixStack.pop(); } infixStack.pop(); } } while(!infixStack.isEmpty() &amp;&amp; infixStack.top() != '(') { postfix += infixStack.top(); infixStack.pop(); } return postfix; } public boolean Operand(char st) { if(st &gt;= '0' &amp;&amp; st &lt;= '9') {return true;} else {return false;} } public boolean Operator(char st) { if(st == '+' || st == '-' || st == '*' || st == '/') {return true;} else {return false;} } public int OperatorWeight(char st) { int weight = -1; switch(st) { case '+': case '-': weight = 0; case '*': case '/': weight = 1; } return weight; } public boolean Precedence(char operand1, char operand2) { int op1Weight = OperatorWeight(operand1); int op2Weight = OperatorWeight(operand2); if(op1Weight &gt;= op2Weight) { return true; } else {return false;} }

http://stackoverflow.com/q/26929154
has title: Unable to get the shared with me files with the Google Drive Api using Filters.sharedWithMe()
tagged with: java
type: AnsweredQuestion
has body: I have some files in my Google Drive that others have shared with me and I would like to be able to query them. Unfortunately the MetadataBuffer' result count is 0 This is the code: private GoogleApiClient mGoogleApiClient; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); mGoogleApiClient = new GoogleApiClient.Builder(this).addApi(com.google.android.gms.drive.Drive.API) .addScope(com.google.android.gms.drive.Drive.SCOPE_FILE).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).build(); } @Override protected void onStart() { super.onStart(); mGoogleApiClient.connect(); } @Override public void onConnected(Bundle arg0) { Query query = new Query.Builder().addFilter(Filters.sharedWithMe()).build(); Drive.DriveApi.query(mGoogleApiClient, query).setResultCallback(metadataCallback); } private ResultCallback&lt;DriveApi.MetadataBufferResult&gt; metadataCallback = new ResultCallback&lt;DriveApi.MetadataBufferResult&gt;() { @Override public void onResult(DriveApi.MetadataBufferResult result) { if (!result.getStatus().isSuccess()) { Log.d(TAG, "Problem while retrieving results"); return; } MetadataBuffer buffer = result.getMetadataBuffer(); if(buffer != null) { int cnt = buffer.getCount(); Log.d(TAG, "BUFFER COUNT: " + cnt); for(int i = 0; i &lt; cnt; i++) { Metadata meta = buffer.get(i); Log.d(TAG, meta.getTitle()); } buffer.close(); } } }; .................... I am using the new Google Drive and I also tried moving some shared files from the Incoming Folder into the My Drive root. Still nothing. I would appreciate any help and suggestions.
type: Question
has answer: http://stackoverflow.com/a/27829239
tagged with: android
linked to: http://stackoverflow.com/q/26992251
accepted answer: http://stackoverflow.com/a/27829239
tagged with: google-drive-api
score: 0
answer count: 1
tagged with: google-drive-android-api

http://stackoverflow.com/comment/42433890
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26945073
score: 0
has text: input.close(); int unit= (pread - cread); System.out.println("Your Consumed unit is " + unit); if (unit >= 0 && unit <= 100) { System.out.println("Your cost is 2.50"); } else if (unit >= 100 && unit <= 200) { System.out.println("Your cost is 2.25"); } else if (unit >= 200 && unit <=300) { System.out.println("Your cost is 1.90"); } if (unit >= 300) { System.out.println("Your cost is 1.65"); } } }

http://stackoverflow.com/q/26968958
has comment: http://stackoverflow.com/comment/42474276
answer count: 6
has answer: http://stackoverflow.com/a/26969376
possible better answer: http://stackoverflow.com/a/26969072
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/26969072
accepted answer: http://stackoverflow.com/a/26969098
has answer: http://stackoverflow.com/a/26969196
linked to: http://stackoverflow.com/q/17967114
upvote count: 1
has comment: http://stackoverflow.com/comment/42474381
downvote count: 1
has answer: http://stackoverflow.com/a/26969200
has answer: http://stackoverflow.com/a/26969104
type: AnsweredQuestion
has body: So, i am writing a program that analyzes an entire array and displays the repeated values as well as the unique values: int dupe = 0; int[] range = {1, 1, 2, 2, 2, 3, 3, 3, 4, 5, 6, 6}; for (int i = 0; i &lt; range.length; i++) { for (int j = i + 1; j &lt; range.length; j++) { if (range[i] == range[j]) { dup = range[j]; System.out.println(dup); } } } The above code outputs the repeated values correctly but when the value repeats three or more times, it outputs that value many times instead of just once 1 2 2 2 3 3 3 6 How can i fix this? For the unique value part of the program, i don't know where to start. Thanks! EDIT: The only Arrays class methods i can use are: binarySearch, copyOf, equals, fill, sort, and toString I need to write my own implementation - not to use Set, HashSet etc. Or any other tools such as iterators
tagged with: java
has comment: http://stackoverflow.com/comment/42475212
has title: Duplicate array elements and unique elements
has comment: http://stackoverflow.com/comment/42475570
has answer: http://stackoverflow.com/a/26969098
type: Question
has comment: http://stackoverflow.com/comment/42474426
tagged with: arrays

http://stackoverflow.com/a/42025703
has comment: http://stackoverflow.com/comment/125166657
has comment: http://stackoverflow.com/comment/93363095
type: Answer
answers question: http://stackoverflow.com/q/26889970
has comment: http://stackoverflow.com/comment/140016136
has comment: http://stackoverflow.com/comment/85002623
upvote count: 44
has comment: http://stackoverflow.com/comment/113439909
has comment: http://stackoverflow.com/comment/87051056
score: 44
has comment: http://stackoverflow.com/comment/114287806
has body: My version of IntelliJ IDEA Ultimate (2016.3.4 Build 163) seems to support this. The trick is that you need to have enabled the Spring Data plugin.
downvote count: 0

http://stackoverflow.com/q/26871051
has title: JSF 2.0 - How to show in a label the text value of java enum?
has body: this is my first post in the forum. I have a Java enum class with identifier (value) and description (text). CriteriExlusio.java: public enum CriteriExclusio{ C1(1, "&lt; 10"), C2(2, "Low grade"), C3(3, "Medium grade"), C4(4, "High grade"), C5(5, "&gt; 250"), private final int value; private final String text; private CriteriExclusio(int value, String text) { this.value = value; this.text = text; } public int getValue() { return value; } public String getText() { return text; } } And the controller: @Named(value = "auxCriteriExclusioController") @ApplicationScoped public class AuxCriteriExclusioController { public CriteriExclusio[] getCriteriExclusio(){ return CriteriExclusio.values(); } } I load values-text in selectonemenu properly and stored in the table (values-int) when I submit the form. .xhtml &lt;h:selectOneMenu value="#{mbVCriteriExclusio.criteriExclusio.idCriteriExclusio}" id="cmbCriteriExclusio" required="true"&gt; &lt;f:selectItem itemLabel="" itemValue=""&gt;&lt;/f:selectItem&gt; &lt;f:selectItems value="#{auxCriteriExclusioController.criteriExclusio}" var="respuestaCriterisExclusio" itemValue="#{respuestaCriterisExclusio.value}" itemLabel="#{respuestaCriterisExclusio.text}" /&gt; &lt;/h:selectOneMenu&gt; The problem is when a page retrieve the data in the table I want to display the text (text) in a outputlabel which corresponds to the value (value) that is stored in the database. It is much more user friendly and need to show the text not the numerical value. I have searched and tried several options but I can not retrieve the text. Only recover the C1, C2....etc of java enum. &lt;p:outputLabel value="#{auxCriteriExclusioController.criteriExclusio[itemCriterisExclusio.idCriteriExclusio]}" /&gt; For example if in the table is saved the value 3, the label to be displayed is "Medium grade" UPDATE. datatable code &lt;h:form id="frmExclos"&gt; &lt;p:growl id="mensajeGeneral3" sticky="false" showDetail="true"/&gt; &lt;p:panel id="pnlCriteriExclusio" style="…
has answer: http://stackoverflow.com/a/26905488
has answer: http://stackoverflow.com/a/26931290
answer count: 4
linked to: http://stackoverflow.com/q/8229638
tagged with: jsf
has answer: http://stackoverflow.com/a/26888688
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42361503
upvote count: 1
type: Question
tagged with: enums
has answer: http://stackoverflow.com/a/26905686
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42347279

http://stackoverflow.com/comment/42412633
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26915779
has text: I appreciate what you are saying, I have basically gotten to the exact same conclusion as you but i need a solution so i'm looking for a fresh perspective. There's no way to do pre-computation, there's no way to know what the points will be until the user is literally trying to look at them. I've seen this sort of thing work on google maps so i'm hoping there's a way to solve this. Thanks for your help but "good luck with that" comments aren't really appreciated.

http://stackoverflow.com/comment/42345665
type: Comment
has text: If you want to read at arbitrary places in a 1 GB file, a RandomAccessFile that you can seek in is a better choice, I think.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26896067

http://stackoverflow.com/q/26871263
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42301007
favorite count: 0
has comment: http://stackoverflow.com/comment/42301325
has comment: http://stackoverflow.com/comment/42301277
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42304806
tagged with: android
has comment: http://stackoverflow.com/comment/42301262
has body: I have the following segment of code in Java for Android: int index = oldArray.indexOf(person); if (index == -1) { Log.d("Tag", "TESI index == -1"); } else { oldArray.remove(index); &lt;--- error is here newArray.add(person); } I got the following exception java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 at com.tesi.salus.PersonView.updatePerson(PersonView.java:406) [line 406 is the remove] My question is how is that possible? If I understand well, if oldArray is empty then index should be -1, not 0. Or, am I missing something? Thanks. ================== Thanks for the answers. I have only one thread. oldArrayis declared as: public ArrayList oldArray&lt;Person&gt;; And initialized below as: oldArray = new ArrayList();
has comment: http://stackoverflow.com/comment/42306084
has comment: http://stackoverflow.com/comment/42301233
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26893787
type: Question
score: 3
has title: Can a Java ArrayList be empty and indexOf return an index of 0?
has comment: http://stackoverflow.com/comment/42301344
tagged with: arraylist

http://stackoverflow.com/q/26969438
answer count: 1
has answer: http://stackoverflow.com/a/26969474
score: 0
has title: Asynctask not working in the first run in Fragment
tagged with: android-asynctask
has body: I'm trying to make a facebook app for my class project using facebook graph api. I have these codes but when i open it first time or log in for the first time, my asynctasks are not working but when I close it and open again, it displays the things I needed. please help. PageHomeFeed.java public class PageFeedHome extends Fragment { ArrayList&lt;HashMap&lt;String, String&gt;&gt; feedList; private static final String TAG_ID = "id"; private static final String TAG_NAME = "name"; private static final String TAG_MESSAGE = "message"; private String feedMessage; ListView listView; BaseAdapter adapter; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.feed_home_activity, container, false); listView = (ListView) view.findViewById(R.id.feed_lv); feedList = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;(); new LoadPosts().execute(); adapter = new SimpleAdapter(getActivity(), feedList, R.layout.feed_item_view, new String[] { TAG_MESSAGE, TAG_NAME, TAG_ID }, new int[] { R.id.message, R.id.author, R.id.id_tv }); listView.setAdapter(adapter); return view; } private class LoadPosts extends AsyncTask&lt;String, Void, String&gt; { @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub Session.openActiveSession(getActivity(), true, new Session.StatusCallback() { // callback when session changes state @Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { new Request(session, "/163340583656/feed", null, HttpMethod.GET, new Request.Callback() { public void onCompleted( Response response) { /* handle the result */ Log.i("PostFeedResponse", response.toString()); try { GraphObject graphObj = response .getGraphObject(); JSONObject json = graphObj .getInnerJSONObject(); JSONArray jArray = json .getJSONArray("data"); for (int i = 0; i &lt; jArray.length(); i++) { JSONObject currObj = jArray.getJSO…
type: UnansweredQuestion
tagged with: android
tagged with: facebook
tagged with: android-fragments
tagged with: java
type: Question

http://stackoverflow.com/a/26845310
type: AcceptedAnswer
upvote count: 5
has comment: http://stackoverflow.com/comment/42253874
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26845264
answers question: http://stackoverflow.com/q/26845264
has body: You should check the largest first then use elseif statements ex. if(a ==1 &amp;&amp; b == 1 &amp;&amp; c == 1){ System.out.println("CourseG, CourseF, CourseE are available"); } else if(a == 1 &amp;&amp; b == 1){ System.out.println("CourseF and CourseE are available"); } else if(a == 1){ System.out.println("CourseE is available"); } else{ System.out.println("no available Course"); } Start with largest scope first and work your way in.
has comment: http://stackoverflow.com/comment/42253936
score: 5

http://stackoverflow.com/a/26887307
has comment: http://stackoverflow.com/comment/42330238
type: Answer
has comment: http://stackoverflow.com/comment/42330054
has comment: http://stackoverflow.com/comment/42328930
has comment: http://stackoverflow.com/comment/42362506
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26887193
score: 1
has comment: http://stackoverflow.com/comment/42330141
has comment: http://stackoverflow.com/comment/42329119
has comment: http://stackoverflow.com/comment/42330085
answers question: http://stackoverflow.com/q/26887193
has comment: http://stackoverflow.com/comment/42330120
has comment: http://stackoverflow.com/comment/42331233
has comment: http://stackoverflow.com/comment/42329996
upvote count: 1
type: AcceptedAnswer
has body: class LoadData extends AsyncTask&lt;String, String, String&gt; { @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub dxml = new DownloadXML(); in_loc = inloc.getText().toString(); dxml.checkInetConnection(this,in_loc); return null; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub outloc.setText(hxml.getLocation()); outtemp.setText(hxml.getTemperature()); super.onPostExecute(result); } } and than case R.id.btn_search: new LoadData().execute(); break;

http://stackoverflow.com/comment/42482355
has text: Wow what a requirement. I like it. Yes its possible.
score: 2
comment on: http://stackoverflow.com/q/26973585
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26897538
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26897577
has body: Is there away to parse json with java keywords like class, case, default etc. to java object using Gson library? The lines Gson gson = new Gson(); MyObject myObject = gson.fromJson(json, MyObject.class); simply parse json to my pojo, but I have key "class" in my json and I can't use the field "class" in java classes.
has comment: http://stackoverflow.com/comment/42348258
has answer: http://stackoverflow.com/a/26897586
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26897577
has title: How to parse json with java language keywords
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
possible better answer: http://stackoverflow.com/a/26897586
type: Question

http://stackoverflow.com/a/26888552
has body: You can simply do this with the following code: // Just get the value of the column, and add it to the list timeStr.add(rs.getString(1).split(" ")[1]);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26886394
score: 1
upvote count: 1

http://stackoverflow.com/q/26859506
type: Question
score: 10
accepted answer: http://stackoverflow.com/a/26860162
answer count: 2
tagged with: tomcat8
has answer: http://stackoverflow.com/a/26860162
favorite count: 0
has body: I am upgrading to tomcat 8 from 7. Is it required to add this listener? <Listener className="org.apache.catalina.startup.VersionLoggerListener" />
upvote count: 10
has title: Is it required to add org.apache.catalina.startup.VersionLoggerListener for tomcat 8 server.xml?
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/36034754
tagged with: java
has answer: http://stackoverflow.com/a/36034754

http://stackoverflow.com/q/26870858
has body: I'm a relatively new QA Engineer working on learning Selenium (in Java) and I want to use page objects to model my pages. Currently, the way I'm doing it, my page object classes are collections of static variables (By objects for locating page elements) and static methods (for getting the By objects and performing page functions). This seemed like the simplest way to me as my methods don't need to rely on any instance variables, just the locators. I just call these methods as I need them in my test code. However, everything I read about page objects talks about instantiating them and having methods return page objects. This seems like it makes everything more complicated. For example, instead of having one method for logging in, I need two, one for if the login succeeds and one for if it fails. I know it seems to be the accepted best practice, but I want to understand why. Thanks. Here is my pageObject code, my tests call methods as LoginPage.login(username, password); package pageObjects; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; public class LogInPage { private static By emailTxtB = By.id("user_email"); private static By passwordTxtB = By.id("user_password"); private static By logInButton = By.xpath("/html/body/div/div[2]/form/div[2]/div[2]/div/button"); private static By signUpButton = By.xpath("/html/body/div/div[2]/form/div[2]/div[2]/div/a"); private static By valErrorMessage = By.id("flash_alert"); public static void logIn(WebDriver driver, String email, String password){ //Fill out form driver.findElement(emailTxtB).sendKeys(email); driver.findElement(passwordTxtB).sendKeys(password); //Submit form driver.findElement(logInButton).click(); } public static void goToSignUp(WebDriver driver){ driver.findElement(signUpButton).click(); } public static String getValErrorMessage(WebDriver driver){ return driver.findElement(valErrorMessage).getText(); } public By getEmailTxtB(){ return emailTxtB; } public By getPasswordTxtB(){ return passwor…
has answer: http://stackoverflow.com/a/26870997
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/64553471
downvote count: 0
has answer: http://stackoverflow.com/a/64553471
score: 7
accepted answer: http://stackoverflow.com/a/40096082
favorite count: 0
has title: Why should I be making my page objects instantiated rather than static?
type: Question
has answer: http://stackoverflow.com/a/58657006
has comment: http://stackoverflow.com/comment/42308986
answer count: 4
has comment: http://stackoverflow.com/comment/42333724
tagged with: selenium-webdriver
has comment: http://stackoverflow.com/comment/42342449
tagged with: java
tagged with: selenium
upvote count: 7
has answer: http://stackoverflow.com/a/40096082
tagged with: pageobjects

http://stackoverflow.com/q/26959442
has comment: http://stackoverflow.com/comment/42464839
type: Question
tagged with: android
has title: Hide Sprite behind AutoParallax Background Andengine
has answer: http://stackoverflow.com/a/27169295
upvote count: 1
has comment: http://stackoverflow.com/comment/42466432
answer count: 1
has body: Everyone. I'm making an Android game with Andengine. I use Autoparallax background in this game. Now I want to add a sprite to the screen in such a way that the parallax background will appear in front of the sprite. However, it is not as I expected when the sprite coverd the background This is my code public static void populateSplashScene(Engine pEngine) { // create and attach ground to splash scene MainActivity.ground = new Sprite(0, 0, mSpritesheetTextureRegionLibrary .get(TextureRegionId.GROUNDGRASS_ID), pEngine.getVertexBufferObjectManager()); MainActivity.ground.setOffsetCenter(0, 0); MainActivity.background.attachParallaxEntity(new ParallaxEntity(-3, MainActivity.ground)); // create and attach rock to splash scene MainActivity.rock = new Sprite(0, 0, mSpritesheetTextureRegionLibrary .get(TextureRegionId.ROCKGRASS_ID), pEngine.getVertexBufferObjectManager()); MainActivity.rock.setOffsetCenter(0, 0); MainActivity.ground.attachChild(MainActivity.rock); // create and attach rockDown to splashscene MainActivity.rockDown = new Sprite(30, MainActivity.CAMERA_HEIGHT, mSpritesheetTextureRegionLibrary .get(TextureRegionId.ROCKGRASSDOWN_ID), pEngine.getVertexBufferObjectManager()); MainActivity.rockDown.setOffsetCenter(0, 1); MainActivity.ground.attachChild(MainActivity.rockDown) PhysicsHandler physicsHandler = new PhysicsHandler(MainActivity.ground); MainActivity.ground.registerUpdateHandler(physicsHandler); physicsHandler.setVelocityX(-25); } the sprite which I want to hide is rock the background is ground What can I do? Any help would be appreciated. Thank in advance
tagged with: java
type: UnansweredQuestion
tagged with: parent-child
tagged with: andengine
has comment: http://stackoverflow.com/comment/42475845
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/26946159
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42434970
has comment: http://stackoverflow.com/comment/42434684
has title: Number pyramid,beginner recursion tracking difficulty?
upvote count: 2
downvote count: 1
possible better answer: http://stackoverflow.com/a/26946315
favorite count: 0
has body: I am a beginner in JAVA, and I am having some difficulties tracking recursion and understaning it fully and so here I have the code for a program that if we write 3, it will output: 1 12 123 12 1 Or if we write 5, it will output 1 12 123 1234 12345 1234 123 12 1 public class Aufgabe3 { private static void printSequenz(int n) { if(n&lt;1) { return; } printLoToHi(n-1); printMany(n); printHiToLo(n-1); } private static void printHiToLo(int n){ if(n&lt;1){ return; } printMany(n); printHiToLo(n-1); } private static void printLoToHi(int n){ if(n&lt;1){ return; } printLoToHi(n-1); printMany(n); } private static void printMany(int n){ for(int i=1;i&lt;=n;i++){ System.out.print(i); } System.out.println(); } public static void main(String[] args) { printSequenz(5); } } Now here is what I don't understand. For example at the method printHiToLo it calls the method printMany(n), and then it calls itself for n-1, and this repeats until n is greater than 0. But I don't understand how the method printLoToHi works? How does it ever reach the printMany method? If it just calls itself until n is greater than 0. This is really confusing to me... Thanks to anyone that helps me out :)
tagged with: recursion
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26946210
accepted answer: http://stackoverflow.com/a/26946210
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26946315

http://stackoverflow.com/q/26941305
has answer: http://stackoverflow.com/a/26941331
possible better answer: http://stackoverflow.com/a/26941360
has body: I have a String entered by the User. I'm trying to replace all non-uppercase letters(i.e. numbers, or symbols) with spaces without using methods such as replace(), Stringbuilders, or arrays. This is what I have so far : public static void formatPlaintext(String sentence){ String sentenceUpper = sentence.toUpperCase(); System.out.println(sentenceUpper); String emptyString = " "; for(int i = 0; i&lt; sentenceUpper.length() ; i++){ char ch = sentenceUpper.charAt(i); if(ch &lt; 'A' || ch &gt; 'Z'){ ch = emptyString.charAt(0); } } }//end of formatPlaintext I keep getting the error that String index is out of range. I believe it has to do with : ch = emptyString.charAt(0); because emptyString doesn't have any characters. But even if I put an arbitrary constant in, it doesn't replace the non-letters with this arbitrary constant.
score: 0
tagged with: char
accepted answer: http://stackoverflow.com/a/26941331
has title: Replacing characters
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26941360
tagged with: loops
type: Question
answer count: 2

http://stackoverflow.com/a/26986764
downvote count: 0
has comment: http://stackoverflow.com/comment/42507292
type: Answer
upvote count: 1
has body: If you want to divide the layout into two areas, you will need to use only two containers - center and south. For example, &lt;container:SimpleContainer&gt; &lt;container:child layoutData="{outerData}"&gt; &lt;container:BorderLayoutContainer ui:field="con"&gt; &lt;container:center layoutData="{centerData}"&gt; &lt;gxt:ContentPanel&gt; &lt;g:FlexTable ui:field="table"/&gt; &lt;/gxt:ContentPanel&gt; &lt;/container:center&gt; &lt;container:south layoutData="{southData}"&gt; &lt;gxt:ContentPanel /&gt; &lt;/container:south&gt; &lt;/container:BorderLayoutContainer&gt; &lt;/container:child&gt; &lt;/container:SimpleContainer&gt;
score: 1
answers question: http://stackoverflow.com/q/26985469

http://stackoverflow.com/comment/42353568
has text: How to get each "weatherCondition" objects from the "DayForecast" object and build the listView from them
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26899531
score: 0

http://stackoverflow.com/q/26915620
score: 0
tagged with: tcp
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/42380305
type: Question
has title: Change the keep-alive timeout to detect a broken TCP connection
has comment: http://stackoverflow.com/comment/42381227
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/42380272
tagged with: udp
has comment: http://stackoverflow.com/comment/42380609
has body: I have been using UDP for long. But now its turn for TCP to get used by me. I want to use TCP sockets in Java and C application for MAC, Linux and Windows 7 OSes. While using UDP, to know broken connection, I was tracking simple last packet receive time. If suppose node A does not receive any UDP packet within 5 seconds from node B, I was considering the connection broken. When there is no data to send from A to B or from B to A, both A and B will send small keep-alive packet (without data) to each other every second. This prevents the connection from being considered broken when not sending any data. So, I want to know how the detection of broken connection works in TCP. Basically I want to know if a connection is broken on reading or writing to socket, and that only within 5 second. I know that reading / writing will throw IOException in Java or return -1/0 in C, but how much time does TCP take to consider a connection as broken in each platform. And how can I change this connection expire timeout value?
has comment: http://stackoverflow.com/comment/42381272
has comment: http://stackoverflow.com/comment/42380534
favorite count: 0
has comment: http://stackoverflow.com/comment/42380409
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42381321
tagged with: sockets
has comment: http://stackoverflow.com/comment/42416180
upvote count: 1
answer count: 0

http://stackoverflow.com/a/26965029
has body: Thread.sleep makes UI thread inaccessible. You should use Handler class instead. Sorry I can't provide any codes since I am on mobile but it's quite easy. If i remember right "postDelayed" method is what you need. public void blink(TextView textView) { if (textView.getText() == "Blink!") { textView.setText(""); } else { textView.setText("Blink!"); } } public void blinkingTask() throws InterruptedException { final Handler handler = new Handler(); final TextView textView = (TextView) findViewById(R.id.my_text); Runnable runnable = new Runnable() { @Override public void run() { blink(textView); } }; for (int i = 0; i &lt;= 5; i++) { handler.postDelayed(runnable, 1000 + (i * 1000)); // 5 delayed actions with 1000 ms interval. } }
has comment: http://stackoverflow.com/comment/42479316
upvote count: 2
has comment: http://stackoverflow.com/comment/42472748
has comment: http://stackoverflow.com/comment/42467666
answers question: http://stackoverflow.com/q/26964831
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26964831
type: Answer
score: 2

http://stackoverflow.com/q/26869118
tagged with: tostring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26869368
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42297313
downvote count: 0
has title: Using toString Method instead of Print method
possible better answer: http://stackoverflow.com/a/26869347
has comment: http://stackoverflow.com/comment/42297807
has answer: http://stackoverflow.com/a/26869360
has comment: http://stackoverflow.com/comment/42297586
has comment: http://stackoverflow.com/comment/42297568
favorite count: 0
has body: How can I use the toString method, instead of my custom print method below, in my code? My current code's output is exactly what it is supposed to be, but my instructor wants me "to use toString and get same output". I am confused and do not know how to do it. Here is my code: public class LinkedListIntro { //print method public static void print(Node temp) { System.out.print("["); while (temp.getNext() != null) { System.out.print(temp.getData() + ", "); temp = temp.getNext(); } System.out.println(temp.getData() + "]"); } public static void main(String[] args) { Node start = null; Node temp = null; for (int i = 1; i &lt;= 5; i++) { if (start == null) { start = new Node(i); temp = start; } else { temp.setNext(new Node(i)); temp = temp.getNext(); } } //3. printing data print(start); //4. removing 4 temp = start; Node n = temp.getNext(); while (n.getNext() != null) { if ((int) n.getData() == 4) { temp.setNext(n.getNext()); n = null; break; } temp = temp.getNext(); n = n.getNext(); } //5. printing data again after removing 4 print(start); //6. adding 100 between 1 and 2 temp = start; Node n1 = temp.getNext(); while (n1.getNext() != null) { if ((int) temp.getData() == 1) { temp.setNext(new Node(100)); temp = temp.getNext(); temp.setNext(n1); } temp = temp.getNext(); n1 = n1.getNext(); } //7. printing data again after adding 100 print(start); //8. removing first node temp = start; start = start.getNext(); temp = null; //printing data after removing 1st node print(start); //9. add 0 to beginning temp = start; start = new Node(0); start.setNext(temp); //printing the final data print(start); } } public class Node&lt;E&gt; { private E data; private Node next; public Node(E data) { this.data = data; this.next = null; } public E getData(){ return data; } public Node getNext() { return next; } public void setNext(Node next) { this.next = next; } public String toString() { return data.toString(); } }
has answer: http://stackoverflow.com/a/26869384
accepted answer: http://stackoverflow.com/a/26869384
answer count: 5
has answer: http://stackoverflow.com/a/26870146
has comment: http://stackoverflow.com/comment/42297630
upvote count: 1
has answer: http://stackoverflow.com/a/26869347

emacs
tags question: http://stackoverflow.com/q/26953383
tags question: http://stackoverflow.com/q/26921923
tag name: emacs
type: Tag

http://stackoverflow.com/a/26869177
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42300453
downvote count: 0
has comment: http://stackoverflow.com/comment/42300751
has comment: http://stackoverflow.com/comment/42300820
has comment: http://stackoverflow.com/comment/42301014
has body: Say you have a ListView in your Activity, we will call it listView and it will likely be setup something like this private ListView listView; private MyListAdapter adapter; public class MainActivity extends Activity{ @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(android.R.id.list); ... } ... } At some point you will build your adapter and set it to your listView (listView.setAdapter(adapter);). Notice adapter and listView are class variables so they can be used throughout our entire class. Now your listView should be ready to go. You have told us, "The filter works fine", so I am going to assume at this point you just need to manage handling clicking on an item, that is done with listView.setOnItemClickListener(new OnItemClickListener(){ @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { /* THIS IS WHAT YOU WANT TO DO TO GET AN ITEM FROM YOUR LIST */ String data = dataAdapter.getItem(position); // do what you want with your data String } }); Where MyDataObject is replaced with whatever the type is in your list that your adapter is pulling from. As you can see you use your adapter and the position you clicked on to actually get your data from that position. Your list itself will manage data positions, no need for you to do that. EDIT Based on your code, I would create a list object that has a reference to what you need, and still let your adapter manage everything. public class ListItemObject{ private String data; private Class clazz; private int[] soundSettings; public ListItemObject(String data, Class clazz, int[] soundSettings){ this.data = data; this.clazz = clazz; this.soundSettings = soundSettings; } // getters and setters } Then change your ArrayAdapter to ArrayAdapter and in your getView method of your adapter do set your values, something like textView.setText(getItem(position).getData());…
score: 1
accepted answer of: http://stackoverflow.com/q/26851689
has comment: http://stackoverflow.com/comment/42300603
has comment: http://stackoverflow.com/comment/42298422
has comment: http://stackoverflow.com/comment/42301152
answers question: http://stackoverflow.com/q/26851689
has comment: http://stackoverflow.com/comment/42300690
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42306433
has comment: http://stackoverflow.com/comment/42300912
has comment: http://stackoverflow.com/comment/42301642
has comment: http://stackoverflow.com/comment/42306380

http://stackoverflow.com/q/26928304
score: 0
duplicate of: http://stackoverflow.com/q/7147018
has answer: http://stackoverflow.com/a/26928491
type: UnansweredQuestion
has body: Which is more useful in hibernate using annotations or XML??And which is widely used in IT industry and why? Any answers are welcome.
linked to: http://stackoverflow.com/q/7147018
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
has title: Hibernate using a annotations or xml files?

http://stackoverflow.com/q/26836560
downvote count: 0
possible better answer: http://stackoverflow.com/a/51540061
tagged with: java
tagged with: hibernate
tagged with: mysql
accepted answer: http://stackoverflow.com/a/26842223
type: Question
score: 5
has title: CreateQuery is not valid without active transaction
has answer: http://stackoverflow.com/a/26842223
tagged with: spring-transactions
answer count: 2
has answer: http://stackoverflow.com/a/51540061
has body: I'm trying to use the Spring @Transactional annotation, but i have problems when the method findAll is called and i have this error: org.hibernate.HibernateException: createQuery is not valid without active transaction at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:352) at com.sun.proxy.$Proxy57.createQuery(Unknown Source) at org.munaycoop.taskmanager.daos.PersonDataAccesObject.findAll(PersonDataAccesObject.java:20) at org.munaycoop.taskmanager.services.PersonService.findAll(PersonService.java:26) at org.munaycoop.taskmanager.controllers.PersonController.ShowAllPersons(PersonController.java:20) 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.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet…
favorite count: 0
upvote count: 5
tagged with: spring
has comment: http://stackoverflow.com/comment/42241498
type: AnsweredQuestion

http://stackoverflow.com/comment/42472960
comment on: http://stackoverflow.com/q/26967814
has text: Added the console log and the headers. Thanks for the reply!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26862874
possible better answer: http://stackoverflow.com/a/26862974
type: Question
has comment: http://stackoverflow.com/comment/42289205
has comment: http://stackoverflow.com/comment/42285803
has answer: http://stackoverflow.com/a/26862974
upvote count: 13
answer count: 2
has body: I struggle with the definition and usage of the Stream.collect(Supplier&lt;R&gt; supplier, BiConsumer&lt;R,? super T&gt; accumulator, BiConsumer&lt;R,R&gt; combiner) method in Java 8. The method signature includes BiConsumer typed parameters. The BiConsumer FunctionalInterface defines one functional method accept(Object, Object). As far as I understand I can now use any lambda expression that is congruent to this functional interface. But the example mentioned in the Stream.collect JavaDoc is e.g. List&lt;String&gt; asList = stringStream.collect(ArrayList::new, ArrayList::add, ArrayList::addAll); I do not understand why ArrayList.add(E e) (single parameter) is congruent with the BiConsumer.accept(T t, U u) method (two parameters) and can be used as the accumulator function in the collect method. As you see I obviously have a lack of understanding and appreciate any explanation.
favorite count: 0
accepted answer: http://stackoverflow.com/a/26863014
linked to: http://stackoverflow.com/q/23023618
score: 13
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26863014
downvote count: 0
has title: Usage of function type congruent lambda expressions in Java 8
tagged with: java
linked to: http://stackoverflow.com/q/23139725

http://stackoverflow.com/q/26842637
type: Question
has comment: http://stackoverflow.com/comment/42279975
has answer: http://stackoverflow.com/a/26860040
has comment: http://stackoverflow.com/comment/42275581
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42278642
tagged with: android-activity
has comment: http://stackoverflow.com/comment/42280248
score: -1
favorite count: 0
has body: Helper Class import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.res.Configuration; import android.graphics.Color; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; public class HelperActivity extends Activity { String btnvariable, tempcount; SharedPreferences preferences; Configuration config; boolean temp; DataBaseHandler db; static int count; NewBreakfastItems bitems; public static TextView num; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.footer); preferences = PreferenceManager.getDefaultSharedPreferences(this); tempcount = preferences.getString("count1", ""); } public void footerBlock() { Log.e("", "footer block-----"); Log.e("---helper count---", "" + count); Log.d("", "count from items class" + "\t" + NewBreakfastItems.count1); count = NewBreakfastItems.getVariable(); Log.e("---helper count---", "====y value====" + count); // temp = true; final TextView btn_about = (TextView) findViewById(R.id.about); final TextView btn_recipe = (TextView) findViewById(R.id.recipe); final TextView btn_chef = (TextView) findViewById(R.id.chef); final TextView btn_signin = (TextView) findViewById(R.id.signin); final TextView num = (TextView) findViewById(R.id.num); final TextView btn_urorders = (TextView) findViewById(R.id.urorders); /* num.setText(NewBreakfastItems.count1); */ // Log.e("--contacts--", "-----count----"+db.getContactsCount()); if (!getPref("pref__count").equals("")) { Log.e("", "getPref------" + getPref("pref__count")); num.setText(String.valueOf(count)); } if (!tempcount.equals("")) { Log.e("", "tempcount-----" + tempcount); int countnew = db.getContactsCount(); num.setText(String.valueOf(count)); // num.setText(countnew); } if (g…
type: UnansweredQuestion
has title: unable to increment the text view value while clicking a button .. its updating only when changing from one tab to another
tagged with: android
has comment: http://stackoverflow.com/comment/42249309
tagged with: java
downvote count: 1
tagged with: import

http://stackoverflow.com/q/26976833
has answer: http://stackoverflow.com/a/26976905
favorite count: 0
has answer: http://stackoverflow.com/a/26978079
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42488405
has answer: http://stackoverflow.com/a/26976911
tagged with: java
has comment: http://stackoverflow.com/comment/42488451
downvote count: 1
type: Question
has title: Is it possible to generate a random number in the parameter of a function when the function is called?
has comment: http://stackoverflow.com/comment/42488366
score: -1
has comment: http://stackoverflow.com/comment/42488408
has body: I have written a Java program that calculates square root of a number, I am not using the in-built functions. The method used is divide and average. The method requires two inputs : "X" and a random number "n" where n &lt; X. Usually when generating a random number, I use : Random generator = new Random(); double guess = (double)generator.nextInt((int)(X - 1)); What I want is that a function similar to the one given below : static double sqrt(double X, generator.nextInt(int)X) something like this must execute during function call. Is it possible? Kindly guide me through this.
answer count: 3
upvote count: 0

http://stackoverflow.com/a/26907832
score: 0
has comment: http://stackoverflow.com/comment/42366132
has comment: http://stackoverflow.com/comment/42366039
has comment: http://stackoverflow.com/comment/42368381
type: Answer
answers question: http://stackoverflow.com/q/26907701
has comment: http://stackoverflow.com/comment/42380135
has comment: http://stackoverflow.com/comment/42368422
has body: Your problem probably lies in these 3 lines : Exercise[] exercises = loadExercises(SavingData.getDifficulty()); // may return null myExercises = new FitnessExercise(exercises); // the null is passed to this instance myExercises.randomize(); // the null is referenced here You haven't included the code of loadExercises, but based on the exception you got, it's likely that this method returns null in some cases. This null is used to initialize the FitnessExercise instance, and causes the NullPointerException in randomize(). I suggest that instead of returning null, you return an empty array in loadExercises.

yammer
type: Tag
tags question: http://stackoverflow.com/q/26926634
tag name: yammer

http://stackoverflow.com/q/26940726
tagged with: arrays
answer count: 1
has answer: http://stackoverflow.com/a/26941106
has comment: http://stackoverflow.com/comment/42426103
has body: When I call the array of cards to be used in my shuffle method, it works like a charm: Card [ ] cards = new Card[52]; //I create my array here, outside of any method Random rnGen = new Random( ); public Deck( ) //Here is where I declare all the values for my array elements { cards[0] = new Card(11,"ACE","CLUB"); cards[1] = new Card(2,"TWO","CLUB"); cards[2] = new Card(3, "3", "CLUB"); cards[3] = new Card(4, "4", "CLUB"); cards[4] = new Card(5, "5", "CLUB"); ... //52 statements declaring every single card. } public void shuffle( ) //This method is able to draw { //from the array with no problems Card temp = new Card( ); for(int k = 0; k &lt; 7000; k++; { f = rnGen.nextInt(52); s = rnGen.nextInt(52); temp = cards[f]; //Calling in elements from array cards[f] = cards[s]; //and it works cards[s] = temp; } } But then the problem arises when I try to call in the top element from the array: public Card getTopCard( ) { Card top = new Card( ); top = card[0]; //This is the line that has the error return top; } The error states: "array required, but Card found" Why can my shuffle() method access my array no problem, but my topcard() method cannot? I haven't done anything different, my array was still declared in another part of the class. If you can enlighten me as to why this is the case I would be very appreciative because I actually want to understand why this is an error.
score: 0
has comment: http://stackoverflow.com/comment/42426046
has comment: http://stackoverflow.com/comment/42425696
tagged with: required
has title: Why can some of my methods access an array created but others cannot? (JAVA)
has comment: http://stackoverflow.com/comment/42426189
accepted answer: http://stackoverflow.com/a/26941106
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42425567
tagged with: methods
has comment: http://stackoverflow.com/comment/42425539

http://stackoverflow.com/comment/108118572
score: 0
type: Comment
has text: this was deprecated
comment on: http://stackoverflow.com/a/26936398
type: AnswerComment

http://stackoverflow.com/comment/42471250
comment on: http://stackoverflow.com/q/26967189
has text: Is there `log4j.jar` in your classpath ?
type: QuestionComment
score: 0
type: Comment

http://stackoverflow.com/comment/42253886
type: QuestionComment
has text: Do you have general breakpoints on certain exceptions? e.g. catch all NullPointerExceptions? And are you using special frameworks or plugins? So you are using a blank eclipse without plugins, and you are not using Spring, Maven etc?
comment on: http://stackoverflow.com/q/26845411
score: 0
type: Comment

http://stackoverflow.com/a/26977503
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: GameActionListener is a class so when you create a new instance you probably want to call the constructor like so new GameActionListener()
answers question: http://stackoverflow.com/q/26977403
has comment: http://stackoverflow.com/comment/42490015
has comment: http://stackoverflow.com/comment/42490064

http://stackoverflow.com/comment/42341604
score: 0
type: Comment
type: QuestionComment
has text: Turn your logs to DEBUG level. Only show the logs that get written for one request cycle, otherwise we'll be reading logs for days.
comment on: http://stackoverflow.com/q/26892452

http://stackoverflow.com/q/26948254
type: UnansweredQuestion
has body: I have one zip file (C:\source.zip ~130 mb size) common source in my server, I want to create new text file that depends on user info dynamically and append into that source.zip, then I need to give a download link to separate user. My idea is, I will combine the source.zip and new user text file into one temporary folder (c:\temp). Then I will give the temporary folder as download link. After user downloaded the zip, I will delete the zip file in temp folder. But my problem is, I will duplicate source into temp folder. So many users access this means server size will increase. So I want to read the (source.zip and text file) zip archives with no intermediate disk/memory storage to download in servlet. How can I do this in servlet or jsp?
tagged with: servlets
has comment: http://stackoverflow.com/comment/42479994
answer count: 0
tagged with: jsp
tagged with: http://stackoverflow.com/tag/zip
tagged with: download
type: Question
has comment: http://stackoverflow.com/comment/42480570
has comment: http://stackoverflow.com/comment/42439942
score: 0
tagged with: java
has title: How to download the zip file, Reads Zip archives with no intermediate disk/memory storage in servlet

http://stackoverflow.com/a/26968486
has body: I agree with @Giru-Bhai, the component views have to be defined upon creating the view, in OnCreate() method, not inside any other method, so this block have to be only once: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.citations); editText1 = (EditText) findViewById(R.id.editText1); author = (EditText) findViewById(R.id.author); articleTitle = (EditText) findViewById(R.id.articleTitle); webTitle = (EditText) findViewById(R.id.webTitle); webDay = (EditText) findViewById(R.id.webDay); webMonth = (EditText) findViewById(R.id.webMonth); webYears = (EditText) findViewById(R.id.webYears); now, on line String Total = authorLast1+","+" "+authorFirst1+"."+" "+"\""+articleTitle1+"."+"\""+" "+website1+"."+" "+Publisher1+","+" "+day2+" "+month2+" "+year2+"."+" "+"Web"+"."+" "+day+" "+month+"."+" "+year+"."; citationText.setText(authorFirst1); I believe there's an error as you set the content of the label CitationText as authorFirst1, also the concatenation may be improved. String Total = authorLast1+","+" "+authorFirst1+"."+" "+"\""+articleTitle1+"."+"\""+" "+website1+"."+" "+Publisher1+","+" "+day2+" "+month2+" "+year2+"."+" "+"Web"+"."+" "+day1+" "+month1+"."+" "+year1+"."; citationText.setText(authorFirst1); String Total = authorLast1+", "+authorFirst1+". \""+articleTitle1+".\" "+website1+"."+Publisher1+", "+day2+" "+month2+" "+year2+". "+"Web"+". "+day1+" "+month1+". "+year1+"."; citationText.setText(Total); If you aren't working with arrays, the only reason you get a NullPointerException is when you address to a view the code doesn't recognize. All views must be declared as part of the layout as soon as you start to write OnCreate() method.
downvote count: 0
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26967917
score: 1

http://stackoverflow.com/q/26926502
type: AnsweredQuestion
score: 1
has body: In my code after sending a request to a JSP page using an AJAX call, it does not show the result in the &lt;div&gt; tag. Id of my &lt;div&gt; tag is "div1". Control is passed to the JSP page. After processing the JSP page, the value in responseText is not displayed in the &lt;div&gt; tag. I don't understand the reason. I am hereby attaching the code ... and also can i add events to the tags on "new.jsp" file? &lt;%-- Document : Databases Created on : Nov 10, 2014, 3:08:01 PM Author : user --%&gt; &lt;%@page import="java.sql.PreparedStatement"%&gt; &lt;%@page import="java.sql.DatabaseMetaData"%&gt; &lt;%@page import="java.sql.ResultSet"%&gt; &lt;%@page import="querywork.DBConnection"%&gt; &lt;%@page import="java.sql.Statement"%&gt; &lt;%@page import="java.sql.DriverManager"%&gt; &lt;%@page import="java.sql.Connection"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; &lt;title&gt;Untitled Document&lt;/title&gt; &lt;script language="javascript" type="text/javascript"&gt; try { function create(str) { var xmlHttp xmlHttp=CreateXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="new.jsp" url=url+"?dbname="+str url=url+"&amp;sid="+Math.random() // out.print(url) xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true) xmlHttp.send() } function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("div1").innerHTML=xmlHttp.responseText } } function CreateXmlHttpObject() { var objXMLHttp=null if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp } } catch(err) {} &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" name=…
type: Question
tagged with: java
tagged with: javascript
has answer: http://stackoverflow.com/a/26926606
accepted answer: http://stackoverflow.com/a/26926606
has comment: http://stackoverflow.com/comment/42400086
upvote count: 1
downvote count: 0
answer count: 1
tagged with: jsp
has title: Div tag doesn't show any result
favorite count: 0
tagged with: ajax
has comment: http://stackoverflow.com/comment/42399437

http://stackoverflow.com/q/26900818
score: 1
has title: Get median values from sorted data
tagged with: java
has comment: http://stackoverflow.com/comment/42354224
accepted answer: http://stackoverflow.com/a/26902143
has comment: http://stackoverflow.com/comment/42354281
type: Question
has comment: http://stackoverflow.com/comment/42354120
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42354307
favorite count: 0
tagged with: median
has comment: http://stackoverflow.com/comment/42354273
has answer: http://stackoverflow.com/a/26902143
has comment: http://stackoverflow.com/comment/42354298
upvote count: 1
has comment: http://stackoverflow.com/comment/42354155
type: AnsweredQuestion
has body: I have a set of sorted (ascending) data in the format below: | Category | Value | S.D. | | A | 0.1 | 0.1 | | A | 0.2 | 0.05 | | A | 1.3 | 0.08 | | B | 0.1 | 0.01 | | B | 0.2 | 0.08 | | B | 0.6 | 0.9 | | B | 0.7 | 0.01 | | B | 0.9 | 0.05 | | B | 1.1 | 0.6 | | C | 0.5 | 0.3 | | C | 0.9 | 0.04 | | C | 1.0 | 0.14 | | C | 2.1 | 0.1 | etc... There are about 300 rows of this. I have imported this from csv and have sorted as a List. For example data.get(1).getCategory() results in "A", and data.get(2).getValue() results in "0.2" (It is a String as I am using a library.) The data is subject to change. I need to calculate a median value for each category, and print each median value with it's category name. Where there are an even number of entries, the middle value with the smallest S.D. should be used. For example, using the above data: "A: 0.2" "B: 0.7" "C: 0.9"
has comment: http://stackoverflow.com/comment/42354255

http://stackoverflow.com/comment/42481626
score: 0
has text: i moved it like you said, still same result.
type: Comment
comment on: http://stackoverflow.com/a/26969474
type: AnswerComment

http://stackoverflow.com/q/26929877
has answer: http://stackoverflow.com/a/26929937
favorite count: 0
linked to: http://stackoverflow.com/q/11085994
possible better answer: http://stackoverflow.com/a/26929956
duplicate of: http://stackoverflow.com/q/11085994
type: AnsweredQuestion
has title: Why can't I read .properties file in order?
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26929937
has body: I have a label.properties file like this: text1:firstname text2:middlename text3:lastname text4:username I read the properties file using this code package test; import java.util.Enumeration; import java.util.ResourceBundle; public class labelclass { public static String read(int n) { ResourceBundle rb = ResourceBundle.getBundle("myfolder.label"); Enumeration &lt;String&gt; keys = rb.getKeys(); while (keys.hasMoreElements()) { for(int i=1; i&lt;=n; i++){ String key = keys.nextElement(); } String value = rb.getString(key); return value; } } } If I call read(2), It should return middlename. But it returns firstname The order at which it returns is like: text2:middlename text1:firstname text4:username text3:lastname Why is this so?
downvote count: 1
type: Question
tagged with: properties-file
has comment: http://stackoverflow.com/comment/42405265
has comment: http://stackoverflow.com/comment/42405175
has comment: http://stackoverflow.com/comment/42405301
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26929956

http://stackoverflow.com/comment/42415779
score: 1
type: AnswerComment
has text: You've suggested I use 'final' in my code. As new as I am to Java, I thought 'final' was meant for constants.
type: Comment
comment on: http://stackoverflow.com/a/26934294

http://stackoverflow.com/a/26845642
has comment: http://stackoverflow.com/comment/42526293
type: Answer
has comment: http://stackoverflow.com/comment/42523858
upvote count: 8
has comment: http://stackoverflow.com/comment/42274015
has body: RabbitMQ now has a priority queue plugin where messages are delivered in priority order. It would be better to use that rather than your scheme of requeueing low priority messages which will be quite expensive at runtime. EDIT: When using the rabbitTemplate.convertAndSend(...) methods, and you want to set the priority property on the message, you either need to implement a custom MessagePropertiesConverter in the template (subclass the DefaultMessagePropertiesConverter) or use the convertAnSend variants that take a message post-processor; e.g.: template.convertAndSend("exchange", "routingKey", "message", new MessagePostProcessor() { @Override public Message postProcessMessage(Message message) throws AmqpException { message.getMessageProperties().setPriority(5); return message; } });
answers question: http://stackoverflow.com/q/26838803
accepted answer of: http://stackoverflow.com/q/26838803
has comment: http://stackoverflow.com/comment/42318798
score: 8
has comment: http://stackoverflow.com/comment/42283176
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26875910
has answer: http://stackoverflow.com/a/40355284
tagged with: android
linked to: http://stackoverflow.com/q/17710739
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42313570
has comment: http://stackoverflow.com/comment/42314302
type: Question
has title: android.support.v4.widget.DrawerLayout Cannot be instantiated
has comment: http://stackoverflow.com/comment/42312870
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/42309520
score: 0
has body: I'm trying to preview my MainActivity XML file and I'm getting this error: java.lang.ClassNotFoundException: android.support.v4.widget.DrawerLayoutImpl My Main Fragment and Navigation Drawer Fragment are working just fine. Searched all over these forums and tried a bunch of things to no avail. I know it must be an issue with the library and my gradle build but I'm not sure what I'm doing wrong: apply plugin: 'com.android.application' android { compileSdkVersion 21 buildToolsVersion '21.0.0' defaultConfig { applicationId "com.example.example" minSdkVersion 17 targetSdkVersion 21 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v4:21.0.0' compile 'com.parse.bolts:bolts-android:1.1.2' compile 'com.android.support:support-v13:21.0.0' compile fileTree(dir: 'libs', include: 'Parse-*.jar') compile project(':facebook') } v4 was added automatically by android studio since I was using a navigation drawer. v13 I included myself (by going to project structure-->dependencies and adding it there) thinking it would help. I copied both .jar files to my libs folder thinking that would help as well. Cleaned project/synced gradle did all of that, not sure what else to do. Just in case, here is what Android Studio created for me for activity_main.xml &lt;!-- A DrawerLayout is intended to be used as the top-level content view using match_parent for both width and height to consume the full space available. --&gt; &lt;android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"&gt; &lt;!-- As the main content view, the view below consumes the entire space avai…
answer count: 1

http://stackoverflow.com/comment/42503838
comment on: http://stackoverflow.com/q/26985038
has text: The problem is you're doing 'backward' checking. If you look at the intended result, it's clear that it should be doing 'forward' checking. You need to check if the character in front of 'a' is the same, not behind 'a'.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26939279
has body: I'm using java WWsdk. I am expecting the SelectListener to respond to user clicks on the map when user clicks just the map (i.e. not an icon or placemark,etc..). It works fine for me when i click on my objects, but it doesn't trigger when i click "empty space". i.e. like water/land. The docs for SelectListener says If no object is under the cursor but the cursor is over terrain, the select event will >identify the terrain as the picked object and will include the corresponding geographic >position This statement makes it sound like i should get an event whenever i don't click an object,but i don't get this. Am i supposed to add some other kind of layer to get clicks on map to trigger select events? I use this which is working for me for actions i need performed on objects that get clicked: this.worldWindowGLCanvas1.addSelectListener(new SelectListener() { public void selected(SelectEvent event) { //Never goes here for clicks on map, just clicks //on objects i have already created. doStuff(); } }
has answer: http://stackoverflow.com/a/31440890
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/31415117
type: Question
downvote count: 0
has title: Nasa World Wind: SelectListener not triggering on map clicks
favorite count: 0
answer count: 1
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/85526695
has text: This is a horrible error message. It is perfectly clear when you know what the problem is, and completely unhelpful when you don't. An addition of `Did rs.next() return true? ` would be an immense improvement.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26905227
score: 0

http://stackoverflow.com/a/52374678
answers question: http://stackoverflow.com/q/26970652
has body: This seems to work: public static long sumDigits(final List&lt;Long&gt; list) { return list.stream().mapToLong(l -&gt; l).sum(); }
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/56999213
answers question: http://stackoverflow.com/q/26925058
score: 1
has body: In my case I was reading the stream in a jersey RequestEventListener I created on the server side to log the request body prior to the request being processed. I then realized that this probably resulted in the subsequent read to yield no string (which is what is passed over when the business logic is run). I verified that to be the case. So if you are using streams to read the JSON string be careful of that.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/26862278
favorite count: 0
has body: While running a java Applet in browser, a process java.exe starts and a java console appears if enabled. As long as the process is alive, the console is visible indicating the same. This process doesn't exit if I to other page or even close the browser. It terminates automatically after some random time. Is there a way to control that time duration? I've a functionality that starts with an applet , then navigate to some other page for completion. To use it again I return to applet page and here the applet initializes again if the process is already terminated which takes some time. I'd like to extend this time if possible so that applet doesn't initialize again.
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has title: java : Extend Applet process timeout
accepted answer: http://stackoverflow.com/a/26876393
upvote count: 2
has answer: http://stackoverflow.com/a/26876393
answer count: 1
tagged with: applet

http://stackoverflow.com/comment/42363716
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26906380
has text: @SME_Dev there is nothing in CS which says that queue has to be list structured. PQ are usually trees.

http://stackoverflow.com/q/26975233
has comment: http://stackoverflow.com/comment/42486055
upvote count: 5
tagged with: complexity-theory
has answer: http://stackoverflow.com/a/27038518
accepted answer: http://stackoverflow.com/a/27038518
has comment: http://stackoverflow.com/comment/42485891
type: AnsweredQuestion
tagged with: algorithm
has title: What's the complexity of the following code?
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/26975622
type: Question
has comment: http://stackoverflow.com/comment/42485917
answer count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/26975622
score: 4
favorite count: 0
has body: According to this code: for (int i=1; i&lt;=N; i*=2) { for (int j=1;j&lt;=i;j++) { System.out.println("The value for i is "+i+" and the value for j is "+j); } } The first for-loop will run log(n) times, at first I thought of 2n-1 for the second for-loop, but it doesn't work for odd numbers. Any ideas? :)
tagged with: time-complexity

http://stackoverflow.com/a/26913561
has body: This block for (initialization; termination; increment) { statement(s) } is equivalent to { initialization; for (; termination; ) { statement(s) increment; } } Note the extra scoping braces in the second equivalent. This emphasises that a variable declared in the initialisation step is out of scope after the final }. So your comment //actual x++ operation? is in the correct place: immediately before your closing brace.
has comment: http://stackoverflow.com/comment/42376339
score: 4
answers question: http://stackoverflow.com/q/26913482
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/42552093
type: QuestionComment
type: Comment
has text: I made the third, see https://github.com/xqbase/compiler-eclipse :-)
comment on: http://stackoverflow.com/q/26972192
score: 0

http://stackoverflow.com/comment/42279880
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/26859490
has text: Probably `~` is not expanded to user home. Try using `System.getProperty("user.home")` instead.

http://stackoverflow.com/comment/42324569
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26884095
has text: no client is sending correct data....because for checking there is a software provided by client using that we can view datas sending to my server

http://stackoverflow.com/q/26936156
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
has body: I am trying to write something that returns some search suggestion result. Suppose I have an string like this : "[Harry,[harry potter,harry and david]]" The format is like [A_STRING,A_STRING_ARRAY_HERE]. But I wany the output format to be like [ "Harry",["harry potter","harry and david"]] so that I can put it into the HTTP Response Body. Is there a simple way to do this, I don't want to add "" for a very single String from scratch .
tagged with: http://stackoverflow.com/tag/json
upvote count: 2
answer count: 3
accepted answer: http://stackoverflow.com/a/26936602
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26936597
possible better answer: http://stackoverflow.com/a/26936489
has answer: http://stackoverflow.com/a/26936602
tagged with: spring
has answer: http://stackoverflow.com/a/26936489
has title: Simple way to add double quote in a JSON String
tagged with: double-quotes

http://stackoverflow.com/q/26929170
has comment: http://stackoverflow.com/comment/42404001
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26929304
downvote count: 1
tagged with: java
score: -1
has title: Convert from XML in format A to XML in format B
type: Question
has comment: http://stackoverflow.com/comment/42403993
has body: The schema for the XML file is changing and i need to create a utility that will take the xml file in format A and convert it to format B. How can i do it. I am not able to figure out the starting point for it.
tagged with: xml-parsing
upvote count: 0

http://stackoverflow.com/a/26958580
answers question: http://stackoverflow.com/q/26958195
type: Answer
has comment: http://stackoverflow.com/comment/42466890
has comment: http://stackoverflow.com/comment/42456182
has comment: http://stackoverflow.com/comment/42456014
score: 0
has body: couple things are wrong in your codes remove query.get(), this is supposed to load the object by Id you cannot cast List to String[] do a for loop and ParseObject.getString("title");
has comment: http://stackoverflow.com/comment/42456369

http://stackoverflow.com/comment/42304130
type: QuestionComment
has text: map = ((MapFragment) getActivity().getFragmentManager().findFragmentById(R.id.map)).getMap();
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26872774

http://stackoverflow.com/comment/42426122
type: Comment
score: 0
type: AnswerComment
has text: I have another method which returns info from my database and it works fine, are you sure i need an asynctask? thanks.
comment on: http://stackoverflow.com/a/26940477

http://stackoverflow.com/a/26884959
upvote count: 3
has comment: http://stackoverflow.com/comment/42325451
score: 3
has comment: http://stackoverflow.com/comment/42325520
has comment: http://stackoverflow.com/comment/42325291
has comment: http://stackoverflow.com/comment/42325252
has comment: http://stackoverflow.com/comment/42325168
accepted answer of: http://stackoverflow.com/q/26884252
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26884252
has comment: http://stackoverflow.com/comment/42325391
has body: You use tomcat datasource to connect to derby? I think if you use jdbc directly(initializing connection pool in the webapp using c3p0 or tomcat pools), it could be no problem to include derby jars in WEB-INF/lib. You can use embedded derby driver now. If you need derby network server, you could start it with a ContextListener, or you can configure the datasource in spring context if you are using spring.
type: Answer
has comment: http://stackoverflow.com/comment/42336297

http://stackoverflow.com/a/26968825
has comment: http://stackoverflow.com/comment/42482840
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26968554
has body: What you want to match: \" A backslash is a regex special char (used to escape), so you need to escape them: \\" A backslash is also a Java special char in strings (also used to escape), so you need to escape them: \\\\" a double-quote needs to be escaped as well in Java (since it's the string literal delimiter): \\\\\" You want to replace by a double-quote, so the point #4 needs to be applied again: .replaceAll("\\\\\"", "\"") Same logic for the other replacement (without the point #4 since no double-quote): .replaceAll("\\\\/", "/") Combined into one single regex: .replaceAll("\\\\([\"/])", "$1")
type: Answer
score: 9
upvote count: 9
answers question: http://stackoverflow.com/q/26968554
has comment: http://stackoverflow.com/comment/42489567

http://stackoverflow.com/comment/42347318
type: QuestionComment
score: 1
has text: Looks right to me. Does it work?
comment on: http://stackoverflow.com/q/26897027
type: Comment

http://stackoverflow.com/a/26942346
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/26932576
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/83986180
has body: I'm trying to understand the use-case for this? Why wouldn't you use separate pools, if session X really needs a connection to database A, and session Y needs a connection to database B? HikariCP will likely never support such functionality (I can say that as one of the authors). A connection pool should provide a DataSource that is completely transparent to the application, such that if the pool was removed and the native DataSource was used instead the application would function identically (albeit less efficiently). The very fact that you can do something like this in C3P0, but not in HikariCP, Vibur, or Apache DBCP should be a red-flag. Using such functionality locks you into a specific pool implementation, which is never a good thing. Sorry, I can't provide a happy answer. If I were you I would consider writing an application level helper class to get/return connections that provides the semantics you are looking for.
answers question: http://stackoverflow.com/q/26932576
upvote count: 3

http://stackoverflow.com/a/26843870
score: 1
has body: I dealt with a similar issue using a custom container class. It uses double-buffering methodology via a CAS object that allows you to read all accumulated objects in one lock-free action. I have no idea how efficient it is but it's simplicity should ensure it is up there with the good ones. Note that most of the code below is test code - you can remove all code below the //TESTING comment without affecting the functionality. /** * Lock free - thread-safe. * * Write from many threads - read with fewer threads. * * Write items of type T. * * Read items of type List&lt;T&gt;. * * @author OldCurmudgeon * @param &lt;T&gt; - Th etype we plan to write/read. */ public class DoubleBufferedList&lt;T&gt; { /** * Atomic reference so I can atomically swap it through. * * Mark = true means I am adding to it so momentarily unavailable for iteration. */ private final AtomicMarkableReference&lt;List&lt;T&gt;&gt; list = new AtomicMarkableReference&lt;&gt;(newList(), false); // Factory method to create a new list - may be best to abstract this. protected List&lt;T&gt; newList() { return new ArrayList&lt;&gt;(); } /** * Get and replace the current list. * * Used by readers. * * @return List&lt;T&gt; of a number (possibly 0) of items of type T. */ public List&lt;T&gt; get() { // The list that was there. List&lt;T&gt; it; // Replace an unmarked list with an empty one. if (!list.compareAndSet(it = list.getReference(), newList(), false, false)) { // Mark was not false - Failed to replace! // It is probably marked as being appended to but may have been replaced by another thread. // Return empty and come back again soon. return Collections.&lt;T&gt;emptyList(); } // Successfull replaced an unmarked list with an empty list! return it; } /** * Grab and lock the list in preparation for append. * * Used by add. */ private List&lt;T&gt; grab() { List&lt;T&gt; it; // We cannot fail so spin on get and mark. while (!list.compareAndSet(it = list.getReference(), it, false, true)) { // Spin on mark - …
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26843287
downvote count: 0

http://stackoverflow.com/a/26839879
accepted answer of: http://stackoverflow.com/q/26839669
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42246913
upvote count: 1
has comment: http://stackoverflow.com/comment/42247092
type: Answer
has body: The following code convert "2014-06-11 16:32:36.828" into "2014-06-11 16:32:36" new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2014-06-11 16:32:36.828")); Explanation: new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS").parse("2014-06-11 16:32:36.828") parse the input string into Wed Jun 11 16:32:36 IST 2014 new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) format the input date into specified structure.
answers question: http://stackoverflow.com/q/26839669
downvote count: 0
score: 1

http://stackoverflow.com/comment/42308034
comment on: http://stackoverflow.com/q/26875111
has text: Is there another way? I understand you're totally right but i know its not what my tutor is looking for :( could i do similar using a for or while loop?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26913747
upvote count: 1
has body: You can just edit each index in your current for loop: String[] arr; for(i=0; i &lt; n ; i++){ int j = i+1; String g = a + j; System.out.println(g); arr[i] = g; } So all your printed g's will be part of the array arr.
has comment: http://stackoverflow.com/comment/42376686
downvote count: 0
answers question: http://stackoverflow.com/q/26913572
type: Answer
score: 1

http://stackoverflow.com/a/26923792
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26880216
type: Answer
answers question: http://stackoverflow.com/q/26880216
has body: At last I found the solution of my problem. To display customised messages, follow this : @NotBlank(message = "your messages") private String variableName; You can use (messege="...") with every hibernate validator defined annotations, eg. @Range, @Size, @NotEmpty, etc. No need to create any ValidationMessages.properties file or messages.properties file for your own. No need to do anything in spring-context.xml file for binding. You may follow this link for more knowledge on this issue. Enjoy coding with your own messages !
upvote count: 3
score: 3

jogl
tag name: jogl
type: Tag
tags question: http://stackoverflow.com/q/26860541

http://stackoverflow.com/comment/42235973
comment on: http://stackoverflow.com/q/26834919
has text: Your variable `ocean` is declared and initialized inside your method `setOcean()` which means it only exists in there. You can't use it in `main` like this `setSize(ocean);`. You need something like `String s = setOcean();` then use `setSize(s);`.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/26920794
favorite count: 0
has comment: http://stackoverflow.com/comment/42390081
tagged with: jlist
has answer: http://stackoverflow.com/a/26920907
type: UnansweredQuestion
tagged with: swing
downvote count: 1
type: Question
tagged with: java
has title: How do I delete a row from a JList without leaving a blank space in its place?
score: -1
upvote count: 0
tagged with: arrays
answer count: 1
has body: How do I delete a row from a JList without leaving a blank space in its place? Right now it will delete the parts I need it to, but will then leave a blank space in the jlist in its place. Here are some parts of my code: private final DefaultListModel model = new DefaultListModel(); protected JList myList = new JList(model);; protected static String employee[] = new String[100]; protected String list[]; public EmployeeGUI() { scrollPane.setViewportView(myList); populate(); myList = new JList(list); myList.setFixedCellHeight(30); myList.setFixedCellWidth(100); myList.addListSelectionListener(this); public int getIndex() { int idx = myList.getSelectedIndex(); return idx; } public void populate() { list = new String [Employee.count]; for(int i = 0; i &lt; Employee.count; i++) { if(Employee.employeeArray[i] != null) list[i] = Employee.employeeArray[i].getName(); } } @Override public void actionPerformed(ActionEvent e) { else if(e.getSource() ==jbtDelete) { String k = JOptionPane.showInputDialog(null, "Are you sure you want" + " to delete?\n1: Yes\n2: No", "Delete",2); switch(k) { case "1": { int idx = getIndex(); list[idx] = null; Employee.deleteEmployee(idx); //populate(); myList.setListData(list); if (idx&lt;0) return; text2.setText(null); text3.setText(null); text4.setText(null); text5.setText(null); text6.setText(null); text7.setText(null); text10.setText(null); type.setSelectedItem("No Type"); insurance.setSelectedItem("None"); break; } case "2": break; default: JOptionPane.showMessageDialog(null, "Invalid Selection!", "INVALID",1); } } } } public static void deleteEmployee(int a) { employeeArray[a] = null; //count--; sortEmployees(); }
has comment: http://stackoverflow.com/comment/42389950

pixel
tags question: http://stackoverflow.com/q/26903832
type: Tag
tag name: pixel
tags question: http://stackoverflow.com/q/26898923
tags question: http://stackoverflow.com/q/26888599

http://stackoverflow.com/comment/42249888
score: 1
has text: When you say "none have worked" you mean that it doesn't produce the desired result or result in some kind of error?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26841629

http://stackoverflow.com/a/26973743
downvote count: 0
type: Answer
has body: I found a solution to this. I was printing the whole object, so thats why i got the error. I had a getName method in my other class which was linket Constants.FIELD_NAMES which i used to print the specific String. so i used the method: plate[current.getPos()].getName() Thanks guys!
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26973634

http://stackoverflow.com/a/26874452
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26873970
has body: You have asked 2 different questions here 1. Column not allowed here This happened because you have not passed values for any of parameter into insert statement. I am not sure about your requirement however I will use PreparedStatement for this scenario. Example String insertTableSQL = "INSERT INTO DBUSER" + "(USER_ID, USERNAME, CREATED_BY, CREATED_DATE) VALUES" + "(?,?,?,?)"; PreparedStatement preparedStatement = dbConnection.prepareStatement(insertTableSQL); preparedStatement.setInt(1, 11); preparedStatement.setString(2, "MindPeace"); preparedStatement.setString(3, "system"); preparedStatement.setTimestamp(4, getCurrentTimeStamp()); preparedStatement .executeUpdate(); 2. This code is only to save the data, delete, and modify an entire row how can I do? Answer is very simple. You have to write code for the same :) You need 3 SQL statement which has DELETE and UPDATE operation just like insert in above example.
downvote count: 0
score: 1

http://stackoverflow.com/comment/42501723
has text: Have you tried anything so far? If you have some code, please post it so people can help you with it.
comment on: http://stackoverflow.com/q/26983864
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26930192
has body: You need to change the endianness before putting values into the buffer. Just move the line right after allocating the buffer size and you should be fine. // DEBUG ByteBuffer buffer = ByteBuffer.allocate(octets); buffer.order( ByteOrder.BIG_ENDIAN); for(byte b: intVal.toByteArray()){ buffer.put(b); } ... In addition, endianness does only impact the order of bytes of larger numeric values, not bytes as explained here
score: 17
type: AcceptedAnswer
type: Answer
upvote count: 17
has comment: http://stackoverflow.com/comment/42409739
accepted answer of: http://stackoverflow.com/q/26930066
answers question: http://stackoverflow.com/q/26930066
downvote count: 0

http://stackoverflow.com/comment/42288756
score: 0
has text: No enclosing instance of type solution is accessible. Must qualify the allocation with enclosing instance of type solution. (Eg. x.new A()where x is an instance of Solution
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26864598

http://stackoverflow.com/comment/42389727
has text: I'm not calling method from a primitive array. I'm calling it from the java.utils.Arrays class
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26920741

http://stackoverflow.com/comment/42529253
type: Comment
comment on: http://stackoverflow.com/a/26991667
has text: `@ApplicationPath` will auto configure the class as a JAX-RS application, so you don't need to configure it in XML. The `Application` class is the main JAX-RS application class. `ResourceConfig` extends from it. You can either subclass `Application` directly or with Jersey only, subclass `ResourceConfig`. `ResourceConfig` adds some helper methods to make configuration easier, but it is not portable, as only Jersey uses this class. Subclassing `Application` is portable. See [Application Deployment](https://jersey.java.net/documentation/latest/deployment.html)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42348697
type: QuestionComment
comment on: http://stackoverflow.com/q/26895301
has text: Hm... sorry I don't undestand anything of what you wrote. :(
type: Comment
score: 0

http://stackoverflow.com/q/26968964
score: 6
upvote count: 6
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42474272
type: Question
possible better answer: http://stackoverflow.com/a/26969035
has comment: http://stackoverflow.com/comment/42474370
has comment: http://stackoverflow.com/comment/42474386
has answer: http://stackoverflow.com/a/26969035
has answer: http://stackoverflow.com/a/26969123
answer count: 2
has title: Reason for putting main(String args[]) at the bottom of your code?
tagged with: program-entry-point
downvote count: 0
linked to: http://stackoverflow.com/q/7911829
has body: In my text book they put the main function at the bottom of the code examples. As a conventional book reader, I start reading from line 1. While I do understand that coding has a different control flow than there is in books (from bottom to top, line per line), I do not understand why you would want your first line of code not to be the entry point of your program. Is there particular reason for this?
favorite count: 0
accepted answer: http://stackoverflow.com/a/26969123
has comment: http://stackoverflow.com/comment/132149855

http://stackoverflow.com/q/26984296
tagged with: java
has title: Dialog primefaces with src dynamic
has comment: http://stackoverflow.com/comment/42502670
has body: actually i have a problem using Dialog with content dynamic, when i presed a commandButton i want appear a Dialog, but the content's dialog doesn't appear XHTML &lt;/p:treeTable&gt; &lt;p:commandButton value="Add" action="#{showEn.displaySelectedNode}" oncomplete="PF('dialogWidget').show()"/&gt; &lt;/h:form&gt; &lt;p:dialog appendTo="@(body)" id="dialog" widgetVar="dialogWidget"&gt; &lt;ui:include src="#{showEn.dialog}"/&gt; &lt;/p:dialog&gt; Java public void displaySelectedNode(){ if(!dialogs[0].equals("-")){ this.dialog="addEn.xhtml"; }else if(!dialogs[1].equals("-")){ this.dialog="addCu.xhtml"; }else if(!dialogs[2].equals("-")){ this.dialog="addTa.xhtml"; } } public String getDialog() { return dialog; } public void setDialog(String dialog) { this.dialog = dialog; }
downvote count: 1
type: Question
answer count: 2
upvote count: 0
score: -1
has answer: http://stackoverflow.com/a/27074860
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26984739
tagged with: jsf
tagged with: primefaces
has comment: http://stackoverflow.com/comment/42502438

http://stackoverflow.com/comment/42332665
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26886471
has text: Edited my answer with a full example. Also note that im not using the variable "m_run" anymore since you don't really seem to use it anywhere else in your code.

http://stackoverflow.com/comment/42469116
type: QuestionComment
type: Comment
has text: how do you define default constructor?
score: 0
comment on: http://stackoverflow.com/q/26965894

http://stackoverflow.com/comment/42355137
comment on: http://stackoverflow.com/q/26901178
score: 0
type: QuestionComment
has text: Thank you everyone! gerrytan was correct in his answer. The problem was numerator and denominator were integers and preforming integer division (which does not take into account the decimal remainder). This was fixed by adding d1 = (float)numerator/denominator.
type: Comment

http://stackoverflow.com/a/26835988
upvote count: 3
has body: what is the reason I have to use the ByteBuffer to wrap the content of another ByteBuffer? You don't. You should have flipped the original ByteBuffer instead. You got a similar effect by calling wrap(), which sets the position of the newly wrapped ByteBuffer to zero.
has comment: http://stackoverflow.com/comment/42238086
has comment: http://stackoverflow.com/comment/46078907
downvote count: 0
has comment: http://stackoverflow.com/comment/42238331
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26835948
accepted answer of: http://stackoverflow.com/q/26835948
type: Answer
has comment: http://stackoverflow.com/comment/42238178
score: 3

http://stackoverflow.com/comment/42255070
comment on: http://stackoverflow.com/a/26844686
type: AnswerComment
score: 0
type: Comment
has text: No problem. It is a really nice comprehensive answer.

http://stackoverflow.com/a/26908029
type: Answer
answers question: http://stackoverflow.com/q/26907707
has body: I'm not aware of such an issue and JBehave have been always able to write the story durations property file when the Stroy gets exceuted. In addition, the error seems to be OS specific more that a bug or an issue within JBehave, thus a Windows OS. Check the needed permission and the disk (C:\) you are trying to it the best I can suggest.
score: 0

http://stackoverflow.com/q/26861035
upvote count: 3
tagged with: java
type: Question
tagged with: elm327
has title: ELM327 returns `?` when trying to use it with ODB Java API
has body: I'm trying to use ODB Java API (this library) to get the data from ELM327 via Bluetooth from my car, but in returns ? on every request, and library raises MisunderstoodException Here is my code: socket = device.createInsecureRfcommSocketToServiceRecord(uuid); socket.connect(); final CustomRPMCommand engineRpmCommand = new CustomRPMCommand(); final SpeedObdCommand speedObdCommand = new SpeedObdCommand(); while (!Thread.currentThread().isInterrupted()) { engineRpmCommand.run(socket.getInputStream(), socket.getOutputStream()); speedObdCommand.run(socket.getInputStream(), socket.getOutputStream()); runOnUiThread(new Runnable() { @Override public void run() { speedometerGauge.setSpeed(engineRpmCommand.getRPM(), true); rpmGauge.setSpeed(speedObdCommand.getMetricSpeed(), true); } }); } What's wrong?
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/31566617
type: UnansweredQuestion
score: 3

http://stackoverflow.com/q/26980526
score: 0
tagged with: max
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/42495458
type: UnansweredQuestion
has body: Im using an array that lets the user choose a certain amount of of variables, and each one of these variables will become a random number. However, how can I take the biggest of those random numbers and store it in a variable? Im fairly new at Java, so a simple, understandable way to do this would be perfect. Thanks in advance! int [] arr; Scanner reader= new Scanner(System.in); n = reader.nextInt(); array = new int [n]; for (n = 0; n &lt; array.length; n++ ) { x = (int)(Math.random() * 10) + 1; System.out.println(x); System.out.println("Biggest Value is: " + ); }
has answer: http://stackoverflow.com/a/26981117
has comment: http://stackoverflow.com/comment/42495488
tagged with: java
has title: How can I store the biggest value of a set of many values in a variable?
type: Question
has comment: http://stackoverflow.com/comment/42495315

http://stackoverflow.com/comment/42358135
score: 0
type: Comment
type: QuestionComment
has text: And does `tikamap.jar` include all the tika jars + dependencies inside it?
comment on: http://stackoverflow.com/q/26882825

http://stackoverflow.com/q/26839882
type: Question
has answer: http://stackoverflow.com/a/26839959
has title: Tablet restarts when I launch app from Eclipse
tagged with: eclipse
tagged with: tablet
answer count: 1
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42244539
score: 0
tagged with: java
has body: My tablet restars once in two or three times when I launch my app from Eclipse. Since nothing appears on Logcat or Error Log, I cannot post any clue. I just wonder what kind of codes can cause such behaviour, so I can check if I have written something wrong. The problem is again, I launch my app on my tablet from Eclipse, then tablet just restarts instead of launching app. This happens once in every two or three launch. Has any of you encountered such a problem?

http://stackoverflow.com/q/26894217
type: Question
has comment: http://stackoverflow.com/comment/42342199
has comment: http://stackoverflow.com/comment/42342252
tagged with: database
has comment: http://stackoverflow.com/comment/42413890
has comment: http://stackoverflow.com/comment/42342058
tagged with: listview
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26922337
tagged with: parse-platform
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/12821759
tagged with: android
linked to: http://stackoverflow.com/q/26891575
tagged with: java
has body: I want to display specific data in a listview from a database's column using parse.com, i just don't know how to specifically do that,following is the code there is an error here but you can change it completely to solve it ! public class Donar_Acceptor_list extends ListActivity { // Declare Variables ListView listview; List&lt;ParseObject&gt; ob; // ProgressDialog mProgressDialog; ArrayAdapter adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the view from listview_main.xml setContentView(R.layout.donar_acceptor_list); // Execute RemoteDataTask AsyncTask // new RemoteDataTask().execute(); } protected Void doInBackground(Void... params) throws com.parse.ParseException { // Locate the class table named "Country" in Parse.com ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("DonAcc"); query.whereEqualTo("DonAcc", "donar"); // ParseQuery&lt;ParseObject&gt; query = new ParseQuery&lt;ParseObject&gt;( // "username"); query.orderByDescending("_created_at"); try { ob = query.find(); } catch (ParseException e) { Log.e("Error", e.getMessage()); e.printStackTrace(); } return null; } protected void onPostExecute(Void result) { // Locate the listview in listview_main.xml listview = (ListView) findViewById(R.id.list); // Pass the results into an ArrayAdapter adapter = new ArrayAdapter&lt;String&gt;(Donar_Acceptor_list.this, R.layout.donar_aceptor_discription); // Retrieve object "name" from Parse.com database for (ParseObject status : ob) { adapter.add((String) status.get("name")); } listview.setAdapter(adapter); } }
has title: Fetch data from database to display in a listview using Parse.com

http://stackoverflow.com/comment/42424754
type: Comment
comment on: http://stackoverflow.com/a/26915702
score: 0
type: AnswerComment
has text: From your publisher process, you'd create a consumer on `ActiveMQ.Advisory.Consumer.Topic.Foo`, and when it received a `ConsumerInfo` message type, you'd do whatever you wanted to do. Using that mechanism, your publisher would find out as soon as a subscriber connected.

http://stackoverflow.com/q/26968554
downvote count: 0
tagged with: replaceall
favorite count: 0
has answer: http://stackoverflow.com/a/26968676
possible better answer: http://stackoverflow.com/a/26968586
tagged with: regex
type: AnsweredQuestion
has title: Java : Replace \" with " and \/ with /
has body: I'm creating json string to send to the server. I use GSon to generate json string. Because my server doesn't understand string like: \"key\":value but "key":value or "a\/b" but a/b. So after generating json string, I use replaceAll method to fix this: String res = original.replaceAll("\\/", "/").replaceAll("\\"", "\""); But this method doesn't work as I expected. Please tell me how to replace string to conform with server as above. Thanks :)
score: 3
has answer: http://stackoverflow.com/a/26968825
upvote count: 3
accepted answer: http://stackoverflow.com/a/26968825
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
type: Question
has answer: http://stackoverflow.com/a/26968586
answer count: 3

http://stackoverflow.com/a/29778258
accepted answer of: http://stackoverflow.com/q/26869187
type: AcceptedAnswer
has body: Looking at the JWT your problem is right there. It is not a JWT-token. A JWT consists of three parts: &lt;header&gt;.&lt;claims/payload&gt;.&lt;signature&gt;. Yours only contain &lt;payload&gt;.&lt;signature&gt;. I suspect you have a JWS (JSON Web Signature) and not a JWT (JSON Web Token). You can read about the format in the specs: http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html#ExampleJWT If you need to troubleshoot tokens this is a helpful tool: http://kjur.github.io/jsjws/mobile/tool_jwt.html Also, sending the password in a claim like you do seems like a backwards thing to do, even if it is encrypted. JWT is instead of sending passwords to each service. Services trust the content by validating the signature.
answers question: http://stackoverflow.com/q/26869187
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/42499890
comment on: http://stackoverflow.com/a/26981228
type: Comment
score: 5
type: AnswerComment
has text: @bmcentee148 JavaFX is not part of the Java standards because it has not yet gone through the standards process. There is a [layman's view of the Java standardization process for Java 9 here](http://www.takipiblog.com/java-9-the-ultimate-feature-list/). It is possible that JavaFX will be standardized for Java 9, but it is currently not on the list of standardization efforts accepted for Java 9. If you like, you could ask more about the standardization process for JavaFX on the [openjfx-dev mailing list](http://mail.openjdk.java.net/mailman/listinfo/openjfx-dev).

http://stackoverflow.com/comment/42386068
has text: I got a good reference here so i guess i have my answer http://stackoverflow.com/questions/11913013/return-hashmap-in-mybatis-and-use-it-as-modelattribute-in-spring-mvc
comment on: http://stackoverflow.com/q/26918434
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42323952
type: AnswerComment
type: Comment
has text: @KacperSobisz TXRX is not just for serial ports, TX= transmitter (Sender), RX = Receiver (server).
comment on: http://stackoverflow.com/a/26883934
score: 0

http://stackoverflow.com/q/26914623
favorite count: 0
has comment: http://stackoverflow.com/comment/42378234
has answer: http://stackoverflow.com/a/26914655
possible better answer: http://stackoverflow.com/a/26914651
has answer: http://stackoverflow.com/a/42832142
upvote count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/40393797
tagged with: compiler-errors
tagged with: java
has answer: http://stackoverflow.com/a/26914651
type: Question
has answer: http://stackoverflow.com/a/48477812
accepted answer: http://stackoverflow.com/a/26914656
answer count: 6
tagged with: inputstream
has title: error with basic java code
has comment: http://stackoverflow.com/comment/42378238
downvote count: 2
tagged with: outputstream
has answer: http://stackoverflow.com/a/26914656
has body: This is some basic java code: package javaapplication32; import java.io.*; public class JavaApplication32 { public static void main(String[] args)throws Exception { try{ out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream("dec.dat"))); in = new DataInputStream(new BufferedInputStream(new FileInputStream("enc.dat"))); String enc=in.readUTF(); System.out.println(enc); }catch(EOFException e){ } } } I am getting the error that it cannot find the symbol 'in' or 'out'

http://stackoverflow.com/a/26844075
has comment: http://stackoverflow.com/comment/42253131
type: Answer
has body: A bit of pedantry, but use logging. Beside java.util.logging, a servlet (like a JSP) has a log method. Logging is also saved a log file in general, which helps, when time passes after an error report is received. Systen.out not appearing might be due to System.setOut capturing the output, in general to a log too. Maybe look in the glassfish logs. The other case might be an Exception being thrown. For instance when there is no parameter radios. But that would probably show. It might also be that you run glassfish as a service, and so there is an inaccessible System.out. Not likely in the combination NetBeans + Glassfish.
answers question: http://stackoverflow.com/q/26843764
has comment: http://stackoverflow.com/comment/42258629
score: 0

http://stackoverflow.com/q/26936025
type: AnsweredQuestion
type: Question
tagged with: java
score: 0
answer count: 1
has title: Connection successfully downloads on one screen, gets error on second screen with virtually the same code
has answer: http://stackoverflow.com/a/26936097
accepted answer: http://stackoverflow.com/a/26936097
has body: I'm getting an strange event when trying to download a "Success" message from the same php file from two different screens that both have the same connection code. Each page has a button to connect and return success plus the php file's information. Any idea on why this is happening? Connections are both successful, get return 200 in both cases. AppInfo returns "Success" Buy returns this: 11-14 11:23:14.209: D/JWP(2395): &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="refresh" content="0;url=http://finder.cox.net/main?InterceptSource=0&amp;ClientLocation=us&amp;ParticipantID=96e687opkbv4scrood8k84drs6gw5duf&amp;FailureMode=1&amp;SearchQuery=&amp;FailedURI=http%3A%2F%2Fsinfo.txt%2Ftest.php&amp;AddInType=4&amp;Version=2.1.8-1.90base&amp;Referer=&amp;Implementation=0&amp;method=GET"/&gt; &lt;script type="text/javascript"&gt; url="http://finder.cox.net/main?InterceptSource=0&amp;ClientLocation=us&amp;ParticipantID=96e687opkbv4scrood8k84drs6gw5duf&amp;FailureMode=1&amp;SearchQuery=&amp;FailedURI=http%3A%2F%2Fsinfo.txt%2Ftest.php&amp;AddInType=4&amp;Version=2.1.8-1.90base&amp;Referer=&amp;Implementation=0&amp;method=GET";if(top.location!=location){var w=window,d=document,e=d.documentElement,b=d.body,x=w.innerWidth||e.clientWidth||b.clientWidth,y=w.innerHeight||e.clientHeight||b.clientHeight;url+="&amp;w="+x+"&amp;h="+y;}window.location.replace(url); &lt;/script&gt; &lt;/head&gt; &lt;body&gt;&lt;/body&gt; &lt;/html&gt; here's the code for both pages: public class AppInfo extends Activity { TextView textView; public static final String DEBUGTAG = "JWP"; public static final String DATABASEPASSWORD = "pinfo.txt"; public static final String SERVERIP = "sinfo.txt"; public static final String DATABASEUSER = "ninfo.txt"; public static final String DATABASE = "dinfo.txt"; public static final String FILESAVED = "filesaved"; public EditText txtData; public E…
tagged with: android
tagged with: php

http://stackoverflow.com/a/26872187
has comment: http://stackoverflow.com/comment/42341619
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42340260
type: Answer
has body: I would go with Solution #3. Build a database-backed service/API, and have the desktop client authenticate itself and use it. I would avoid having a local database as in Solution #4. You cannot rely on your users not to accidentally mess with it somehow and cause synchronization to be lost or corrupted. In addition, having a local database will slow you down when you want to create a different client, for example a mobile app. If you decide to go with Solution #3, the current de facto standard is JSON-based REST API. Also, you should note that there are many caching techniques that can be used which will reduce the number of queries actually run.
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26871426
score: 2
answers question: http://stackoverflow.com/q/26871426

http://stackoverflow.com/comment/42370831
type: Comment
comment on: http://stackoverflow.com/a/26910623
has text: instead of `date1.compareTo(date) < 0` you can use `date1.before(date2)`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42322464
score: 0
type: Comment
has text: Thank you for your valuable advice. As I am new to this I don't know much about EntityManager. I'll try this and update the code
type: AnswerComment
comment on: http://stackoverflow.com/a/26883122

http://stackoverflow.com/q/26970986
has answer: http://stackoverflow.com/a/26971200
score: 1
has comment: http://stackoverflow.com/comment/42478391
has comment: http://stackoverflow.com/comment/42478102
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42478236
has comment: http://stackoverflow.com/comment/42477855
has body: I know this is a very simple question but since I am very bad in regex , have to ask below question. I want to write a regex expression in java which will match below two url patterns given : {contextPath}/javax.faces.resource/** {contextPath}/rfRes/** The url will be read from http request object and will be compared using java pattern object like below : Pattern p = //regex here ; p.matcher(r.getRequestURL().toString()).matches(); Can anybody help me in writing a regex experion for above two urls ?
tagged with: java
has comment: http://stackoverflow.com/comment/42478322
has title: Regex to match url patterns
possible better answer: http://stackoverflow.com/a/26971200
type: Question
answer count: 2
upvote count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26971434
accepted answer: http://stackoverflow.com/a/26971434
favorite count: 0
has comment: http://stackoverflow.com/comment/42477955
tagged with: regex

http://stackoverflow.com/comment/42419951
has text: Hi @RoniTovi, added the code in ajax where it seems to be handled, and I tried to update the date there, but the application ended up freezing.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26932404

http://stackoverflow.com/q/26948185
tagged with: java
has comment: http://stackoverflow.com/comment/42438585
linked to: http://stackoverflow.com/q/4211705
has comment: http://stackoverflow.com/comment/42438595
score: -1
has comment: http://stackoverflow.com/comment/42438375
answer count: 3
has comment: http://stackoverflow.com/comment/42438361
linked to: http://stackoverflow.com/q/88838
favorite count: 0
linked to: http://stackoverflow.com/q/5453017
has comment: http://stackoverflow.com/comment/42438989
linked to: http://stackoverflow.com/q/6222526
has title: Binary string (11110010) to char - Java
has comment: http://stackoverflow.com/comment/42438298
linked to: http://stackoverflow.com/q/17536432
has answer: http://stackoverflow.com/a/26948462
downvote count: 1
has answer: http://stackoverflow.com/a/26948259
linked to: http://stackoverflow.com/q/8634527
upvote count: 0
has answer: http://stackoverflow.com/a/26948404
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42438237
has body: I have a ""binary"" string String s1 = "10011000" and want to print the corresponding Character (Ф) of this Byte, how can I make this? I have read and tested so many solutions and tutorials...and can't find exactly what I want! Moreover, I think therected is an encoding problem. For example, this code doesn't work, but why (I have "?" in output, so encoding problem?)? int j = Integer.parseInt("10011000", 2); System.out.println(new Character ((char)j));
type: Question
linked to: http://stackoverflow.com/q/7996955
has comment: http://stackoverflow.com/comment/42438607

hudson
type: Tag
tag name: hudson
tags question: http://stackoverflow.com/q/26874073

http://stackoverflow.com/comment/42514594
type: AnswerComment
has text: try to open url like sftp://user@host.com:/path/
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26980318

variables
tag name: variables
tags question: http://stackoverflow.com/q/26942608
tags question: http://stackoverflow.com/q/26958661
tags question: http://stackoverflow.com/q/26863231
tags question: http://stackoverflow.com/q/26977158
tags question: http://stackoverflow.com/q/26847607
tags question: http://stackoverflow.com/q/26855204
tags question: http://stackoverflow.com/q/26952399
tags question: http://stackoverflow.com/q/26951652
type: Tag
tags question: http://stackoverflow.com/q/26945523
tags question: http://stackoverflow.com/q/26913451
tags question: http://stackoverflow.com/q/26851697
tags question: http://stackoverflow.com/q/26938123
tags question: http://stackoverflow.com/q/26861270
tags question: http://stackoverflow.com/q/26967924
tags question: http://stackoverflow.com/q/26980671

http://stackoverflow.com/q/26917313
score: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/27116437
possible better answer: http://stackoverflow.com/a/26917487
favorite count: 0
has answer: http://stackoverflow.com/a/26917487
tagged with: android
tagged with: maven
has title: Prevent Gradle dependency for support library from being overridden by newer version
type: AnsweredQuestion
tagged with: android-gradle-plugin
tagged with: java
has body: In my build.gradle I have the support library as a dependency, as seen here force to revision 19. compile 'com.android.support:support-v4:19.1.+ With revision 21 the Material Design support was introduced. I don't want to use the Material Design in this case here which is fine. The problem arises through the use of the Fabric SDK: I include their Maven repository maven { url 'https://maven.fabric.io/repo' } and compile the Twitter dependencies: compile('com.twitter.sdk.android:twitter:1.0.0@aar') { transitive = true; } compile('com.twitter.sdk.android:twitter-core:1.0.0@aar') { transitive = true; } Now what happens is that I get the support library in revision 21. What happened here? Does the Fabric SDK use the neweset support library? How can I force it to revision 19 anyway?
has answer: http://stackoverflow.com/a/27116437
type: Question
upvote count: 5
tagged with: twitter
answer count: 2

http://stackoverflow.com/a/44942552
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26987237
has body: This is because of IntelliJ knows groovy by nature, the only thing you have to do is DO NOT activate gmaveplus-plugin in IntelliJ: groovy-integration true org.codehaus.gmavenplus gmavenplus-plugin 1.5 addSources addTestSources generateStubs compile testGenerateStubs testCompile removeStubs removeTestStubs development-in-idea idea.version One down side is that when you run maven goal from IntelliJ IDEA's Maven Projects tool window directly, the groovy-integration profile will not be activated as usual. However, you can always navigate to the test folder, click "Run 'Tests in '...''" and have all the benefits brought to you by IntelliJ. Exclude gmavenplus-plugin within IntelliJ IDEA takes one more advantage, IntelliJ IDEA sometimes add the generated test stubs as Sources instead of Test Sources, and unable to compile them due to lack of test-scoped dependencies.

http://stackoverflow.com/comment/42599010
type: AnswerComment
comment on: http://stackoverflow.com/a/26978564
score: 0
has text: @Fjodor: Please ask that in a new question, it's easier than discussing it in comments, and you'll get an answer faster.
type: Comment

http://stackoverflow.com/comment/42486297
score: 0
has text: Just to make sure, I get you right: I'll need the ``Class`` object, if I want to do ``T obj = tType.newInstance();`` in my method, right? So in my case, I can most probably remove those arguments, but thank you for your additions.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26973067

http://stackoverflow.com/comment/42480181
has text: Just returning some values won't serve the purpose. It won't create a new request and session and I won't get username from request.getUserPrincipal().getName(). Downvoted as it is nowhere near the answer. I had already written in the question that I can't setup LDAP, setting up OpenLDAP instead is not a solution!.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26972136

http://stackoverflow.com/comment/42300456
comment on: http://stackoverflow.com/q/26870860
type: QuestionComment
has text: what is response share it.
type: Comment
score: 0

http://stackoverflow.com/q/26989613
has body: I know this is probably asked a hundred times and believe me, I read soooo much on the net already. But still, I am absolutely unapt to do this, so I'm in dire need of help here. What I want to do, is to create a node with label and properties in the neo4j db using cypher and the transactional endpoint - with the properties from a json. This is my code so far: /** * * @description creates a node in the graph * @param json object * @param label * */ private String createNodeObjectTransactional(JSONObject nodeObject, GraphNodeTypes label){ String nodeLocation=null; try{ dbServerUrl = "http://localhost:7474" transactionUrl = dbServerUrl + "/db/data" + "/transaction"; String finalUrl = transactionUrl; String payload = "{\"statements\": [ {\"statement\": \"CREATE\" (p:"+ label.toString() +" "+ nodeObject.toString() + ") } ] }"; logger.trace("sending cypher {} to endpoint {}", payload, finalUrl); WebResource resource = Client.create().resource( finalUrl ); ClientResponse response = resource .accept( MediaType.APPLICATION_JSON ) .type( MediaType.APPLICATION_JSON ) .entity( payload ) .post( ClientResponse.class ); nodeLocation = response.getLocation().toString(); String responseString = response.getEntity(String.class); logger.debug("POST to {} returned status code {}, returned data: {}", finalUrl, response.getStatus(), responseString); // first check if the http code was ok HttpStatusCodes httpStatusCodes = HttpStatusCodes.getHttpStatusCode(response.getStatus()); if (!httpStatusCodes.isOk()){ if (httpStatusCodes == HttpStatusCodes.FORBIDDEN){ logger.error(HttpErrorMessages.getHttpErrorText(httpStatusCodes.getErrorCode())); } else { logger.error("Error {} sending data to {}: {} ", response.getStatus(), finalUrl, HttpErrorMessages.getHttpErrorText(httpStatusCodes.getErrorCode())); } } else { // now do the check on json details within the returned JSON object JSONParser reponseParser = new JSONParser(); Object responseObj = reponseParser.parse(responseString); JSONObject json…
type: AnsweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26993017
accepted answer: http://stackoverflow.com/a/26993017
has comment: http://stackoverflow.com/comment/42515915
score: 0
answer count: 1
tagged with: neo4j
has title: create a node in neo4j graph db with transaction endpoint
has comment: http://stackoverflow.com/comment/42513637
tagged with: cypher

http://stackoverflow.com/q/26860515
tagged with: final
accepted answer: http://stackoverflow.com/a/26860869
has comment: http://stackoverflow.com/comment/42281647
linked to: http://stackoverflow.com/q/5947352
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42281694
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/8387989
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/42282204
has answer: http://stackoverflow.com/a/26860869
has comment: http://stackoverflow.com/comment/42285549
has title: Where does the Java store the final member and static member?
has answer: http://stackoverflow.com/a/55203242
favorite count: 0
possible better answer: http://stackoverflow.com/a/55203242
has body: I know that the static method and non-static method of a class all store in the method area. But I am really in doubt that where does Java stores the final variable(constant) members and static variable members of an object. For example, class A{ private final int a = 1; private static int b = 2; private static final int c = 3; //other codes... } I wonder where does Java store a,b,c in the memory. Heap,Stack,or Method area? ======update===== Hey,Thanks for your help.And please allow me to share a link about the components of jvm:http://www.artima.com/insidejvm/ed2/jvm2.html
tagged with: memory-management
tagged with: static

http://stackoverflow.com/a/35574600
score: 1
answers question: http://stackoverflow.com/q/26901995
downvote count: 0
type: Answer
has body: java -Dhudson.DNSMultiCast.disabled=true /usr/bin/java -Dfile.encoding=UTF-8 -Dhudson.DNSMultiCast.disabled=true -jar /Applications/Jenkins/jenkins.war See also: http://favoorr.github.io/mac-os-x-jenkins-auto-running-on-startup/
upvote count: 1

function
tags question: http://stackoverflow.com/q/26858404
tag name: function
tags question: http://stackoverflow.com/q/26955300
tags question: http://stackoverflow.com/q/26857618
tags question: http://stackoverflow.com/q/26980855
type: Tag
tags question: http://stackoverflow.com/q/26836227

http://stackoverflow.com/comment/42493033
type: QuestionComment
comment on: http://stackoverflow.com/q/26979182
has text: Is the classloader for beanInstance the same as the one for FactoryBean?
score: 0
type: Comment

http://stackoverflow.com/comment/42516013
comment on: http://stackoverflow.com/q/26991896
type: QuestionComment
has text: @mkl I have just added extra.jars 2.3 and put the jar file "Bcprov-jdk15on-1.48.jar". But this time i got the following error. com.itextpdf.text.exceptions.InvalidPdfException: class "org.bouncycastle.asn1.ASN1Primitive"'s signer information does not match signer information of other classes in the same package
score: 0
type: Comment

servlets
tags question: http://stackoverflow.com/q/26885557
tags question: http://stackoverflow.com/q/26906707
tags question: http://stackoverflow.com/q/26893139
tags question: http://stackoverflow.com/q/26972988
tags question: http://stackoverflow.com/q/26965184
tags question: http://stackoverflow.com/q/26897665
tags question: http://stackoverflow.com/q/26833848
tags question: http://stackoverflow.com/q/26885964
tags question: http://stackoverflow.com/q/26932676
tags question: http://stackoverflow.com/q/26949359
tags question: http://stackoverflow.com/q/26980868
tags question: http://stackoverflow.com/q/26847043
tags question: http://stackoverflow.com/q/26970495
tags question: http://stackoverflow.com/q/26888368
tags question: http://stackoverflow.com/q/26926782
tags question: http://stackoverflow.com/q/26899581
tags question: http://stackoverflow.com/q/26969846
tags question: http://stackoverflow.com/q/26954191
tags question: http://stackoverflow.com/q/26961600
tags question: http://stackoverflow.com/q/26857457
tags question: http://stackoverflow.com/q/26838036
tags question: http://stackoverflow.com/q/26951673
tags question: http://stackoverflow.com/q/26869026
tags question: http://stackoverflow.com/q/26914833
tags question: http://stackoverflow.com/q/26960809
tags question: http://stackoverflow.com/q/26931157
tags question: http://stackoverflow.com/q/26906939
tags question: http://stackoverflow.com/q/26916178
tags question: http://stackoverflow.com/q/26840112
tags question: http://stackoverflow.com/q/26846317
tags question: http://stackoverflow.com/q/26895264
tags question: http://stackoverflow.com/q/26851461
tags question: http://stackoverflow.com/q/26918098
tags question: http://stackoverflow.com/q/26849618
tags question: http://stackoverflow.com/q/26906534
tags question: http://stackoverflow.com/q/26984382
tags question: http://stackoverflow.com/q/26920116
tags question: http://stackoverflow.com/q/26862684
tags question: http://stackoverflow.com/q/26908910
tags question: http://stackoverflow.com/q/26989524
tags question: http://stackoverflow.com/q/26969773
tags question: http://stackoverflow.com/q/26977279
tags question: http://stackoverflow.com/q/26885210
tags question: http://stackoverflow.com/q/26848217
tags question: http://stackoverflow.com/q/26949915
tags question: http://stackoverflow.com/q/26959357
tags question: http://stackoverflow.com/q/26904005
tags question: http://stackoverflow.com/q/26836345
tags question: http://stackoverflow.com/q/26869639
tags question: http://stackoverflow.com/q/26875316
tags question: http://stackoverflow.com/q/26886785
tag name: servlets
tags question: http://stackoverflow.com/q/26900887
tags question: http://stackoverflow.com/q/26878737
tags question: http://stackoverflow.com/q/26922327
tags question: http://stackoverflow.com/q/26976063
tags question: http://stackoverflow.com/q/26947148
tags question: http://stackoverflow.com/q/26991298
type: Tag
tags question: http://stackoverflow.com/q/26968297
tags question: http://stackoverflow.com/q/26835645
tags question: http://stackoverflow.com/q/26969882
tags question: http://stackoverflow.com/q/26903492
tags question: http://stackoverflow.com/q/26955833
tags question: http://stackoverflow.com/q/26833056
tags question: http://stackoverflow.com/q/26932451
tags question: http://stackoverflow.com/q/26948254
tags question: http://stackoverflow.com/q/26912276
tags question: http://stackoverflow.com/q/26842081
tags question: http://stackoverflow.com/q/26954824
tags question: http://stackoverflow.com/q/26879358
tags question: http://stackoverflow.com/q/26855619
tags question: http://stackoverflow.com/q/26972343
tags question: http://stackoverflow.com/q/26898667
tags question: http://stackoverflow.com/q/26974875
tags question: http://stackoverflow.com/q/26851649
tags question: http://stackoverflow.com/q/26840176
tags question: http://stackoverflow.com/q/26834662
tags question: http://stackoverflow.com/q/26843106

http://stackoverflow.com/q/26971511
tagged with: web-services
tagged with: java
tagged with: jax-ws
has answer: http://stackoverflow.com/a/27053797
type: Question
has body: Using JAX-WS we have developed a WebService and unable to deploy on WebLogic 12c running on LINUX JAVA 64Bit. However, same WAR file is deployed on WebLogic 12c running on Windows 7 using JAVA 32Bit and it works perfect. Here are the infos. Please let us know where / what could have gone wrong from our side. Thanks in advance WebLogic Production Log ####&lt;Nov 17, 2014 3:50:36 PM MYT&gt; &lt;Info&gt; &lt;Deployer&gt; &lt;Host&gt; &lt;Managed1&gt; &lt;Module GetShipmentChargeDetails.war of application GetShipmentChargeDetails successfully transitioned from STATE_PREPARED to STATE_ADMIN on server Managed1.&gt; ####&lt;Nov 17, 2014 3:50:36 PM MYT&gt; &lt;Info&gt; &lt;ServletContext-/GetShipmentChargeDetails&gt; &lt;No Spring WebApplicationInitializer types detected on classpath&gt; &lt;Servlet: "ShipmentChargeWSServlet" failed to preload on startup in Web application: "GetShipmentChargeDetails.war". javax.xml.ws.WebServiceException: java.lang.NoClassDefFoundError: Could not initialize class com.company.scws.service.GetShipmentChargeDetails Error Message Web Service does not use any Spring related &lt;No Spring WebApplicationInitializer types detected on classpath&gt; Thanks in advance and appreciate any help/hint.
score: 0
answer count: 1
has title: Unable to deploy WebService in Weblogic 12c on LINUX
type: UnansweredQuestion

http://stackoverflow.com/comment/42329132
type: Comment
type: QuestionComment
has text: What is an 'SWT Web Application'? How is this code being accessed?
score: 0
comment on: http://stackoverflow.com/q/26887287

http://stackoverflow.com/a/26872011
score: 4
has body: You need to override the toString() method in your customer class. The toString() method is called whenever you try to print an object using println(). The default behavior of toString() in the Object class is to print the name of the class , an @ sign and a hascode for the object. That is what you are seeing. For example public String toString(){ return this.getFirstName(); }
type: Answer
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/42302585
answers question: http://stackoverflow.com/q/26871957

http://stackoverflow.com/comment/45872190
type: Comment
score: 0
has text: Hello @Alexander, which version of appengine are you using now? I'm facing the same issue...
type: AnswerComment
comment on: http://stackoverflow.com/a/27984305

http://stackoverflow.com/q/26928468
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has title: How to change detail band color when group changes?
upvote count: 1
has comment: http://stackoverflow.com/comment/42408145
tagged with: grouping
has comment: http://stackoverflow.com/comment/42405961
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42407049
tagged with: jasper-reports
tagged with: ireport
has body: I have a category and customer table as you seen below in my database: Then i want to make report from these tables and grouping by category id in jasper. this is my jrxml file: <?xml version="1.0" encoding="UTF-8"?> select c.cid as "CID", c.title, j.id, j.name, j.family from Jasper j join Category c on j.c_id = c.cid $F{CID} <topPen lineWidth="0.5"/> Jasper <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> ID <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> Name <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> Family <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> CID <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> Title <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> $F{ID} <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> $F{NAME} <topPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <bottomPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> $F{FAMILY} new Boolean($V{category_COUNT}.longValue() == 1 ? true : false) <topPen lineWidth="0.0"/> <leftPen lineWidth="0.0"/> <bottomPen lineWidth="0.0"/> <rightPen lineWidth="0.0"/> $F{CID} new Boolean($V{category_COUNT}.longValue() == 1 ? true : false) <topPen lineWidth="0.0"/> <leftPen lineWidth="0.0"/> <bottomPen lineWidth="0.0"/> <rightPen lineWidth="0.0"/> $F{TITLE} <leftPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> <leftPen lineWidth="0.5"/> <rightPen lineWidth="0.5"/> Result of this file is like this: But i want ti have result like this: How can i do that?
has answer: http://stackoverflow.com/a/26931737
score: 1

http://stackoverflow.com/q/26959011
has body: I want to make a HTTP request repeatedly and act on result. I start with public Observable&lt;NewsItem&gt; fetchItems(NewsFeed feed). One request gets a few news items but I decided to flatten it. The idea was to use Observable.interval() make the request multiple times, then combine resulting Observables into one. Observable .interval(timePerItem, TimeUnit.MILLISECONDS) .map(i -&gt; feed) .map(feed -&gt; fetchItems(feed)) .subscribe(result -&gt; System.out.println(result)); But the result is Observable&lt;Observable&lt;NewsItem&gt;&gt; not Observable&lt;NewsItem&gt;. How to marge them? I have found the marge() operator (RX-Java doc: Marge). But it does not seem to fit the use case. In previous version I used CompletableFuture&lt;List&lt;NewsItem&gt;&gt; fetchNewsItems() but I wasn't able to fit it into Observable chain.
accepted answer: http://stackoverflow.com/a/26961437
tagged with: rx-java
favorite count: 0
upvote count: 3
type: AnsweredQuestion
has title: How to chain asynchronous operations using Java RX Observable?
score: 3
has answer: http://stackoverflow.com/a/26961437
tagged with: java
type: Question
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26837913
has answer: http://stackoverflow.com/a/26838489
type: UnansweredQuestion
has body: I have an array that consist of 3 or more Person objects and I'm figuring out how to compare each of them to find the "best" youngest and tallest person. public class Person { private int age; private int height; public int Person( int age, int height ) { this.age = age; this.height = height; } public int getAge() { return age; } public int getHeight() { return height; } } In my implementation, I add the Person objects in an array like so: Array&lt;Person&gt; persons = new Array&lt;Person&gt;(); persons.add( new Person(28, 150) ); persons.add( new Person(38, 155) ); persons.add( new Person(18, 160) ); Given the array, how do I compare the persons object from an iterations? for( int i=0; i&lt;persons.size; i++ ) { Person person = persons.get(i); // compare age and height? }
has comment: http://stackoverflow.com/comment/42241026
has comment: http://stackoverflow.com/comment/42240940
tagged with: java
has answer: http://stackoverflow.com/a/26838026
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42240929
score: 0
has title: How to compare more than 3 objects?

http://stackoverflow.com/a/26899945
downvote count: 0
has body: Technically you can not do what you are asking. Like already mentioned you do need to use a try-catch statement, this is because when .parseInt() encounters an error it raises an exception, as the programmer you can "listen" for one of these exceptions and do things if it occurs. This is done with a try catch statement. Its not a hard concept and its very well documented, I've given an example below. //Must be declared outside of try block int index try{ index = Integer.parseInt(numberID) - 1; //Catches all NumberFormatExceptions but not other errors } catch(NumberFormatException e) { //Handle error here } If you were to do this: try{ int index = Integer.parseInt(numberID) - 1; } you couldn't use index outside of the try block because it will go out of scope after the try was completed because the variable was declared within the try. Sometimes this is fine but other times it is how you want it to behave.
score: 3
type: AcceptedAnswer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26899923
type: Answer
answers question: http://stackoverflow.com/q/26899923

http://stackoverflow.com/comment/42315115
type: AnswerComment
has text: Sure. Here is a tutorial on using layouts inside of layouts: http://www.higherpass.com/Android/Tutorials/Exploring-Android-Linearlayout-And-Relativelayout/ Just google "how to use relativelayout inside linearlayout" and a ton of things come up
type: Comment
comment on: http://stackoverflow.com/a/26878697
score: 0

http://stackoverflow.com/comment/42362098
has text: look at the start script of the tool and find the place to modify the -Xmx setting. The script seems to append the JVM_OPTION add the end. This results in duplicate -Xmx parameters and the one behind the class name will be ignored.
score: 0
comment on: http://stackoverflow.com/q/26905524
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42493678
type: AnswerComment
has text: I see, many many thanks for the complete answer! (now I am just strugling to make some key bidings haha)
type: Comment
comment on: http://stackoverflow.com/a/26978075
score: 0

http://stackoverflow.com/a/26862690
downvote count: 0
answers question: http://stackoverflow.com/q/26861848
type: Answer
accepted answer of: http://stackoverflow.com/q/26861848
upvote count: 3
has body: I just found the solution. For the WAR you need to add another class. I added mine into my config-package where the other configuration classes are. import org.springframework.security.web.context.*; public class MessageSecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer { } This is all you need to make it work. In this tutorial it is described: http://docs.spring.io/autorepo/docs/spring-security/3.2.x/guides/hellomvc.html#registering-spring-security-with-the-war
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/26889258
has title: How to reference an object and change its values
tagged with: java
linked to: http://stackoverflow.com/q/7629473
type: Question
has body: So i'm creating a tile based game and currently working on hovering on tiles i have the hovering sorted so that when you hover over an image it changes colour but i am stuck with how to remove the colour when the next tile is hovered upon. Tile previous; public void CheckHover() { for (Tile t : map.getTiles()) { if (t.IsMouseOver(screen.getMousePosition().x, screen.getMousePosition().y)) { t.setMouseOver(true); if (previous == null) { previous = t; } else { previous.setMouseOver(false); } } } } My code above does not quite work i believe it may be down to how i am referencing the object but if i am doing a for each loop how can i get object that is currently hovered and setMouseOver to false?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26889332
has answer: http://stackoverflow.com/a/26889423
type: UnansweredQuestion

http://stackoverflow.com/comment/42277335
score: 0
type: Comment
has text: Gotcha. In my `hibernate.config.xml` I have `<mapping resource="net/codejava/spring/model/User.hbm.xml"/>` - what would the resource attribute become now that `User.hbm.xml` is in `src/main/resources/`?
comment on: http://stackoverflow.com/a/26857709
type: AnswerComment

http://stackoverflow.com/q/26945192
has comment: http://stackoverflow.com/comment/42432990
has title: How to increment value for a specific key in a Map in java?
has answer: http://stackoverflow.com/a/26945220
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26945283
tagged with: dictionary
has body: In C++ if I declare a map like std::map m then I can increment the value for a specific key in the map in this way m[key]++ In Java I declare a map Map&lt;Integer, Integer&gt; m = new HashMap&lt;&gt;(); and I increment the value for a specific key in this way: m.put(key, m.get(key).intValue() + 1) My question: Is there any shortcut or better way to do this?
upvote count: 13
has comment: http://stackoverflow.com/comment/106580086
has answer: http://stackoverflow.com/a/60254580
has answer: http://stackoverflow.com/a/26945219
downvote count: 1
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26945245
accepted answer: http://stackoverflow.com/a/26945283
tagged with: java
has answer: http://stackoverflow.com/a/26945245
score: 12

http://stackoverflow.com/q/26880216
has answer: http://stackoverflow.com/a/26923792
favorite count: 0
tagged with: hibernate-validator
accepted answer: http://stackoverflow.com/a/26923792
tagged with: spring
possible better answer: http://stackoverflow.com/a/26880365
has answer: http://stackoverflow.com/a/26880365
has title: @NotEmpty not displaying customised exception message
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42321612
score: 1
tagged with: java
type: Question
answer count: 2
has body: I used @NotEmpty (hibernate validator) annotation on a variable. created messages.properties file where I put proper entry using "AnnotationName.objectName.variable=string_to_be_displayed". Still I get default error message "may not be null". In spring config servlet, also I binded messages.properties. But no success. please help. I tried many times. attaching screenshot of log Response body is :
downvote count: 0

http://stackoverflow.com/a/76354832
has body: It may happen because you didn't add spring web dependency so the IDE considers your application as Spring application not Spring boot
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26889970
score: 1
upvote count: 1

http://stackoverflow.com/a/26881703
upvote count: 2
has comment: http://stackoverflow.com/comment/42320093
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42319872
has comment: http://stackoverflow.com/comment/42320029
accepted answer of: http://stackoverflow.com/q/26881468
has comment: http://stackoverflow.com/comment/42320082
has comment: http://stackoverflow.com/comment/42319730
type: Answer
answers question: http://stackoverflow.com/q/26881468
has comment: http://stackoverflow.com/comment/42319980
has body: Aggregation is probably what you are looking for. With an aggregation operation your whole code runs on the database and can be performed in a few lines. Performance should also be a lot better since the database handles everything that needs to be done an can take full advantage of indexes and other stuff. From what you postet this boils down to a simple $group operation. In the shell this would look like: db.taxistationOfCollection.aggregate([ {$group: { _id: {station: "$TaxiStation", licence: "$TaxiLicense"}, count : {$sum : 1} } ]) This will give you documents of the form {_id : {station: stationid, licence: licence_number}, count: number_of_documents} For Java it would look like this: DBObject taxigroup = new BasicDBObject("$group", new BasicDBObject("_id", new BasicDBObject("station","$TaxiStation") .append("Licence","$TaxiLicense")) .append("count", new BasicDBObject("$sum",1))); AggregationOutput aggout = taxistationOfCollection.aggregate( Arrays.asList(taxigroup)); Please note that the code snippets are not tested.

http://stackoverflow.com/comment/42457862
has text: I am sorry Andrew , I forgot to add the main class. The code is edited now.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26955310
score: 0

activity-lifecycle
tags question: http://stackoverflow.com/q/26905138
tag name: activity-lifecycle
type: Tag

http://stackoverflow.com/comment/42497565
type: Comment
has text: if it is in Desktop/NewFolder etc do you specify those as well?
type: AnswerComment
comment on: http://stackoverflow.com/a/26981619
score: 0

http://stackoverflow.com/comment/42234211
has text: How would that work for larger numbers, such as 6 or 7 though? Wouldn't I still have the issue of finding all permutations of the numbers before that?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26833700
type: Comment

http://stackoverflow.com/q/26852525
tagged with: math
has comment: http://stackoverflow.com/comment/79450675
upvote count: 2
has answer: http://stackoverflow.com/a/26852593
has answer: http://stackoverflow.com/a/26852614
has comment: http://stackoverflow.com/comment/42267558
possible better answer: http://stackoverflow.com/a/26853510
favorite count: 0
tagged with: arithmetic-expressions
has answer: http://stackoverflow.com/a/26862388
downvote count: 5
score: -3
has answer: http://stackoverflow.com/a/26853510
has comment: http://stackoverflow.com/comment/42267536
answer count: 4
has body: I'm trying to calculate the average of the student scores and as it stands I'm struggling with the calculation part. In my assignment I was asked to caulculate the avg age of three students and avg. heigth of three students. Could someone please guide me in the last line of this code, I apologize for the newbie question, really stuck and cannot come up with any solution to why it's not calculating my numbers. public static void main(String[] args) { // this method will display the scores of students //variable declaration int JasperAge = 20; int JasperHeigth = (int) 175.5; int PaulaAge = 25; int PaulaHeigth = (int) 190.5; int NicoleAge = 18; int NicoleHeigth = (int) 165; //output Scanner output = new Scanner (System.in); System.out.println("Name\t "+ " Age\t " + " Height (cm)\t"); System.out.println("\n"); System.out.println("Jasper\t "+JasperAge+" \t "+JasperHeigth); System.out.println("Paula\t "+PaulaAge+" \t "+PaulaHeigth); System.out.println("Nicole\t "+NicoleAge+" \t "+NicoleHeigth); System.out.println("Average\t ((20 + 25 + 18) /3) \t ((175.5 + 190.5 + 165) /3)"); } }
tagged with: java
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42267552
accepted answer: http://stackoverflow.com/a/26852614
has title: Calculate Average Java

http://stackoverflow.com/comment/42358949
type: QuestionComment
type: Comment
has text: You want to show that one is better. The question is: better in what regard? Do you want your code fast, or easily to maintain, or hard to read, or compact, or what? Many of these criteria are mutually exclusive. There is no generic "better"
comment on: http://stackoverflow.com/q/26902645
score: 0

http://stackoverflow.com/comment/42476227
comment on: http://stackoverflow.com/q/26965506
has text: Both of them use old outdated (a)Smack libraries. One is even from 2008 (6 years old!).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/31690585
score: 0
type: Answer
has body: You need to change the ConnectionFactory via the weblogic admin console to create shareable connections Client ID Policy: CLIENT_ID_POLICY_UNRESTRICTED Subscription Sharing Policy:Sharable https://docs.oracle.com/cd/E57014_01/wls/WLACH/pagehelp/JMSjmsconnectionjmsconnectionfactoryconfigclientparamstitle.html
answers question: http://stackoverflow.com/q/26887584

http://stackoverflow.com/comment/42512918
has text: You should add proper synchronization if it is multithreaded.
score: 1
comment on: http://stackoverflow.com/a/26990735
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26847281
score: 0
has title: How can I sort objects?
has comment: http://stackoverflow.com/comment/42318385
has comment: http://stackoverflow.com/comment/42293958
has comment: http://stackoverflow.com/comment/42298839
tagged with: opengl-es-2.0
tagged with: android
has body: I'm trying draw some objects in an opengl world . these objects have transparency so. and when I rotate them the transparency doesn't blend color . How can I sort the draw order, so I can draw from more distant object to closest? I've tryed with bounding box and get the more distance point . then sort objects with a bubblesort. Then I give to Renderer the IndexArray sorted. This is Bounding box. public class BoundingBox extends java.lang.Object { private UlVertexBuffer mVb=null; private UlIndexBuffer mIb=null; private UlTransform mTransform=null; private UlVertexBuffer subsetVertexBuffer; private UlMatrix4x4[] mM=new UlMatrix4x4[2]; private float array[][]=new float[2][16]; private float minX,minY,minZ,maxX,maxY,maxZ=0; // min and max value of the vector components public BoundingBox (UlVertexBuffer vb, UlIndexBuffer ib) { FloatBuffer fb =(FloatBuffer) vb.getData(UlVertexBuffer.VERTEX_FIELD_POSITION).position(0); float [] fa = new float [fb.capacity()]; fb.get(fa); ShortBuffer sb = (ShortBuffer)ib.getData(); short [] sa = new short[sb.capacity()]; sb.get(sa); calcBox(fa,sa); mM[0]=new UlMatrix4x4(array[0]); mM[1]=new UlMatrix4x4(array[1]); } public void calcBox(UlVertexBuffer vb, UlIndexBuffer ib) { FloatBuffer fb =(FloatBuffer) vb.getData(UlVertexBuffer.VERTEX_FIELD_POSITION).position(0); float [] fa = new float [fb.capacity()]; fb.get(fa); ShortBuffer sb = (ShortBuffer)ib.getData(); short [] sa = new short[sb.capacity()]; sb.get(sa); calcBox(fa,sa); } public void calcBox(float[] vertexArray,short[] indexArray) { for(int j=0;j&lt;indexArray.length ;j++) { short i=(short) (indexArray[j]*3); if(vertexArray[i]&gt;maxX) { maxX=vertexArray[i]; } if(vertexArray[i]&lt;minX) { minX=vertexArray[i]; } if(vertexArray[i+1]&gt;maxY) { maxY=vertexArray[i+1]; } if(vertexArray[i]&lt;minY) { minY=vertexArray[i+1]; } if(vertexArray[i+2]&gt;maxZ) { maxZ=vertexArray[i+2]; } if(vertexArray[i+2]&lt;minZ) { minZ=vertexArray[i+2]; } } array[0][0]=minX; array[0][5]=minY; array[0][10]=minZ;…
answer count: 0
type: UnansweredQuestion
tagged with: bounding-box
type: Question
tagged with: java

http://stackoverflow.com/q/26914644
tagged with: spring-mvc
has body: For some reason, my pointcut is not triggered. Note: I am using spring-style aspects, not AspectJ style. XML snippet &lt;bean id="authenticationAspect" class="ssel.banking.security.AuthenticationAspect" /&gt; &lt;aop:config&gt; &lt;aop:aspect ref="authenticationAspect"&gt; &lt;aop:pointcut id="interceptControllerInvocation" expression="execution(* org.springframework.web.servlet.mvc.Controller+.handleRequestInternal(javax.servlet.http.HttpServletRequest, ..)) and args(request, ..) and target(controller)"/&gt; &lt;aop:around pointcut-ref="interceptControllerInvocation" method="authenticationAdvice"/&gt; &lt;/aop:aspect&gt; &lt;/aop:config&gt; Class defined by my bean import org.aspectj.lang.ProceedingJoinPoint; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; public class AuthenticationAspect { public ModelAndView authenticationAdvice(ProceedingJoinPoint pjp, HttpServletRequest request, Controller controller) throws Throwable{ String URL = request.getRequestURL().toString(); String viewName = URL.substring(0, URL.length() - 4); System.out.println(viewName); return (ModelAndView) pjp.proceed(); } } Am I missing something?
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42582631
has answer: http://stackoverflow.com/a/26915129
tagged with: aspectj
has title: Spring AOP pointcut not triggering
answer count: 1
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/a/26867348
has comment: http://stackoverflow.com/comment/42294779
has body: In Scene Builder, if the FXML file is associated to a controller class, you know that what makes the connection between the variable in the controller class (pb) and the object in the FXML file (&lt;ProgressBar ... /&gt;) is the value of the object's fx:id. So when you set an fx:id on an object, Scene Builder tries to parse the controller class trying to find a variable of that name. If it doesn't find any, it displays this warning. It's just a reminder that you may want to add such a variable to the controller class, or that you have to choose other valid name from a list. Since you have label defined on your controller, if you try to add a Label on Scene Builder, you can get its fx:id from the list: But if you assing another name, you will get the warning: On a side note, you don't need to instantiate the progress bar on the main class, since it will be instantiated in the controller. And ìf you try to link change(ActionEvent event) to a method in Scene Builder (#change), you have to annotate it with @FXML. Anyway, don't use onDragDetected with the slider.
has comment: http://stackoverflow.com/comment/42294888
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42294992
type: Answer
upvote count: 16
accepted answer of: http://stackoverflow.com/q/26865596
score: 16
answers question: http://stackoverflow.com/q/26865596

http://stackoverflow.com/a/26913495
has body: It may be tricky. But from a quick look at the source code, you might try some reflection. Disclaimer: Many things can go wrong when using reflection. You should be aware of the fact that you are relying on unspecified behavior here. If the underlying implementation changes, then the following example program might no longer work... ...although I consider this as "unlikely", at least The following is an example showing how this might work: import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class GraphicsEnvironmentTest { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { createAndShowGUI(); } }); } private static void createAndShowGUI() { JFrame frame = new JFrame("Demo get info screen devices"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton button = new JButton("Print info screen devices"); button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { printInfoAllScreenDevices(); } }); frame.add(button); frame.setSize(500, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); } private static void printInfoAllScreenDevices() { GraphicsDevice graphicsDevices[] = getGraphicsDevices(); System.out.println("Found "+graphicsDevices.length+" devices:"); for (int i=0; i&lt;graphicsDevices.length; i++) { System.out.println(graphicsDevices[i]); } } /** * Queries the local graphics environment for the available graphics * devices. This uses reflection internally. If anything goes wrong * with the reflective call, a RuntimeException will be thrown. * * @return The available graphics devices. * @throws RuntimeException If the reflective calls fail */ private static GraphicsDevice[…
score: 2
answers question: http://stackoverflow.com/q/26912360
downvote count: 0
type: Answer
upvote count: 2

http://stackoverflow.com/comment/42353761
score: 3
has text: https://docs.oracle.com/javase/tutorial/java/IandI/super.html Although it seems rather hacky what you're trying to do now. A subclass shouldn't hold a reference to the baseclass, that doesn't even make sense.
comment on: http://stackoverflow.com/q/26900655
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26840273
score: 0
type: Answer
has body: I think you could write a custom Comparator for your table.
answers question: http://stackoverflow.com/q/26840220

http://stackoverflow.com/a/26852204
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26852140
has body: Problem is nextInt() leaves "\n" in the stream and when next() executes in String Q2=s.next(); It reads "\n" and doesn't gives you an opportunity to input Question. Try this: System.out.println("How many true or false questions would you like to include in your quiz?"); int l=Integer.parseInt(nextLine()); TrueFalseQuestion[] qu2= new TrueFalseQuestion[l]; int x; for(x=0;x&lt;l;x++){ System.out.println("Please insert question "+(x+1)+":\n"); String Q2=s.nextLine(); System.out.println("Please insert the correct answer"); boolean A2=s.nextBoolean(); qu2[x]=new TrueFalseQuestion(Q2,A2); System.out.println(qu2[x].GetCorrectAnswer()); }

http://stackoverflow.com/a/26941389
accepted answer of: http://stackoverflow.com/q/26940295
upvote count: 2
answers question: http://stackoverflow.com/q/26940295
type: AcceptedAnswer
type: Answer
has body: When you have an action it is highly recommended that you'll encapsulate your code that actually does the job. In your case it's the db (call it DBThread). What will work for you so the button will not go unresponsive is to divide it in to 3 parts (sounds too much at first but it makes sense). So you'll have Action (that invokes the DBThreadProgress) DBThreadProgress (it's a thread that will have a join at the end and will invoke DBThread) DBThread (this is the job) So the DBThread as mentioned before is your business logic. The Action invokes a progress thread where you can put a gif image on your panel that shows that something is going in the background for the end user. This progressThread allows you also to wait until the DBthread is completed so you can advise the end users about the result. I usually set the button to setEnable(false) in the beginning and setEnable(true) so the user will know that he can't click twice. Hope this helps :-)
downvote count: 0
score: 2

http://stackoverflow.com/a/26990784
type: Answer
answers question: http://stackoverflow.com/q/26990610
upvote count: 2
has body: First of all sum=a[n-1]+findAvg(a,n-1); is wrong, since if findAvg(a,n-1) returns the correct average for the first (n-1) elements, the sum should be a[n-1] + (n-1) * findAvg(a,n-1). Second of all, you are losing precision when dividing integers in avg = sum/n; Consider using doubles.
score: 2
downvote count: 0

http://stackoverflow.com/q/26905805
type: Question
answer count: 2
has body: Imagine that we have a Java project with three different layers: UI (Swing), Service and DAO. The UI calls the Service, and the Service calls the DAO. In the UI we have a filter with a Calendar. When the search is run, the selected date (and time) in the calendar is sent as parameter to the service. The problem is that the time of this date needs to be formatted with the last second of the day (23:59:59), so this formating has to be done. First question, where do I have to format/change the date and the time. In the UI or in the Service? Because if I change it in the UI, I can reuse the service method for any date and time. But if I change it in the service, I would need a new method in the Service if the current time is needed instead of the last second of the day. And another thing, is a good idea to name the Service Layer as "Service" if exist this data transformation, or would be better to name as "Action Layer" or something like this?
score: 0
has answer: http://stackoverflow.com/a/26908246
tagged with: architecture
has title: In which layer should be map/change/format the data?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26963494
tagged with: java

http://stackoverflow.com/a/26927416
has comment: http://stackoverflow.com/comment/42401018
has comment: http://stackoverflow.com/comment/42401782
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26927301
type: Answer
answers question: http://stackoverflow.com/q/26927301
has comment: http://stackoverflow.com/comment/42400953
score: 1
has body: Use a map where you register your views with the given key: viewsMap.put("admin", admin_view); viewsMap.put("customer", customer_view); ... and then, just do: View view = viewsMap.get(accountType); if (view == null) { return error_view; } return view;
has comment: http://stackoverflow.com/comment/42401973

http://stackoverflow.com/comment/42506764
comment on: http://stackoverflow.com/a/26867401
has text: Do you have a parallel attribute set somewhere?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26851689
tagged with: java
possible better answer: http://stackoverflow.com/a/26851791
type: Question
has comment: http://stackoverflow.com/comment/42280401
has comment: http://stackoverflow.com/comment/42265892
answer count: 2
tagged with: onitemclicklistener
accepted answer: http://stackoverflow.com/a/26869177
has title: onItemClickListener how to have a fixed name for each item?
has comment: http://stackoverflow.com/comment/42296726
score: 0
tagged with: android-listview
has body: I am trying to make a listView that has an editText and when you type something it filters all the contents to the the names with that contains the text the user typed and then you press it to show more information about this name. The filter works fine but the since in the onItemClickListener each case is defined by it's number ex: case 0: .... break; case 1: .... break; case 2: .... break; when the user types something and the names get filtered, for example case 45 will become case 0 and it will open the information of the case 0 instead of case 45, so how can I have a fixed name for them like when in the onClick method when you type the id of the button. Thanks My code: final EditText inputSearch = (EditText) view.findViewById(R.id.inputSearch); list = (GridView) view.findViewById(R.id.gv); final ArrayAdapter&lt;String&gt; dataAdapter=new ArrayAdapter&lt;String&gt;(getActivity().getBaseContext(),R.layout.gridview_design,R.id.name, heartlessNames); list.setAdapter(dataAdapter); inputSearch.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s,int start,int before,int count){ updateText(); } @Override public void beforeTextChanged(CharSequence s,int start,int count,int after){ updateText(); } @Override public void afterTextChanged(Editable s){ updateText(); } private void updateText(){ dataAdapter.getFilter().filter(inputSearch.getText().toString()); } }); list.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position, long id) { switch(position){ case 0: sp.play(soundId, 1, 1, 0, 0, 1); startActivity(new Intent(getActivity().getBaseContext(), shadow.class)); getActivity().overridePendingTransition(R.animator.push_left_in, R.animator.push_left_out); break; case 1: sp.play(soundId, 1, 1, 0, 0, 1); startActivity(new Intent(getActivity().getBaseContext(), soldier_kh2fm.class)); getActivity().overridePendingTransition(R.animator.push_left_in, R.animator.push_left…
has comment: http://stackoverflow.com/comment/42290748
has comment: http://stackoverflow.com/comment/42265828
tagged with: android
has answer: http://stackoverflow.com/a/26869177
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26851791
has comment: http://stackoverflow.com/comment/42265978

http://stackoverflow.com/q/26929483
has body: I create 2 projects one is EJB and one is JPA. JPA project define entities classes, and persistent.xml. EBJ project import JPA project, I defined EJB session bean to connect database by entity manager. please refer below image for details. But when running on Jboss 7, error happend. 03:23:59,546 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.deployment.subunit."TestApps.ear"."TestEJB.jar".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."TestApps.ear"."TestEJB.jar".POST_MODULE: Failed to p rocess phase POST_MODULE of subdeployment "TestEJB.jar" of deployment "TestApps.ear" 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$Worker.runTask(Unknown Source) [rt.jar:1.6.0_22] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_22] at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_22] Caused by: java.lang.RuntimeException: Error getting reflective information for class com.ejb.services.LotUpdatManagerBean with ClassLoader ModuleClassLoader for Module "deployment.TestApps.ear.TestEJB.jar:main" from Service Module Loader at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58) at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:85) at org.jboss.as.ee.componen…
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42404734
score: 0
has answer: http://stackoverflow.com/a/26931443
has answer: http://stackoverflow.com/a/26931439
has comment: http://stackoverflow.com/comment/42405521
answer count: 3
has comment: http://stackoverflow.com/comment/42406872
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42406622
has answer: http://stackoverflow.com/a/26934469
has comment: http://stackoverflow.com/comment/42406734
type: Question
tagged with: jakarta-ee
tagged with: java
has title: How to deploy EJB project and JPA project in EAR project
tagged with: jboss

http://stackoverflow.com/comment/42408484
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26929537
has text: but can you tell me why it's known as an "identity function"? The word "identity" in the dictionary means `the condition of being oneself or itself, and not another`
type: AnswerComment

http://stackoverflow.com/comment/42233969
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26833224
has text: `currentNumberRow` and `currentNumberColumn` don't make sense to me. The way you're accessing the values in `array` seems pretty random; I'm not sure why `[i][j]` represents the value for row, and `[j][i]` represents the value for column. Also, returning an `int` will only allow you to return 1 value, so you won't be able to return which row AND column the error occured at; there are a few solutions around that. The for loop controls which row/column you're at. `j` and `i` are specifying the row and column, so i'm not sure why you need `currentNumberRow` and `currentNumberColumn`
score: 0

http://stackoverflow.com/comment/42244824
comment on: http://stackoverflow.com/a/26840047
score: 0
type: AnswerComment
type: Comment
has text: Can you please explain more in details ? I really tried a lot of visible ways to solve the problem, but got nothing at the moment. Maybe we can talk in skype, if you can for sure.

http://stackoverflow.com/a/26948979
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26948421
score: 1
has body: Do you need something like this? int size = 3; int values = 1; for (int i = 0; i &lt; size; i = i + 3) { int[] arr = new int[size]; for (int j = 0; j &lt; size; j++) { arr[j] = values; values++; } size += 3; int count = 0; for (int j : arr) { // for display ++count; System.out.print(j); if (count != arr.length) { System.out.print(" , "); } } System.out.println(); if (i &gt; 6) { // to put an end to endless creation of arrays break; } }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26948421

http://stackoverflow.com/comment/42445402
type: QuestionComment
has text: While there are some things logically not very understandable in the program, the compiler error is due to this line `circleArray[i] = max;` You have to declare `max` as `CircleWithPrivateDataFields` if you wish to assign it to the array.
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26952339

http://stackoverflow.com/q/26971908
tagged with: linux
score: 3
linked to: http://stackoverflow.com/q/11506321
has comment: http://stackoverflow.com/comment/42479794
has comment: http://stackoverflow.com/comment/42479930
upvote count: 3
has comment: http://stackoverflow.com/comment/42479746
type: UnansweredQuestion
tagged with: ping
type: Question
has comment: http://stackoverflow.com/comment/42479878
has answer: http://stackoverflow.com/a/26973627
has body: I want to ping an IP via Java. When I ping from command line and track the network packages I see ICMP requests. When I ping from my application and track the network packages I see TCP requests at port 7. I've checked the documentation of InetAddress.isReachable(): Best effort is made by the implementation to try to reach the host, but firewalls and server configuration may block requests resulting in a unreachable status while some specific ports may be accessible. A typical implementation will use ICMP ECHO REQUESTs if the privilege can be obtained, otherwise it will try to establish a TCP connection on port 7 (Echo) of the destination host. I can run sudo needed commands with the user that I run my Java application. Which privilege should be obtained for my purpose? What should I check? PS: I've asked this question at stackoverflow.com because of it is more related to Java problem(which Java source code requires to run) than a system problem.
tagged with: java
has comment: http://stackoverflow.com/comment/42488416
has title: Which Privilege Should be Obtained for ICMP Request at Java?
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42479674

http://stackoverflow.com/comment/42429410
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26929713
has text: @Piyush Gupta, Yes it is showing all the devices. I launched Nexus 4(4.7", 768 x 1280:xhdpi), but here in Memory Option: the RAM:1907, VM HEap: 64
score: 0

http://stackoverflow.com/comment/42448512
has text: I am trying to clone a maven project from git in eclipse
score: 0
comment on: http://stackoverflow.com/q/26948950
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42284439
type: Comment
has text: You can also go with `AOP` approach but it might be harder. http://stackoverflow.com/questions/25944259/logging-using-aop
type: AnswerComment
comment on: http://stackoverflow.com/a/26854112
score: 0

class
tags question: http://stackoverflow.com/q/26871310
tags question: http://stackoverflow.com/q/26895921
tags question: http://stackoverflow.com/q/26876279
tags question: http://stackoverflow.com/q/26862311
tags question: http://stackoverflow.com/q/26950218
tags question: http://stackoverflow.com/q/26833508
tags question: http://stackoverflow.com/q/26883240
tags question: http://stackoverflow.com/q/26905349
tags question: http://stackoverflow.com/q/26933066
tags question: http://stackoverflow.com/q/26954843
tags question: http://stackoverflow.com/q/26871653
tags question: http://stackoverflow.com/q/26964248
tags question: http://stackoverflow.com/q/26976929
tags question: http://stackoverflow.com/q/26921289
tags question: http://stackoverflow.com/q/26866233
tags question: http://stackoverflow.com/q/26980347
tags question: http://stackoverflow.com/q/26990428
tags question: http://stackoverflow.com/q/26976019
tags question: http://stackoverflow.com/q/26916200
type: Tag
tags question: http://stackoverflow.com/q/26984447
tags question: http://stackoverflow.com/q/26962198
tags question: http://stackoverflow.com/q/26932596
tags question: http://stackoverflow.com/q/26894590
tags question: http://stackoverflow.com/q/26864449
tags question: http://stackoverflow.com/q/26942635
tag name: class
tags question: http://stackoverflow.com/q/26855124
tags question: http://stackoverflow.com/q/26948953
tags question: http://stackoverflow.com/q/26855345
tags question: http://stackoverflow.com/q/26913451
tags question: http://stackoverflow.com/q/26900724
tags question: http://stackoverflow.com/q/26879050
tags question: http://stackoverflow.com/q/26949333
tags question: http://stackoverflow.com/q/26935422
tags question: http://stackoverflow.com/q/26852459
tags question: http://stackoverflow.com/q/26954045
tags question: http://stackoverflow.com/q/26852699
tags question: http://stackoverflow.com/q/26943958
tags question: http://stackoverflow.com/q/26940506
tags question: http://stackoverflow.com/q/26915440
tags question: http://stackoverflow.com/q/26975244
tags question: http://stackoverflow.com/q/26950512
tags question: http://stackoverflow.com/q/26887411
tags question: http://stackoverflow.com/q/26980855
tags question: http://stackoverflow.com/q/26966446

http://stackoverflow.com/a/31233008
has body: I haven't quite implemented/used jackcess yet. But to use External jars, like in eclipse you need to right click "JRE System Library" in your project. Build path >> Configure Build Path &amp; then use the Button "Add external JARs" to browse and finally import your jar file. Then you can create a program by the use of its classes &amp; methods, without any error of unknown class.
answers question: http://stackoverflow.com/q/26957920
type: Answer
score: 0

http://stackoverflow.com/a/26854685
score: 5
type: AcceptedAnswer
has body: There's probably better choices, but you could use something like... NumberFormat nf = NumberFormat.getNumberInstance(); nf.setMaximumFractionDigits(100); double x = 0.00000032d; System.out.println(x); System.out.println(nf.format(x)); Which outputs 3.2E-7 0.00000032 You might want to play around with the maximumFractionDigits property to you specific needs...
accepted answer of: http://stackoverflow.com/q/26854591
upvote count: 5
answers question: http://stackoverflow.com/q/26854591
type: Answer
downvote count: 0

http://stackoverflow.com/comment/42361113
type: Comment
score: 0
has text: Your catch clause is actually just swallowing the exception. It prints a message to the console and continues normal execution. You need to handle the exception in some way, or else declare in your method signature that an error is thrown
type: QuestionComment
comment on: http://stackoverflow.com/q/26904735

http://stackoverflow.com/comment/42513252
has text: @Sonam Check this link http://stackoverflow.com/questions/7057845/save-arraylist-to-sharedpreferences
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26990649
score: 0

http://stackoverflow.com/a/26952341
upvote count: 2
type: Answer
has body: It would be great if you described the error your clients are getting in more detail. Until then I'll wager a stab in the dark and say the client's locale is different than yours and your code is not locale independent. Maybe you used String#toLowerCase() and now everything crashes because your clients are Turkish. Or you overlooked that SimpleDateFormat is locale dependent. Edit: I'm almost entirely convinced that it is an error on my user's end I invite you to get rid of that conviction and assume a more humble stance towards your code. Because our skulls are so small.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26952057

http://stackoverflow.com/q/26878616
tagged with: tree-traversal
tagged with: traversal
has title: Traversing helper method for a Huffman tree
has comment: http://stackoverflow.com/comment/72475532
has answer: http://stackoverflow.com/a/26878865
answer count: 1
downvote count: 0
tagged with: huffman-code
favorite count: 0
has comment: http://stackoverflow.com/comment/42314229
tagged with: binary-search-tree
type: UnansweredQuestion
score: 2
upvote count: 2
has body: In this programming assignment, we must make a helper method called traverse that is called by getCodes(). It is a recursive method to traverse the Huffman Tree and add a Code record to the ArrayList for each leaf node in the tree. Any help is much appreciated I've been stuck on this for 3 hours now. /* This method returns an ArrayList of the codes in the Huffman Tree. * The Code class has a character and its corresponding encoding. In the * tree, left edges are designated as 0 and right edges as 1. * * DO NOT CHANGE THIS METHOD, but you need to write the traverse method. */ public ArrayList&lt;Code&gt; getCodes() { ArrayList&lt;Code&gt; code = new ArrayList&lt;Code&gt;(); if (root == null) return null; traverse(code, root.left, "0"); traverse(code, root.right, "1"); return code; } /* Recursive method to traverse the Huffman tree, and for each leaf node, * add a Code record to the ArrayList. */ private void traverse(ArrayList&lt;Code&gt; code, BinaryTreeNode&lt;Letter&gt; node, String prefix) { // TODO: Fill in this method // base case if(node==null) return; //else traverse the left then right if(node!=null){traverse(code,node.left, prefix);} if(node!=null){traverse(code,node.right,prefix);} code.add(node.getElement()); }
tagged with: java
type: Question

http://stackoverflow.com/comment/42360567
has text: No, add `scroll` to the frame, not `answer`. And a comment is not a good place for code. You can edit your original answer and add "I tried doing this... (code) and it didn't work", and then write a comment that says "I edited my question, please take a look".
comment on: http://stackoverflow.com/a/26904609
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42347327
has text: @pirate694 Sorry, I misunderstood. I thought you wanted to read digits from the file starting at a randomly-chosen point.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26896067
type: Comment

http://stackoverflow.com/a/28145774
has body: CandiedOrange is correct in his comment to your question. In other words, and given the method you mentioned, you should not worry about threadA calling the method at the same moment threadB is since both calls are writing to index. Had it been something like: void incrementIndex() { index++; System.out.println(index); // threadB might have written to index // before this statement is executed in threadA } threaA calls the method, increments index in the first statement, then attempts to read the value of index in the second statement, by which time threadB might have already made the call to the method and incremented index before threadA reads it and prints it. This is where synchronized is necessary to avoid such a situation. Now, if you still want to test synchronization, and you have access to the method code (or maybe you can do a similar prototype), you may consider something like the following that illustrates how multithreading behaves with synchronized methods: public void theMethod(long value, String caller) { System.out.println("thread" + caller + " is calling..."); System.out.println("thread" + caller + " is going to sleep..."); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println("thread" + caller + " woke up!"); } This should output: threadA is calling... threadA is going to sleep... threadA woke up! threadB is calling... threadB is going to sleep... threadB woke up! Without the synchronized keyword, the output be: threadA is calling... threadA is going to sleep... threadB is calling... threadB is going to sleep... threadA woke up! threadB woke up!
answers question: http://stackoverflow.com/q/26967036
type: Answer
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/a/26989495
type: Answer
has comment: http://stackoverflow.com/comment/42511851
has comment: http://stackoverflow.com/comment/42511428
has comment: http://stackoverflow.com/comment/42513364
has comment: http://stackoverflow.com/comment/42511040
answers question: http://stackoverflow.com/q/26989359
has comment: http://stackoverflow.com/comment/42511716
has body: R.java is an auto generated file when you build an android application. It contains unique identifiers (normally 32bit numbers) for elements in each category (drawable, string, layout, color, etc.) of resources (elements under directory res) available in your android application. The main purpose of R.java file is quick accessibility of resources in the project. If any resource has deleted or added to the project, R.java file will be updated automatically, this can be done by ADT plugin in Eclipse. The ADT plugin in Eclipse will give you a warning if you try to modify this R.java file. Even if you modified this file, it may result into unknown output of your application. What is the solution when R.java file is not created ? Whenever you saw no R.java file in gen directory and you are getting errors like R cannot be resolved to a variable, first you have to check any errors with ****.xml files in your project and fix all the errors with xml files, next you have to clean the entire project. Almost you will fix this problem with these 2 tasks. Even after these 2 steps, if you are not getting R.java file it may be problem with ADT plugin (I didn't faced this problem but I heard some people are saying we are not able to get R.java file after these 2 steps also). Sometimes you will get errors like main cannot be resolved or is not a field in code setContentView(R.layout.main); when the class R has included in your project like import android.R;. Remove this import statement from your project to avoid such errors.
score: 0
has comment: http://stackoverflow.com/comment/42512800
has comment: http://stackoverflow.com/comment/42511663

http://stackoverflow.com/a/26892597
type: Answer
has body: This does the trick. String newString = "Whoa!"; String lastString; public void action_Clicked(View view){ switch(view.getId()){ case R.id.button1: exchange(); break; } } private void exchange(){ lastString = text.getText().toString(); text.setText(newString); newString = lastString; }
score: 0
answers question: http://stackoverflow.com/q/26891941

http://stackoverflow.com/q/26864420
answer count: 1
has body: I'm trying to load data in a JTable from a SQL srv. I'm experiencing trouble when trying to convert the ArrayList and loading it in to the JTable. When I try the code below the table that should show the list is showing "[L].java.lang.String@bf053f" private void searchCourseGrades() { StudentsWithGradeTable.setModel(dtmCoursesGrades); String ccode = SearchCidTextfield.getText(); try { dtmCoursesGrades.setDataVector( controller.findAllStudentsFromStudied(ccode), coursesGradesColumns); if (ccode.equals("")) { JOptionPane.showMessageDialog(this, "Please enter a Course Code"); } else { dtmCoursesGrades.setRowCount(0); dtmCoursesGrades.fireTableDataChanged(); Studied findStudentFromStudied = null; findStudentFromStudied = controller .findCourseFromStudied(ccode); String[] crsgr = new String[2]; for (int i = 0; i &lt; crsgr.length; i++) { crsgr[0] = findStudentFromStudied.getSpnr(); crsgr[1] = findStudentFromStudied.getGrade(); dtmCoursesGrades.addRow(new Object []{crsgr}); dtmCoursesGrades.fireTableDataChanged(); } } } catch (SQLException exception) { JOptionPane.showMessageDialog(this, "Cannot find a course with Course Code " + ccode + ". Please try a new number."); } } The controller that the MainForm refers to looks like this: private String[][] finishedArrayList(ArrayList&lt;Studied&gt; finished) { String[][] finishedStudents = new String[finished.size()][3]; for (int i = 0; i &lt; finished.size(); i++) { Studied finish = finished.get(i); finishedStudents[i][0] = finish.getSpnr(); finishedStudents[i][1] = finish.getCcode(); finishedStudents[i][2] = finish.getGrade(); } return finishedStudents; } public String[][] findAllStudentsFromStudied(String ccode) throws SQLException { return finishedArrayList(dal.findAllStudentsFromStudied(ccode)); and the DAL that the controller refers to looks like this: public ArrayList&lt;Studies&gt; findAllStudentsFromStudies(String ccode) throws SQLException { ArrayList&lt;Studies&gt; stlist = new ArrayList&lt;Studies&gt;(); Statement st…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42289754
has title: ArrayList to JTable
has answer: http://stackoverflow.com/a/26865344
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/42288381
tagged with: java
tagged with: arraylist
tagged with: jtable
score: 0
tagged with: sql

http://stackoverflow.com/q/26855124
type: Question
has body: im having trouble understanding classes and how constructors work . (this is in java) I have to create a class called Complex that manipulates the complex numbers and this class is going to have the variables realPart and ImaginaryPart type double. now if c1 and c2 are objects of type Complex then if i do c1.add(c2) it should return Complex object that is the sum of the two objects. however this is the part where im stuck at i dont know how to add this two numbers? So far i have done this: public static void main(String[] args) { Complex c1 = new Complex(2, 8); Complex c2 = new Complex(2.3, 5.4); Complex c3 = c1.add(c2); Complex c4 = Complex.add(c1,c2); } } class Complex { private double realPart; private double imaginaryPart; public Complex() { } public Complex(double c1, double c2) { realPart = c1; imaginaryPart = c2; } public void setValue(int numberOne) { realPart = numberOne; } public Complex add(Complex other) { Complex result = new Complex(); this.realPart = 3; return result; } public Complex subtract(Complex other) { Complex result = new Complex(); this.realPart = 5; return result; } public String toString() { return c1.add(c2); } }
downvote count: 0
has answer: http://stackoverflow.com/a/26855177
tagged with: class
accepted answer: http://stackoverflow.com/a/26855167
answer count: 3
possible better answer: http://stackoverflow.com/a/26855177
favorite count: 0
tagged with: constructor
has title: trouble understanding classes objects and constructors
upvote count: 1
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/26855167
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26855194
tagged with: methods

http://stackoverflow.com/comment/42495864
type: QuestionComment
has text: Don't use [magic numbers](http://stackoverflow.com/questions/47882/what-is-a-magic-number-and-why-is-it-bad).
comment on: http://stackoverflow.com/q/26980798
score: 0
type: Comment

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/26835655
tags question: http://stackoverflow.com/q/26890307
tag name: csv
tags question: http://stackoverflow.com/q/26883839
tags question: http://stackoverflow.com/q/26905278
tags question: http://stackoverflow.com/q/26964473
tags question: http://stackoverflow.com/q/26946212
tags question: http://stackoverflow.com/q/26972966
tags question: http://stackoverflow.com/q/26957069
tags question: http://stackoverflow.com/q/26915473
tags question: http://stackoverflow.com/q/26976480

http://stackoverflow.com/comment/42494932
type: AnswerComment
has text: Awesome! I'll download the new version and have a look! :)
comment on: http://stackoverflow.com/a/26978295
type: Comment
score: 0

http://stackoverflow.com/comment/42502056
type: QuestionComment
type: Comment
has text: Could be what you're looking for is a splash screen. See http://stackoverflow.com/questions/5018069/splash-screen-while-loading-resources-in-android-app
comment on: http://stackoverflow.com/q/26983484
score: 0

http://stackoverflow.com/a/26868554
accepted answer of: http://stackoverflow.com/q/26868431
answers question: http://stackoverflow.com/q/26868431
has body: This isn't possible. If a class is a B, then it offers a foo(Integer) method. C does not do this, and so cannot be used as a B. Trying to read between the lines, it seems like you want something that acts like a B, except it takes Strings instead of Integers. In this case, A is the common bond - you want something with a foo method for whatever type is appropriate. And when you want a string-based equivalent of B, you're really looking for an A&lt;String&gt;, and C can do this job. A simple definition might be: class C extends A&lt;String&gt; { private final B delegate; // Set up in constructor or whatever public void foo(String input) { //.. convert int to string delegate.foo(Integer.valueof(input)); } }
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/42321423
has comment: http://stackoverflow.com/comment/42316772
score: 3
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42447805
type: Comment
has text: @sam_rox You're very much welcome. I'm glad that a full solution came about. Always a pleasure. Edit: Seems the other messages were deleted, too many comments. Deleted by a moderator probably.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26948653

http://stackoverflow.com/q/26927825
tagged with: gson
has comment: http://stackoverflow.com/comment/42401907
downvote count: 0
type: UnansweredQuestion
score: 3
tagged with: generics
favorite count: 0
type: Question
tagged with: android
answer count: 1
has body: Can anyone suggest how given code could possibly result in such issue, giving occasional ClassCastException when data is parsed from file. Details : I have a generic methods in superclass. public T getItem(int position) { return mItems.get(position); // mItems is an ArrayList } // corresponding setter public void setItems(List&lt;T&gt; items) { mItems = items; notifyDataSetChanged(); } It is then used in subclass with T = AdItem as below : AdItem adItem = getItem(position); Everything works fine, but I got occasional production crash reports with exception at the above mentioned line: java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to .mypackage.AdItem which obviously indicates that list contains LinkedTreeMap instead of AdItem The list is parsed from json, and the code is type safe, i.e. no raw type casting, unchecked warnings, etc. What are scenarios for ArrayList&lt;AdItem&gt; to contain LinkedTreeMap objects runtime ? Except for explicit unchecked/raw-type casting to Object and back to ArrayList which is not the case. Parsing json from file : ArrayList&lt;AdItem&gt; tempList = gson.fromJson(jsonReader, typeToken.getType()); where typeToken = new TypeToken&lt;ArrayList&lt;AdItem&gt;&gt;() {}; so tempList should only contain AdItem. Can anyone explain how ClassCastException could possibly happen with the code above ? Any extra details will be provided on request.
has answer: http://stackoverflow.com/a/26929042
upvote count: 3
tagged with: java
has title: ArrayList contains wrong type objects without explicit raw-type casting
tagged with: type-safety

http://stackoverflow.com/comment/42467911
type: Comment
type: QuestionComment
has text: I would ask the same questions as @DavidWallace has asked. Also just for the sake of curiosity why aren't you using built in LinkedList class to maintain list of years?
comment on: http://stackoverflow.com/q/26965136
score: 0

http://stackoverflow.com/q/26946592
score: -1
has answer: http://stackoverflow.com/a/26946618
answer count: 3
has title: Scanner not stopping from reading input
favorite count: 0
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/26946883
possible better answer: http://stackoverflow.com/a/26946618
type: AnsweredQuestion
tagged with: java
has body: I have a program which reads strings from the console and stores the strings in random indexes of a String array. But the problem is that the program continuously asks to input and its not stopping. This is my program. private static Scanner sc; public static void main(String[] args) { String[] arr = new String[10]; sc = new Scanner(System.in); String line; Random rn = new Random(); for(int x = 0; x &lt; 10; x++) { line = sc.nextLine(); System.out.println(line); int i = rn.nextInt(9); while(arr[i] != null) { i = rn.nextInt(9); } arr[i] = new String(line); } for(int x = 0; x &lt; 10; x++) { System.out.println(arr[x]); } sc.close(); } Also after 10 inputs System.out.println(line); after the reading is also not printing. Can anyone help me in finding the problem with my program.
has answer: http://stackoverflow.com/a/26946635
downvote count: 1
accepted answer: http://stackoverflow.com/a/26946635
type: Question
upvote count: 0

http://stackoverflow.com/q/26916193
has body: This is what I currently have This is what I want to achieve Here is the xml layout <Spinner android:id="@+id/spnShapes" android:layout_height="wrap_content" android:layout_width="wrap_content" /> <CheckBox android:text="Fill" android:id="@+id/chkFill" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageView android:clickable="true" android:id="@+id/slideHandleButton" android:layout_width="wrap_content" android:scaleType="fitCenter" android:adjustViewBounds="true" android:src="@drawable/ic_buttonnav" android:layout_height="fill_parent" android:background="@drawable/background_buttonnav"/> </SlidingDrawer> Here is the background_containernav.xml <solid android:color="#878787"/> <solid android:color="#fefefe"/> What should I do to achieve to the latter? Thank you very much.
tagged with: java
type: Question
tagged with: templating
has title: android - overlap the shadow by a button
score: 0
has comment: http://stackoverflow.com/comment/42381527
tagged with: android
has comment: http://stackoverflow.com/comment/42382394
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/26874410
score: 2
has comment: http://stackoverflow.com/comment/42306616
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26867840
has body: Ciphertext and keys should both consist of random bytes. Neither one of them can be represented 1:1 with a string. Not all bytes may represent valid encodings for a specific character-encoding. Instead you should use byte arrays directly. If you require actual text, use either hexadecimals or base 64 encoding. Your code using ciphertext as bytes and a key specified in hexadecimals: import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.security.Key; import java.security.KeyFactory; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.SecureRandom; import java.security.Signature; import java.security.spec.EncodedKeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import codec.Hex; public class Pgm { public static void main(String[] args) { try { KeyPairGenerator dsa = KeyPairGenerator.getInstance("DSA"); SecureRandom random = new SecureRandom(); dsa.initialize(1024, random); KeyPair keypair = dsa.generateKeyPair(); PrivateKey privateKey = (PrivateKey) keypair.getPrivate(); byte[] key = Hex.decode("000102030405060708090A0B0C0D0E0F"); Key aesKey = new SecretKeySpec(key, "AES"); Cipher cipher = Cipher.getInstance("AES"); String currentDir = System.getProperty("user.dir"); // encrypt the text cipher.init(Cipher.ENCRYPT_MODE, aesKey); byte[] abc = privateKey.getEncoded(); byte[] encrypted = cipher.doFinal(abc); // System.out.println("len="+encrypted.length()); File dir = new File(currentDir); File private_file = new File(dir, "privatekey.txt"); if (!private_file.exists()) { private_file.createNewFile(); } FileOutputStream fileos = new FileOutputStream(private_file); ObjectOutputStream objectos = new ObjectOutputStream(fileos); objectos.writeObject(encrypted); objectos.close(); fileos.close(); File …
answers question: http://stackoverflow.com/q/26867840
upvote count: 2
has comment: http://stackoverflow.com/comment/42324600
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42448278
comment on: http://stackoverflow.com/q/26953956
score: 0
type: Comment
type: QuestionComment
has text: *"whole code"* No, that's an uncompilable code snippet, not that we really want the 'whole code'. For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example).

http://stackoverflow.com/a/26991720
upvote count: 19
has body: There are two kinds of custom controls in JavaFX: fx:root based custom controls: These custom controls are styleable (support CSS), but are not skinnable. If you're an application developer, this is what you want to use most of the time. This kind of controls are usually application or organization specific. Additional custom skins for these controls are not needed, CSS is enough. Usually they just group some controls together and provide a nicer API and hide the internals. They are much easier to write than skinnable custom controls. I'm thinking of this as an alternative of the JPanel subclasses in the Swing-world. I suggest to break down your GUI into small self-contained fx:root based controls (high cohesion, low coupling). Use the Mediator Pattern to combine these controls (the parent control manages/ configures its child controls and listens to the events of its child controls. The child controls don't know about each other). You can create whole hierarchies of such controls. Breaking them down into small controls will make maintenance easier (e.g. if the layout or the user interaction has to change). skinnable custom controls: skinnable custom controls are not only styleable (via CSS) but their look and feel can be changed completely by providing a custom skin. If you're a controls library developer then most likely you want to provide skinnable custom controls to allow the users of the library to get most out of JavaFX. This kind of controls are usually very basic, highly reusable controls and often (but not always) use some custom painting as well. They are harder to get right than fx:root based custom controls.
answers question: http://stackoverflow.com/q/26983381
has comment: http://stackoverflow.com/comment/42535884
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26983381
score: 19
has comment: http://stackoverflow.com/comment/42522666

http://stackoverflow.com/comment/42363120
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26905349
score: 0
has text: Andrew Thompson, was busy, sorry about the fonts. All done. And with the multiple JFrames, I have read that topic 5+ times already. Basically, I want DIFFERENT JFrames, as in my code, I use Types.java as an enum to pick my different TYPES of frames. The frame is completely different each time due to the use of different components and sizing. I understand exactly what your saying though.

http://stackoverflow.com/q/26888599
tagged with: pixel
tagged with: java
tagged with: image
type: Question
accepted answer: http://stackoverflow.com/a/26889043
has body: I want to colour every black pixel in my image with the color the previous pixel had. And if there are 2 or more consecutive black pixels, the colour of the last non-black pixel is taken. I figured out how to iterate through pixels but the pixels won't change their colour. I think I miss the "save changes" line. Here the code: public static void iteratePixels() throws IOException { File file = new File("C:\\blackDots.png"); BufferedImage image = ImageIO.read(file); int lastNotBlack = -1; int actualColour = 0; for (int x = 0; x &lt; image.getHeight(); x++) { for (int y = 0; y &lt; image.getWidth(); y++) { int black = -16777216; try { actualColour = image.getRGB(x, y); } catch (Exception e) { continue; } if(image.getRGB(x, y)==black){ image.setRGB(x, y, lastNotBlack); System.out.println("black pixel at: " +x +" "+y); } if (actualColour != black){ lastNotBlack= actualColour; } } } } So how do I appy the changes ? Or is there another mistake?
answer count: 1
has title: Parsing Image in Java with different actions for different pixel colours
score: 0
has answer: http://stackoverflow.com/a/26889043
tagged with: javax.imageio
type: AnsweredQuestion

http://stackoverflow.com/q/26837677
type: Question
has comment: http://stackoverflow.com/comment/42240601
score: 1
has body: I've been scratching my head over why Java will go beyond a specified condition in some loops, while seemingly adhering to the condition in other loops. I know it's a lack of understanding on my part, but I'm confused as to when I should go over or adhere to the condition when I'm manually calculating code. As an example, I've put in a short for loop which has an end result of 15 in iTotal, and 0 in iNumber. When I originally did the calculation on paper step by step, I ended up with the answers of 14 in iTotal, and 1 in iNumber. I assumed that the code would not go below one, as the condition was greater than zero, not equal to or greater than zero. My original attempt - iTotal 0 5 9 12 14 iNumber 5 4 3 2 1 int iTotal = 0; for (int iNumber = 5; iNumber &gt; 0; iNumber--) iTotal = iTotal + iNumber; In comparison, the below code snippet will at 19 with a condition of less than 20, with the last statement being value of x : 19. I calculated that correctly, but I'm not sure why the above code ignores the condition and goes to zero, while the below code adheres to the condition and stops at 19. for(int x = 10; x &lt; 20; x = x+1) { System.out.print("value of x : " + x); System..out.print(num2 + " " + num1); Could anyone clarify how java interprets when to go over or stop at specified conditions?
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26837778
possible better answer: http://stackoverflow.com/a/26837751
has title: Loops in Java not adhering to the condition?
upvote count: 2
has answer: http://stackoverflow.com/a/26837751
downvote count: 1
type: AnsweredQuestion
tagged with: math
tagged with: java
has answer: http://stackoverflow.com/a/26837759
has answer: http://stackoverflow.com/a/26837778
tagged with: loops
has comment: http://stackoverflow.com/comment/42659701

http://stackoverflow.com/comment/42495884
has text: Hi add an subtract hours were fixed by this locale, but I have a new case. Maybe you have a suggestion for this too. When I add 2 hours from 00:00:00 at 2014-10-26 I get 2:00. So far so good. But when I add 3 hours to 00:00:00 I also get 2:00. Think it is indeed winter or summer time.
comment on: http://stackoverflow.com/a/26979737
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42401719
score: 0
comment on: http://stackoverflow.com/a/26927495
type: Comment
has text: The exception that occurs is "illegal operation on empty set". I guess this occurs because I am calling this method from another jFrame and therefore the textfields for username and password are not being read. Any tips on how to get around this?
type: AnswerComment

http://stackoverflow.com/comment/42389942
score: 2
comment on: http://stackoverflow.com/a/26898271
type: AnswerComment
has text: @Jamiex304: Consider refactoring your code to both simplify it, and to break it down into separately testable units. Right now you've got at least one very large and complex class, and this makes it very hard to debug and to isolate errors. If I have time, I'll try to take more views of it this coming weekend. Consider posting a jar of the whole current app + images and other resources to a code share site.
type: Comment

http://stackoverflow.com/comment/42411247
has text: I would expect the `AnnotationBeanNameGenerator` to take care of this, its the reason why I am using it!...although I suppose it won't know whats in the child context at the time!
type: AnswerComment
comment on: http://stackoverflow.com/a/26933120
score: 0
type: Comment

http://stackoverflow.com/comment/42413989
type: Comment
comment on: http://stackoverflow.com/q/26933727
type: QuestionComment
has text: JDBC and ODBC are two completely separate tech stacks.
score: 1

http://stackoverflow.com/comment/42316655
has text: I see. Thanks. How about if I had an array of: 5, 6, 10, 3, 9, 11 and i want to compare pos1 with pos 2 and if it is greater, i swap, and if it isn't i will not swap.... I will write it up, i think i can get that now, since i got this!
type: Comment
comment on: http://stackoverflow.com/a/26880022
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42511637
comment on: http://stackoverflow.com/q/26974875
score: 0
type: Comment
type: QuestionComment
has text: Session clustering solutions exist like here with Tomcat : http://tomcat.apache.org/tomcat-8.0-doc/cluster-howto.html and it use native "Manager" inside. JBoss also provide @Clustered specific EJB extension ( see here : https://docs.jboss.org/author/display/AS71/Clustered+EJBs ). All those solutions are non-interoperable because Java EE standards does not provide solution when the thing is "managed-out-of-the-jvm" itself. That's for why I think to continue with studying "Manager" and "Session" native interfaces provided by Tomcat, because I don't see other solutions. Thanks

http://stackoverflow.com/comment/42413375
type: QuestionComment
score: 0
has text: Can you please print both sets inside methods, I have tried at my end it's working fine.
comment on: http://stackoverflow.com/q/26934116
type: Comment

http://stackoverflow.com/q/26966960
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42472160
tagged with: spring
tagged with: design-patterns
has title: Best way to run two task independently.
has body: What is the best way run two block of code independently and join before third block. Actually I m planning to design custom java based work flow. And my requirement is to run two process independently and join at third process. I don't want to create thread manually and join on it. Any help is appreciated.
has comment: http://stackoverflow.com/comment/42471074
has comment: http://stackoverflow.com/comment/42472130
tagged with: java
has comment: http://stackoverflow.com/comment/42470960
downvote count: 3
has comment: http://stackoverflow.com/comment/42471029
type: Question
has answer: http://stackoverflow.com/a/26967330
has comment: http://stackoverflow.com/comment/42472367
answer count: 1
score: -1
has comment: http://stackoverflow.com/comment/42470944
favorite count: 0
has comment: http://stackoverflow.com/comment/42470903

http://stackoverflow.com/comment/117141002
comment on: http://stackoverflow.com/a/33429996
has text: @Erfankam - When sending a request you always receive a response (perhaps with empty body). Thus the advice given by Kiran is not that bad.
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/42340263
type: AnswerComment
has text: ok so your tf is not initialized. this will be really helpful to put in your actual question.
comment on: http://stackoverflow.com/a/26892142
score: 0
type: Comment

http://stackoverflow.com/comment/42402740
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26928282
score: 0
has text: It is hard to answer without all code. In this example everything seems ok.

http://stackoverflow.com/q/26861011
answer count: 3
possible better answer: http://stackoverflow.com/a/50018830
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26861186
score: 52
linked to: http://stackoverflow.com/q/23590746
upvote count: 52
tagged with: android
has answer: http://stackoverflow.com/a/58827791
has title: Android compile error; Java plugin has been applied, not compatible with android
type: AnsweredQuestion
tagged with: java
tagged with: gradle
tagged with: wear-os
type: Question
linked to: http://stackoverflow.com/q/24620772
has answer: http://stackoverflow.com/a/26861186
has answer: http://stackoverflow.com/a/50018830
has body: So I've made a wearable application where I can control a robot-car with the buttons on screen with the MessageListenerService. After trying to build the project, I had some problems where it asked me to install "Android Support Repository" from the SDK, which I already had. I found another similar problem on SO (link) which had a sort-of solution, but now it says "Error: The java Plugin has been applied, but it is not compatible with the Android Plugins" This is my build.gradle in my wearable module apply plugin: 'com.android.application' apply plugin: 'java' sourceCompatibility = JavaVersion.VERSION_1_6 //these two lines targetCompatibility = JavaVersion.VERSION_1_6 //are the only ones that matter android { compileSdkVersion 20 buildToolsVersion "20.0.0" compileOptions { sourceCompatibility JavaVersion.VERSION_1_6 targetCompatibility JavaVersion.VERSION_1_6 } signingConfigs { release { keyAlias 'C:\\Users\\Riekelt\\coolie.jks' keyPassword 'cut-out' storeFile file('path/to/release.keystore') storePassword 'cut-out' } } defaultConfig { applicationId "robowheel.robond" minSdkVersion 20 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' signingConfig signingConfigs.release } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.support:wearable:+' compile "com.android.support:support-v4:20.0.+" compile 'com.google.android.gms:play-services-wearable:+' // compile 'com.google.android.gms:play-services-wearable:6.1.11' } Anyone know what is the matter? Thanks in advancoi

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/26932497

http://stackoverflow.com/comment/42265101
comment on: http://stackoverflow.com/q/26847848
score: 0
type: Comment
type: QuestionComment
has text: The `List` order matches the XML order, this means what you are describing should never occur on an unmarshal. You have tagged your question with `hyperjaxb`, is it possible the difference in order is based on the results from the database instead?

http://stackoverflow.com/a/26880737
has body: Your problem is here, eliminateDuplicates: if (numberList[i] != numberList[i+1]) {// i+1, for the last elements raise the exception
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26880696

http://stackoverflow.com/comment/42498259
type: QuestionComment
has text: @jtahlborn Changed it to remaining() and It still says sending out 374 bytes
comment on: http://stackoverflow.com/q/26981232
score: 0
type: Comment

sockets
tags question: http://stackoverflow.com/q/26983165
tags question: http://stackoverflow.com/q/26950919
tags question: http://stackoverflow.com/q/26852282
tags question: http://stackoverflow.com/q/26868168
tags question: http://stackoverflow.com/q/26837749
tags question: http://stackoverflow.com/q/26892717
tags question: http://stackoverflow.com/q/26841380
tags question: http://stackoverflow.com/q/26943869
tags question: http://stackoverflow.com/q/26888395
tags question: http://stackoverflow.com/q/26959450
tags question: http://stackoverflow.com/q/26931468
tags question: http://stackoverflow.com/q/26838101
type: Tag
tags question: http://stackoverflow.com/q/26865767
tags question: http://stackoverflow.com/q/26848376
tags question: http://stackoverflow.com/q/26910019
tags question: http://stackoverflow.com/q/26946344
tags question: http://stackoverflow.com/q/26867134
tags question: http://stackoverflow.com/q/26847471
tags question: http://stackoverflow.com/q/26907085
tags question: http://stackoverflow.com/q/26989469
tags question: http://stackoverflow.com/q/26870250
tags question: http://stackoverflow.com/q/26859994
tags question: http://stackoverflow.com/q/26840048
tags question: http://stackoverflow.com/q/26915620
tags question: http://stackoverflow.com/q/26987071
tags question: http://stackoverflow.com/q/26922960
tags question: http://stackoverflow.com/q/26883688
tags question: http://stackoverflow.com/q/26988607
tags question: http://stackoverflow.com/q/26914404
tag name: sockets
tags question: http://stackoverflow.com/q/26909528
tags question: http://stackoverflow.com/q/26937100
tags question: http://stackoverflow.com/q/26832603
tags question: http://stackoverflow.com/q/26884531
tags question: http://stackoverflow.com/q/26947559
tags question: http://stackoverflow.com/q/26916392
tags question: http://stackoverflow.com/q/26899989
tags question: http://stackoverflow.com/q/26857585
tags question: http://stackoverflow.com/q/26941303
tags question: http://stackoverflow.com/q/26878765

http://stackoverflow.com/comment/42502639
score: 0
type: AnswerComment
has text: Thanks a lot! such a simple solution solved a lot of frustration.
comment on: http://stackoverflow.com/a/26984301
type: Comment

http://stackoverflow.com/comment/42546915
type: Comment
comment on: http://stackoverflow.com/a/26971913
has text: worth noting that this answer isn't really solving my problem regarding the uuid generation, which I want to make reusable whilst also using AbstractPersistable
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42358565
type: Comment
type: QuestionComment
score: 0
has text: Show us the real code, that compiles and actually causes the problem. Not some other made-up code that doesn't even compile. And describe your problem clearly: what is the code that you're executing, and what happens precisely? If you get an exception, what is its stack trace?
comment on: http://stackoverflow.com/q/26903555

http://stackoverflow.com/comment/42413426
score: 0
comment on: http://stackoverflow.com/q/26934202
type: Comment
type: QuestionComment
has text: You want to stream the content into the ajax response? This is IMHO not possible and would defeat what AJAX stands for. You send a request and get XML returned to modify the DOM of the displayed page. You might do the validation the AJAX way and then trigger the download with JavaScript.

http://stackoverflow.com/comment/42293942
type: AnswerComment
has text: Thank you @Joop Eggen for your answer. But as a not so experienced java user I am a bit confused with instantiating a new strategy class. when i added the first part of your solution everything went well. However, adding TextExtractionStrategy<SemDoc> part introduced an error as "Interface may not extend a non-interface type". And method does not override any superclass method. Indeed I do not know how to create SemDoc part?
type: Comment
comment on: http://stackoverflow.com/a/26866581
score: 0

http://stackoverflow.com/q/26983381
has title: Should we use FXML in JavaFX custom controls or not?
type: Question
has answer: http://stackoverflow.com/a/26987629
upvote count: 9
tagged with: java
has body: It seems wired to ask this, I would think that using FXML to write our custom components is the obviously the right way to go. But as we can see from ControlsFX, JFXextras and even the book 'Mastering JavaFX8 controls do not use or mention the use of FXML in custom controls. Despite that, the official documentation to say to go on that route, and create JavaFX controls via FXML. What is the more correct way and why ?
possible better answer: http://stackoverflow.com/a/26987629
accepted answer: http://stackoverflow.com/a/26991720
answer count: 2
downvote count: 0
favorite count: 0
tagged with: javafx-8
score: 9
type: AnsweredQuestion
tagged with: fxml
tagged with: javafx
has answer: http://stackoverflow.com/a/26991720

http://stackoverflow.com/comment/42372650
comment on: http://stackoverflow.com/a/26891446
has text: I did not put any code because I'm not using java. Either way I think it will be easy to make a conversion of my C++ code. I updated my answer with the code. Hope that helps
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26961055
linked to: http://stackoverflow.com/q/6086334
tagged with: java
has comment: http://stackoverflow.com/comment/42460503
upvote count: 4
answer count: 4
accepted answer: http://stackoverflow.com/a/26961339
downvote count: 0
possible better answer: http://stackoverflow.com/a/26961284
has answer: http://stackoverflow.com/a/26961388
has body: How would check for an input error in initializing a class in java? I've included an example public class Date { private int d; private int m; private int y; public Date(int d, int m, int y) { if(is valid date){ this.d = d; this.m = m; this.y = y; //etc } else { // ?????? // throw an exception? } } }
has answer: http://stackoverflow.com/a/26961284
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/1371369
favorite count: 0
tagged with: user-input
score: 4
has title: How to check for user input error when initializing a class in java
has answer: http://stackoverflow.com/a/26961435
type: Question
has answer: http://stackoverflow.com/a/26961339
tagged with: error-handling

http://stackoverflow.com/comment/42631189
score: 0
comment on: http://stackoverflow.com/a/26974283
has text: New question: http://stackoverflow.com/questions/27058057/comparing-irises-images-with-opencv
type: Comment
type: AnswerComment

http://stackoverflow.com/a/26965219
has body: You need to do a manual clean of the application causing the problem. Remove the application again, then go look in &lt;Profile_Dir&gt;\config\cells\ea960\blas and &lt;Profile_Dir&gt;\config\cells\ea960\cus to remove all refs to the application (delete them). Then do another clean, then try adding again.
accepted answer of: http://stackoverflow.com/q/26964681
upvote count: 8
has comment: http://stackoverflow.com/comment/42821098
answers question: http://stackoverflow.com/q/26964681
type: AcceptedAnswer
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/42821346
has comment: http://stackoverflow.com/comment/42821172
downvote count: 0

http://stackoverflow.com/q/26980868
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42497054
has comment: http://stackoverflow.com/comment/42496201
has title: How to forward after exception?
tagged with: servlets
has comment: http://stackoverflow.com/comment/42497208
upvote count: 3
has comment: http://stackoverflow.com/comment/42496925
answer count: 1
has comment: http://stackoverflow.com/comment/42496521
has comment: http://stackoverflow.com/comment/42496394
has answer: http://stackoverflow.com/a/27003641
has comment: http://stackoverflow.com/comment/42497259
favorite count: 0
has comment: http://stackoverflow.com/comment/42497045
type: UnansweredQuestion
has body: How to forward after catching exception to the same action which produced exception? The line getServletContext().getRequestDispatcher("/local.action").forward(request, response); has no effect. @WebServlet("/FileUploadServlet1") @MultipartConfig( fileSizeThreshold = 1024 * 1024 * 1, // 1 MB maxFileSize = 1024 * 1024 * 3 ) // 3 MB public class FileUploadServlet1 extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { try { ... try { for (Part part : request.getParts()) { fileName = getFileName(part); part.write(uploadFilePath + File.separator + fileName); } } catch (IllegalStateException e) { throw new Exception("Image was not uploaded"); } ... } catch (Exception ex) { request.setAttribute("message", ex.getMessage()); System.out.println("forward"); getServletContext().getRequestDispatcher("/local.action").forward(request, response); // this has no effect } } ...
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42497127

http://stackoverflow.com/q/26897686
tagged with: java
has title: Distorted ViewPager rounded circle item
tagged with: android-viewpager
tagged with: layout
answer count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: Question
tagged with: android
upvote count: 1
has body: I'm trying to make initial/start pages, which should introduce main features of an application to an user. My code is based on this tutorial: http://manishkpr.webheavens.com/android-viewpager-circle-style-example/ . Actually, I included the whole code several times seperately (to be sure if I haven't made an mistake) to my app, but it still came up with an error. I don't know which specific code snippet to post, because I don't know to what it's related for (if you have an idea, please, say, and I will post the code immediately). I'm posting a part of gradle file (I have a thought, that it's related with a support-v4 library)and rounded-circle layout: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile files('libs/volley.jar') compile 'com.android.support:appcompat-v7:19.+' compile 'com.android.support:support-v4:19.+' compile 'com.squareup.picasso:picasso:2.3.2' compile 'com.nineoldandroids:library:2.4.0' compile 'com.daimajia.slider:library:1.1.0@aar' } &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;inset xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;shape android:shape="rectangle"&gt; &lt;gradient android:startColor="@color/white" android:endColor="@color/white" android:angle="0" /&gt; &lt;corners android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" android:topRightRadius="10dp" android:bottomRightRadius="10dp"/&gt; &lt;stroke android:color="@color/l_blue" android:width="1dp" /&gt; &lt;/shape&gt; &lt;/inset&gt; Here are screenshots from various apps: demo(how rounded circles should look like) and the one, to which I would like to transfer it: See here: https://i.sstatic.net/7ry9U.jpg I would be very grateful for helping me out. Thanks in advance

http://stackoverflow.com/q/26865935
has answer: http://stackoverflow.com/a/26866062
accepted answer: http://stackoverflow.com/a/26866090
type: Question
tagged with: gridbaglayout
score: 0
answer count: 2
has body: I want to create 3 JTextFields in a row with all being of equal size.But my first Text field gets so wide than the other two. After adding each component at a time and seeing what causes the problem I realized that if I type a long text for the JLabel that's when this problem occurs.If I reduce the length of the text in the JLabel JTextFields get into the sizes I want.Here's my code import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.lang.Math; public class Calculator1 extends JFrame { JTextField value1=new JTextField("0"); JTextField value2=new JTextField("0"); JTextField value3=new JTextField("0"); JLabel label1=new JLabel("Label1 size of JTextfields chnge with Label length"); JTextField value4=new JTextField("0"); JTextField value5=new JTextField("0"); JTextField value6=new JTextField("0"); JLabel label2=new JLabel("Label2"); JLabel label3=new JLabel("Label3"); JTextField value7=new JTextField("0"); public Calculator1(){ super("Calculator"); setSize(500,200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel panel=new JPanel(); GridBagLayout bag=new GridBagLayout(); getContentPane().add(panel); panel.setLayout(bag); GridBagConstraints c=new GridBagConstraints(); c.insets=new Insets(5,5,5,5); c.fill=GridBagConstraints.HORIZONTAL; c.gridx=0; c.gridy=0; c.weightx=0.0; c.weighty=0.5; c.gridwidth=1; panel.add(label1,c); c.gridx=0; c.gridy=1; c.gridwidth=5; c.weightx=0.5; c.weighty=0.5; panel.add(value1,c); c.gridx=5; c.gridy=1; panel.add(value2,c); c.gridx=10; c.gridy=1; panel.add(value3,c); c.gridwidth=1; c.weightx=0.0; c.weighty=0.5; c.gridx=0; c.gridy=3; panel.add(label2,c); c.gridwidth=5; c.weightx=0.5; c.weighty=0.5; c.gridx=0; c.gridy=4; c.insets=new Insets(5,5,5,5); panel.add(value4,c); c.gridx=5; c.gridy=4; panel.add(value5,c); c.gridx=10; c.gridy=4; panel.add(value6,c); c.gridwidth=1; c.weightx=0.0; c.weighty=0.5; c.gridx=0; c.gridy=5; panel.add(label3,c); c.gridwidth=5; c.weightx=0.5; c.weighty=0.5; c.gridx=0; c.gridy=6; panel.…
has answer: http://stackoverflow.com/a/26866090
tagged with: swing
has title: JTextField size changes with JLabel text length
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26866062
tagged with: java

http://stackoverflow.com/comment/42318842
score: 0
comment on: http://stackoverflow.com/q/26881468
type: Comment
type: QuestionComment
has text: could you post a sample document? It's hard to puzzle that back together from the query

http://stackoverflow.com/q/26974478
tagged with: rcp
tagged with: eclipse
type: Question
has title: Eclipse RCP Extension Points
answer count: 1
score: 0
has body: Hey guys it has been a couple of week that I started developing stuff based on RCP and frankly speaking i'm facing several problems since i haven't found so much online then the concepts behind RCP programming (at least for me) are not such linear. First of all let me say that I'm using the E4 framework (Application Model) and I want to populate two parts (UI Parts) where their definitions are basically defined in an external plug-in. For instance: - Part1 (defined in Application e4) implements Class1(defined in a Plug-in called ExtPlugin). - Part2 (defined in Application e4) implements Class2(defined in a Plug-in called ExtPlugin). How should I work this out using extension points and extension? Thanks
tagged with: e4
has answer: http://stackoverflow.com/a/26974793
tagged with: plugins
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26974793
tagged with: java

http://stackoverflow.com/a/26973689
answers question: http://stackoverflow.com/q/26860541
upvote count: 1
has body: I found the problem, it was not with my code, but it's with the limitation on jogl that requires a gl shader program to be used. Found answer on this post: glDrawArrays() behaving weirdly on Mac OS X;
type: AcceptedAnswer
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/26860541
downvote count: 0

http://stackoverflow.com/a/35956539
type: Answer
has body: @andy-wilkinson gave the answer but here is an example on how to use it. As you suggested, create another DataSource and then wire it up to to a SpringProcessEngineConfiguration. Like so: @Configuration public class ActivitiConfiguration extends AbstractProcessEngineAutoConfiguration { @Bean @ConfigurationProperties(prefix = "datasource.activiti") public DataSource activitiDataSource() { return DataSourceBuilder .create() .url("jdbc:h2:mem:activiti") .username("activiti") .driverClassName("org.h2.Driver") .build(); } @Bean public SpringProcessEngineConfiguration springProcessEngineConfiguration( PlatformTransactionManager transactionManager, SpringAsyncExecutor springAsyncExecutor) throws IOException { return baseSpringProcessEngineConfiguration( activitiDataSource(), transactionManager, springAsyncExecutor); } } Activiti will use activitiDataSource to create its tables and persist it's data. Now you can create another DataSource to carry your apps tables and data. Here is a basic example based off of spring-boot-sample-basic. Basically it persists a customerId in a WaiterEntity/WaiterRepository (with Spring Data JPA - left out for brevity) and then passes that persisted value onto the Activiti basic2.bpmn process, which just prints it out to console. @SpringBootApplication public class Application { @Bean @Primary @ConfigurationProperties(prefix = "datasource.primary") public DataSource primaryDataSource() { return DataSourceBuilder .create() .url("jdbc:h2:mem:primary") .username("primary") .driverClassName("org.h2.Driver") .build(); } @Bean CommandLineRunner basics(final RuntimeService runtimeService, final WaiterRepository repository) { return new CommandLineRunner() { @Override public void run(String... strings) throws Exception { runtimeService.startProcessInstanceByKey( "waiter2", Collections.singletonMap( "customerId", (Object) repository.save(new WaiterEntity(123L)).getCustomerId())); } }; } public static void main(String[] args) { SpringApplication.run(Appl…
score: 6
answers question: http://stackoverflow.com/q/26889416
upvote count: 6
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26889416
has comment: http://stackoverflow.com/comment/139415829

http://stackoverflow.com/comment/42314734
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26878910
score: 0
has text: what is the output you expect?

http://stackoverflow.com/q/26859559
has answer: http://stackoverflow.com/a/26863256
answer count: 1
type: UnansweredQuestion
has body: i m trying to use findbugs on my application, which has JRE1.7 and compliance level 1.7, when i use Find bugs i get following error java.lang.ArrayIndexOutOfBoundsException: 19567 at org.objectweb.asm.ClassReader.accept(Unknown Source) at edu.umd.cs.findbugs.asm.FBClassReader.accept(FBClassReader.java:44) at org.objectweb.asm.ClassReader.accept(Unknown Source) at edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:110) at edu.umd.cs.findbugs.classfile.engine.ClassParserUsingASM.parse(ClassParserUsingASM.java:554) at edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:76) at edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38) at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:266) at edu.umd.cs.findbugs.ba.XFactory.getXClass(XFactory.java:652) at edu.umd.cs.findbugs.ba.ch.Subtypes2.addInheritanceEdge(Subtypes2.java:1227) at edu.umd.cs.findbugs.ba.ch.Subtypes2.addSupertypeEdges(Subtypes2.java:1200) at edu.umd.cs.findbugs.ba.ch.Subtypes2.addClassAndGetClassVertex(Subtypes2.java:275) at edu.umd.cs.findbugs.ba.ch.Subtypes2.addClass(Subtypes2.java:244) at edu.umd.cs.findbugs.ba.AnalysisCacheToAnalysisContextAdapter.setAppClassList(AnalysisCacheToAnalysisContextAdapter.java:400) at edu.umd.cs.findbugs.FindBugs2.setAppClassList(FindBugs2.java:982) at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:225) at de.tobject.findbugs.builder.FindBugsWorker.runFindBugs(FindBugsWorker.java:314) at de.tobject.findbugs.builder.FindBugsWorker.work(FindBugsWorker.java:222) at de.tobject.findbugs.actions.FindBugsAction$StartedFromViewJob.runWithProgress(FindBugsAction.java:265) at de.tobject.findbugs.FindBugsJob.run(FindBugsJob.java:102) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) also Session Data eclipse.buildId=M20110909-1335 java.version=1.8.0_20 java.vendor=Oracle Corporation BootLoader constants:…
tagged with: java
tagged with: eclipse
has title: Findbugs in eclipse-Indigo giving error "java.lang.ArrayIndexOutOfBoundsException"
type: Question
tagged with: findbugs
score: 0

http://stackoverflow.com/comment/129335529
type: Comment
has text: Same problem with 1.8.0_301
comment on: http://stackoverflow.com/a/26851207
score: 0
type: AnswerComment

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/26928554
type: Tag

http://stackoverflow.com/comment/42301044
has text: As it turns out, this does not produce the exact results I was looking for. However, it does answer my question, and greatly increases my understanding of how Cucumber works. Thank you.
type: AnswerComment
comment on: http://stackoverflow.com/a/26870034
score: 0
type: Comment

http://stackoverflow.com/comment/42357980
has text: Thx!! But for some reason it doesnt work as I get this error "The specified child already has a parent. You must call removeView() on the child's parent first.", I'm using a ViewPager...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26900960
type: Comment

http://stackoverflow.com/a/26948996
has body: According to the documentation for getClass and getType: getClass returns "The Class object that represents the runtime class of this object." getType returns "a Class object identifying the declared type of the field represented by this object" The main difference being that someObject.getClass() will give you a class object of the runtime type of someObject, and someField.getType() will give you a class object of the declared type of the field that someField refers to. (Calling someField.getClass() will return Field.class because it's referring to the Field object itself, not the field that it is referring to). Also, while getClass is available for every object, getType is only available on Field objects which are part of the reflection API.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26948953
has comment: http://stackoverflow.com/comment/43657184
answers question: http://stackoverflow.com/q/26948953
type: Answer
has comment: http://stackoverflow.com/comment/43660979
has comment: http://stackoverflow.com/comment/43653760
score: 22
upvote count: 22

http://stackoverflow.com/comment/42366709
type: AnswerComment
comment on: http://stackoverflow.com/a/26908229
score: 0
type: Comment
has text: make sure you inflated the view first with your row XML layout

http://stackoverflow.com/q/26981919
favorite count: 0
tagged with: exception
tagged with: concurrentmodification
has answer: http://stackoverflow.com/a/26981985
downvote count: 1
type: Question
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/26979939
tagged with: java
has title: java.util.ConcurrentModificationException in my code iter.remove() & iter.add()
score: -1
linked to: http://stackoverflow.com/q/26979939
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26981985
has body: I have this piece of code in my class and it throws the java.util.ConcurrentModificationException on the bolded lines (indicated with** **) public void solve() { **puzzleSolve(set.size(), sequence , set);** } //private helper method protected void puzzleSolve(int k, String s, ArrayList&lt;Character&gt; u){ ListIterator&lt;Character&gt; iter = u.listIterator(); while(iter.hasNext()) { Character c = iter.next(); if(k==1){ //base case if(isAnswer(s+u.get(0))) System.out.println(s+u.get(0)+" is the correct sequence."+ '\n'); return; } else{ **iter.remove();** **puzzleSolve(k-1, s+c , u);** iter.add(c); removeLastChar(s); } } } //end of puzzleSolve method
tagged with: listiterator

http://stackoverflow.com/a/27024738
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26857827
has body: According to the docs for EnhancedPatternLayout, the value in the second set of braces following %d is a string to be passed internally to TimeZone.getTimeZone(String), which states the string should be: The ID for a TimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00". Therefore, you should be able to pass Pacific/Fiji, to automatically use the correct time zone offset at different times of the year. &lt;param name="ConversionPattern" value="%d{ISO8601}{Pacific/Fiji} %-5p %c{1} [%x] [%t] - %m%n" /&gt; Also, historically Fiji has been known for not providing adequate notice when setting their DST dates. Most countries try to establish a stable recurrence pattern, but Fiji has chosen to announce DST changes each individual year. The latest change for 2014 was announced on Oct 20th, and went into effect on Nov 2nd - leaving only 12 days to implement and distribute changes to the time zone databases. The IANA tzdb group acted quickly, releasing version 2014i on Oct 22, and Oracle then issued the corresponding TZUpdater 1.4.9 on Oct 31 to incorporate this change. Make sure you download TZUpdater 1.4.9 or greater and apply it to your environment. As long as Fiji is unstable, you will likely need to do this in the future as well. That means your fist bullet point about not wanting to restart production is an impossibility. One cannot predict the government. Regarding your second bullet point: There are no time zones anywhere in the world that shift by 50 minutes. All that use DST shift by one whole hour, except for Australia/Lord_Howe which shifts by 30 minutes.

http://stackoverflow.com/q/26916599
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42381856
tagged with: android
has comment: http://stackoverflow.com/comment/42382442
has comment: http://stackoverflow.com/comment/42381907
has body: I have an activity and one abstract class with static method. In this method I want to render jsonArray in list view. This is activity public class FeedActivity extends BaseActivity { ... private void renderFeed(String data){ try { JSONObject json = new JSONObject(data); JSONArray d = json.getJSONArray("data"); RenderLists.renderFeed(d); } catch (JSONException e) { Log.e("log_tag", "Error parsing data " + e.toString()); } } } And here is static method. abstract class RenderLists { static void renderFeed(JSONArray data) throws JSONException{ ArrayList feedList1 = new ArrayList&lt;HashMap&lt;String, Object&gt;&gt;(); ListView feedList = (ListView) layout.findViewById(R.id.feedList); // This isn't working for (int i = 0; i &lt; data.length(); i++) { HashMap&lt;String, Object&gt; hm; hm = new HashMap&lt;String, Object&gt;(); hm.put("name", data.getJSONObject(i).getString("name").toString()); feedList1.add(hm); FeedItemAdapter adapter = new FeedItemAdapter(FeedActivity.this, feedList1, R.layout.feed_list, new String[] {"name"}, new int[] { R.id.feedCheckinName}); feedList.setAdapter(adapter); feedList.setChoiceMode(feedList.CHOICE_MODE_SINGLE); } } } How to get Activity and ListView in static method? Please explain me.
has title: Java android findViewById in static method of another class
tagged with: java
has comment: http://stackoverflow.com/comment/42382016
has answer: http://stackoverflow.com/a/26917103
type: Question
tagged with: listview
has comment: http://stackoverflow.com/comment/42381993
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42381952
favorite count: 0
has comment: http://stackoverflow.com/comment/42383633

http://stackoverflow.com/q/26947833
has answer: http://stackoverflow.com/a/26948126
has comment: http://stackoverflow.com/comment/42438144
tagged with: file-io
type: AnsweredQuestion
favorite count: 0
type: Question
has body: I have made a program that is supposed to create a file, write to it, and then read from it. The problem comes with readFile(), where suddenly hasNext() is undefined for Formatter? I thought that while (file.hasNext()) { String a = file.next(); System.out.println(a); would go as long as there was something in the file, copy it to a and then print a? What am I doing wrong? import java.util.*; import java.io.*; class Oppgave3 { public static void main(String[] args) { Kryptosystem a = new Kryptosystem(); a.createFile(); a.writeFile(); a.openFile(); a.readFile(); a.closeFile(); } } class Kryptosystem { public Kryptosystem(){} Scanner keyboard = new Scanner (System.in); private Formatter file; private Scanner x; public void createFile(){ try { file = new Formatter("kryptFil.txt"); } catch (Exception e) { System.out.println("could not create file"); } } public void writeFile(){ System.out.println("what do you want to write"); String tekst = keyboard.nextLine(); file.format(tekst); } public void openFile() { try { x = new Scanner (new File("kryptFil.txt")); } catch (Exception e) { System.out.println("something is wrong with the file"); } } public void readFile() { while (file.hasNext()) { String a = x.next(); System.out.println(a); } } public void closeFile() { file.close(); } }
accepted answer: http://stackoverflow.com/a/26948126
has title: creating, writing to and reading from files java
tagged with: java.util.scanner
score: 0
tagged with: java
upvote count: 1
downvote count: 1
answer count: 1

http://stackoverflow.com/q/26926484
has answer: http://stackoverflow.com/a/26926582
has comment: http://stackoverflow.com/comment/42399155
tagged with: java
type: Question
answer count: 2
has body: say I compile a regex pattern: String myString = "manifest"; p = Pattern.compile( myPattern, Pattern.CASE_INSENSITIVE ); Matcher m = p.matcher( myString ); if ( m.matches() ){ ..... } When I specify myPattern as ni for example, myString doesn't get matched. But when I specify myPattern as .*ni.* , then it gets matched. In a later part of my code, I will want to replace whatever is defined in myPattern with a new pattern. For example, if I specify ni as the 2 characters to replace, then it will only replace ni. If i specify .*ni.* , then the whole string will be replaced with new pattern. Now my problem is it doesn't get matched. What could be solution to this? thanks
accepted answer: http://stackoverflow.com/a/26926582
score: 0
tagged with: regex
has comment: http://stackoverflow.com/comment/42399236
has answer: http://stackoverflow.com/a/26926565
possible better answer: http://stackoverflow.com/a/26926565
has title: Java pattern matcher behaviour
type: AnsweredQuestion

http://stackoverflow.com/a/29621698
type: Answer
answers question: http://stackoverflow.com/q/26925275
has comment: http://stackoverflow.com/comment/47387854
has body: You can try this. public void FileSave() throws IOException { JFileChooser chooser=new JFileChooser("."); FileNameExtensionFilter filter = new FileNameExtensionFilter("Excel files","xls","excel"); chooser.addChoosableFileFilter(filter); chooser.setFileFilter(filter); chooser.setFileSelectionMode(chooser.FILES_AND_DIRECTORIES); chooser.setDialogTitle("Save File"); chooser.setCurrentDirectory(new File(System.getProperties().getProperty("user.home"))); chooser.setFileFilter(new javax.swing.filechooser.FileFilter() { public boolean accept(final File f) { return f.isDirectory()|| file.getAbsolutePath().endsWith(".xls"); } public String getDescription() { return "Excel files (*.xls)"; } }); int returnVal1=chooser.showSaveDialog(this); if (returnVal1 == JFileChooser.APPROVE_OPTION) { file1 = chooser.getSelectedFile(); if(!file1.exists()) { FileOutputStream fileOut = new FileOutputStream(file1); hwb.write(fileOut); fileOut.close(); System.out.println("\n Your Excel file has been generated!"); JOptionPane.showMessageDialog(this,"File Created."); } else if(file1.exists()) { int res=JOptionPane.showConfirmDialog(this,"File already exists.Do you wish to overwrite?"); if(res == JOptionPane.YES_OPTION) { FileOutputStream fileOut = new FileOutputStream(file1); hwb.write(fileOut); fileOut.close(); System.out.println("\n Your Excel file has been generated!"); JOptionPane.showMessageDialog(this,"File Created."); } else if(res == JOptionPane.NO_OPTION) { int returnVal2=chooser.showSaveDialog(this); if (returnVal2 == JFileChooser.APPROVE_OPTION) { File file2 = chooser.getSelectedFile(); if(!file2.exists()) { FileOutputStream fileOut = new FileOutputStream(file2); hwb.write(fileOut); fileOut.close(); System.out.println("\n Your Excel file has been generated!"); JOptionPane.showMessageDialog(this,"File Created."); } } } else if (res == JOptionPane.CANCEL_OPTION) { JOptionPane.showMessageDialog(this, "User cancelled operation."); } } } }
score: 0

http://stackoverflow.com/comment/42378403
comment on: http://stackoverflow.com/q/26914668
type: Comment
type: QuestionComment
score: 2
has text: `else {` clearly states that no case is left behind. I usually would comment `// x > 0` to indicate the intended value for x at this point, in case the other conditions were to change.

http://stackoverflow.com/comment/42494242
has text: thanks for the answer, this level of precision is not required (I believe) but I could be wrong.
type: Comment
comment on: http://stackoverflow.com/a/26979115
score: 0
type: AnswerComment

http://stackoverflow.com/a/26876222
score: 1
answers question: http://stackoverflow.com/q/26865902
upvote count: 1
has comment: http://stackoverflow.com/comment/42326777
has comment: http://stackoverflow.com/comment/42327402
has comment: http://stackoverflow.com/comment/42327622
downvote count: 0
has body: Nothing in the lib or classes directory is available to be served to clients that visit the site. It will be necessary to move the Jar to another place on the server. In addition to that: The following path is simply wrong. archive="/my_gwt_app/WEB-INF/lib/signed_applet.jar" WEB-INF would typically be the 'root' of the site. &lt;param name="permissions" value="all-permissions"&gt; Whatever you are trying to achieve there, it will not add permissions to the applet.
has comment: http://stackoverflow.com/comment/42326875
type: Answer

http://stackoverflow.com/q/26945004
type: Question
has title: CustomListview showing status twice in the listview
tagged with: listview
has answer: http://stackoverflow.com/a/26945916
tagged with: android-listview
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/26945916
type: AnsweredQuestion
has body: I am working on a project where there is a custom listview which shows different fields and shows task status.The data is recieved as an object of a class The class i use to invoke the base adapter is as follows: package com.igloo.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ListView; import android.widget.Toast; import com.igloo.adapters.CustomTaskListAdapter; import com.igloo.classes.Applied_job_data; import com.igloo.marinaretail.R; import com.igloo.marinaretail.UserMain; public class TaskDescriptionFragment extends Fragment { ListView list_tasks_final; Applied_job_data job_object,job_object_new; CustomTaskListAdapter ctadp; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view=inflater.inflate(R.layout.taskdescriptionfragment, container, false); list_tasks_final=(ListView) view.findViewById(R.id.list_tasks_final); job_object=(Applied_job_data) getArguments().getSerializable("job_object"); ctadp=new CustomTaskListAdapter(getActivity(), job_object); list_tasks_final.setAdapter(ctadp); return view; } @Override public void onViewCreated(View view, Bundle savedInstanceState) { // TODO Auto-generated method stub super.onViewCreated(view, savedInstanceState); job_object_new=((UserMain) getActivity()).new_job_object; if(job_object_new!=null) { ctadp=new CustomTaskListAdapter(getActivity(), job_object_new); } else { ctadp=new CustomTaskListAdapter(getActivity(), job_object); } list_tasks_final.setAdapter(ctadp); ctadp.notifyDataSetChanged(); } @Override public void onDestroyView() { super.onDestroyView(); } } The adapter is as follows: package com.igloo.adapters; import com.igloo.adapters.CustomMyJobsAdapter.MyJobHolder; import com.igloo.classes.Applied_job_data; import com.igloo.classes.Task_data; import com.igloo.marinaretail.R; import com.igloo.marinaretail.U…
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/q/26945301
has title: Why is a file not getting deleted using the file.delete() function?
has answer: http://stackoverflow.com/a/26945329
downvote count: 0
linked to: http://stackoverflow.com/q/4485716
answer count: 3
has answer: http://stackoverflow.com/a/26954216
favorite count: 0
tagged with: file-handling
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26945341
upvote count: 1
has comment: http://stackoverflow.com/comment/42433188
has body: I am using a method to delete a particular pre-existing file using the file.delete() method as follows public void deleteFile(String fileName)throws IOException //To refine. Does not work { File file=new File("C:\\File Handling\\"+fileName+".txt"); boolean success=file.delete(); System.out.println(success); } However success is always returned as false. What is going wrong? Please advise on how else to delete a file using java.
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/42513280
comment on: http://stackoverflow.com/a/26990145
score: 0
type: AnswerComment
type: Comment
has text: also without applying your parameter block? just painting your unaltered, first image into a new clean bufferedImage?

http://stackoverflow.com/comment/42286805
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26863315
has text: Thanks, I'll read into it but from the first view this looks like the kind of thing I'm looking for.

http://stackoverflow.com/comment/42488493
type: Comment
type: QuestionComment
has text: Provide the necessary code to replicate your problem.
score: 0
comment on: http://stackoverflow.com/q/26976929

http://stackoverflow.com/comment/42458814
has text: Do you think that the error is that you're getting 6.9999999999999 instead of 7?
score: 0
comment on: http://stackoverflow.com/q/26960223
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42303267
type: QuestionComment
has text: If you forgot something, use the `edit` link below your question and add it.
comment on: http://stackoverflow.com/q/26872454
score: 0
type: Comment

http://stackoverflow.com/a/26900433
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/42353462
score: 0
has comment: http://stackoverflow.com/comment/42353436
upvote count: 1
answers question: http://stackoverflow.com/q/26900345
has body: if(i==n) { System.out.print(1); } you should just change to (i == n-1)
has comment: http://stackoverflow.com/comment/42353437

http://stackoverflow.com/comment/42453571
type: QuestionComment
comment on: http://stackoverflow.com/q/26956815
has text: 1) Post an [mcve](http://stackoverflow.com/help/mcve). 2) Your method render has a `Graphics g` parameter, but you don't do anything with it-->It is impossible to display something without accessing it.
score: 0
type: Comment

http://stackoverflow.com/a/28192102
has body: I've fixed the issue by marking the target folder of the artifact as "Excluded". I think the duplication is caused by the stub files generated in target/generated-sources/groovy-stubs. IDEA must be too curious about these files and might add them to the source set.
answers question: http://stackoverflow.com/q/26987237
downvote count: 0
has comment: http://stackoverflow.com/comment/99890400
type: Answer
has comment: http://stackoverflow.com/comment/62914810
upvote count: 11
score: 11
has comment: http://stackoverflow.com/comment/62850864

http://stackoverflow.com/a/26849165
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26844275
score: 6
answers question: http://stackoverflow.com/q/26844275
type: AcceptedAnswer
downvote count: 0
has body: Use a suitable layout pane (e.g. a VBox), and add Labels to it. You can configure the labels to fill the width of a VBox using VBox.setHgrow(...). You also need to set the maximum width of the label to allow it to grow. As an aside, it is not good practice to re-create the controls every time the updateItem(...) method is called. Create them once and then just configure them in the updateItem(...) method with the required data. Example: TableColumn&lt;Person, Person&gt; multiCol = new TableColumn&lt;&gt;("Multiline"); multiCol.setCellValueFactory(cellData -&gt; new ReadOnlyObjectWrapper&lt;Person&gt;(cellData.getValue())); multiCol.setCellFactory(column -&gt; new TableCell&lt;Person, Person&gt;() { private VBox graphic ; private Label firstNameLabel ; private Label lastNameLabel ; private Label emailLabel ; // Anonymous constructor: { graphic = new VBox(); firstNameLabel = createLabel("#66BB66"); lastNameLabel = createLabel("#79A8D8"); emailLabel = createLabel("#FF8888"); graphic.getChildren().addAll(firstNameLabel, lastNameLabel, emailLabel); setContentDisplay(ContentDisplay.GRAPHIC_ONLY); } private final Label createLabel(String color) { Label label = new Label(); VBox.setVgrow(label, Priority.ALWAYS); label.setMaxWidth(Double.MAX_VALUE); label.setStyle("-fx-background-color: "+color+" ;"); label.setAlignment(Pos.CENTER); return label ; } @Override public void updateItem(Person person, boolean empty) { if (person == null) { setGraphic(null); } else { firstNameLabel.setText(person.getFirstName()); lastNameLabel.setText(person.getLastName()); emailLabel.setText(person.getEmail()); setGraphic(graphic); } } });

http://stackoverflow.com/comment/42401310
type: QuestionComment
comment on: http://stackoverflow.com/q/26919145
type: Comment
has text: Am I not very clear ?
score: 0

http://stackoverflow.com/q/26880269
tagged with: java
has title: Can't work on my java projects in Eclipse Juno
has answer: http://stackoverflow.com/a/26880385
type: Question
tagged with: eclipse
has answer: http://stackoverflow.com/a/26880449
has answer: http://stackoverflow.com/a/26880319
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42316884
has comment: http://stackoverflow.com/comment/42344501
tagged with: android
has comment: http://stackoverflow.com/comment/42320495
has comment: http://stackoverflow.com/comment/42316904
has body: I used to work in Eclipse Luna and had many projects in my workspace. Then I decided to start coding for Android and downloaded the ADT bundle from here. I imported my Luna workspace and it worked fine. However, whenever I open a class I get cannot be resolved errors everywhere on what used to be flawless code. What difference in packages is causing this? Why can't I write and compile Java in Juno? Note that I don't see the errors in the package explorer on the left:
type: UnansweredQuestion

http://stackoverflow.com/comment/42344469
comment on: http://stackoverflow.com/q/26895468
type: QuestionComment
type: Comment
score: 2
has text: "A String inside a String" also known as String-ception.

http://stackoverflow.com/comment/42268189
type: Comment
has text: in MainActivity .. Where you do create the intent and call startActivity
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26848301

http://stackoverflow.com/comment/42394938
type: QuestionComment
comment on: http://stackoverflow.com/q/26882825
score: 0
has text: Yes it includes all the dependencies
type: Comment

http://stackoverflow.com/a/26910246
downvote count: 0
has comment: http://stackoverflow.com/comment/42510907
type: Answer
score: 3
upvote count: 3
has body: According to this, Text doesn't have background stylable properties, so that's why changing -fx-text-background-color doesn't have any effect on it. One possible workaround for this is wrapping this text node in an HBox, where you can easily set its background to yellow. But this has several drawbacks, such as the textflow losing the ability to manage the content. If you really need highlighting, other possible solution could be styling the background of the textflow, by finding the bounds of the text, and setting the proper insets. This is an example I've quickly done with Scenic Builder and some css: .textflow { -fx-background-color: yellow; -fx-background-insets: 2 139.3 10 200; } I've taken into account the width of the textflow (510) and the widths of the different text nodes using local bounds: 200, 170.7 and 129. So the right inset is 510-200-170.7=139.3 and the left inset is given from the first node width, 200. Now the challenge is adapt this in your method...
has comment: http://stackoverflow.com/comment/67297607
answers question: http://stackoverflow.com/q/26906810

http://stackoverflow.com/q/26858286
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26878961
type: UnansweredQuestion
tagged with: jmeter
tagged with: corruption
tagged with: java
has answer: http://stackoverflow.com/a/26860614
has body: I have been running my jmeter instance from Windows and Linux using the same binary files and it works fine. After I copied the same files to solaris, it throws the error "Invalid or corrupt jarfile ApacheJMeter.jar" and exits. I do not have the permissions to install the binaries directly using apt-get. .../apache-jmeter-2.11/bin$ java -jar ApacheJMeter.jar Invalid or corrupt jarfile ApacheJMeter.jar OS: Oracle Solaris 10 9/10 s10x_u9wos_14a X86 Jmeter: version 2.11 Java: version 1.6.0_21
type: Question
has title: Jmeter does not work on solaris, throws Invalid or corrupt jarfile ApacheJMeter.jar
tagged with: solaris

http://stackoverflow.com/comment/42271948
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the answer. Adding <Integer> got rid of the error, but I am still getting null values. I am actually adding values to the LinkedList, I just didn't include the code. I have updated the question. Any ideas why I am still getting null?
comment on: http://stackoverflow.com/a/26854108

http://stackoverflow.com/q/26925856
score: 2
upvote count: 3
has answer: http://stackoverflow.com/a/26926406
tagged with: java
tagged with: itext
possible better answer: http://stackoverflow.com/a/59952469
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/59952469
type: AnsweredQuestion
has title: Convert TXT file to PDF using iText (keep formatting)
accepted answer: http://stackoverflow.com/a/26926406
answer count: 2
has body: I am trying to convert a .txt file into a .pdf file using iText library. The problem that I am facing is the following: I have a clear formatting in the txt file, something similar with this: TEXT ******************* Other text here * SOME_CODE_HERE_ * Other text ******************* And in the output the formatting is gone and looks like this: TEXT ****************** Other text here * SOME_CODE_HERE_ * Other text ****************** The code looks like this: public static boolean convertTextToPDF(File file) throws Exception { BufferedReader br = null; try { Document pdfDoc = new Document(PageSize.A4); String output_file = file.getName().replace(".txt", ".pdf"); System.out.println("## writing to: " + output_file); PdfWriter.getInstance(pdfDoc, new FileOutputStream(output_file)).setPdfVersion(PdfWriter.VERSION_1_7);; pdfDoc.open(); Font myfont = new Font(); myfont.setStyle(Font.NORMAL); myfont.setSize(11); pdfDoc.add(new Paragraph("\n")); if (file.exists()) { br = new BufferedReader(new FileReader(file)); String strLine; while ((strLine = br.readLine()) != null) { Paragraph para = new Paragraph(strLine + "\n", myfont); para.setAlignment(Element.ALIGN_JUSTIFIED); pdfDoc.add(para); } } else { System.out.println("no such file exists!"); return false; } pdfDoc.close(); } catch (Exception e) { e.printStackTrace(); } finally { if (br != null) br.close(); } return true; } I also tried to create a BaseFont with IDENTITY_H but it doesn't work. I guess it's about the encoding or something like that. What do you think? I run out of solutions... Thanks LE: As suggested by Alan, and by the tutorial from iText's page, I used this part in addition with my existing code and it works fine. BaseFont courier = BaseFont.createFont(BaseFont.COURIER, BaseFont.CP1252, BaseFont.EMBEDDED); Font myfont = new Font(courier);
tagged with: http://stackoverflow.com/tag/pdf
favorite count: 0

http://stackoverflow.com/comment/42518268
comment on: http://stackoverflow.com/a/26948551
score: 0
type: AnswerComment
has text: Do I need to pass the exact field name instead of "field_name" or just doing it will work for all fields?
type: Comment

http://stackoverflow.com/a/26962295
upvote count: 2
has comment: http://stackoverflow.com/comment/42463004
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42477390
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26962244
has body: If your webRequest.execute() does not complete immediately, but rather blocks until it's time to call onSuccess/onError, then these methods will be called within the same synchronized block, but it will also defeat the entire purpose of having such a circuitous, callback-based API, whose primary purpose is to allow asynchrony. Therefore, either your methods will not be called while holding a lock on dataStorage, or else they will but you are using the wrong kind of API to achieve that.
answers question: http://stackoverflow.com/q/26962244

http://stackoverflow.com/comment/68355203
has text: have you seen this link? https://datastax.github.io/java-driver/manual/custom_codecs/
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26969148

http://stackoverflow.com/a/26888480
has comment: http://stackoverflow.com/comment/42629428
has comment: http://stackoverflow.com/comment/42787954
accepted answer of: http://stackoverflow.com/q/26885528
has comment: http://stackoverflow.com/comment/42559757
has comment: http://stackoverflow.com/comment/42553322
has comment: http://stackoverflow.com/comment/42639265
answers question: http://stackoverflow.com/q/26885528
has comment: http://stackoverflow.com/comment/42409696
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42563442
has comment: http://stackoverflow.com/comment/42406990
has comment: http://stackoverflow.com/comment/42641935
has body: Based on what you posted so far (I am really hoping for an edit that clarifies what you are attempting) I am assuming you are trying to build a loop that doesn't end until the board is finished. until it is finished, a move is asked from the player. the move is made (if legal). Then the board is printed. your code has a number of issues: CheckMove(spelplan, rad, kolumn) is only ever executed with rad=3,kolumn=3. I would expect this to be run using the user input. You reuse your loop variables. (int i = new scanner) and later (for i=i). never do that. the i=i is pointless anyway and you end up doing i++ which means you lose the user input. inside the while loop you never do makeMove(spelplan, i, j). I would expect this to occur before printing out the board. the for loops (i and j) don't seem to be useful. Your method skrivutSpelPlan already prints the board and it only needs to be called once. you don't use the loop variables i or j. I am fighting the urge to write out suggestions / code as you indicated you didn't want it. In pseudocode, you would want your loop structured like: while (!isBoardSolved) { (x,y) = getUserInput(); // this is not java :D don't use it if (isLegalMove(x,y)) { makeMove(x,y); } else { reportError(); } printBoard(); } in your printBoard method, you should loop. you currently have hardcoded [0] [1] etc. use a forloop for row and forloop for col. your checkmove doesn't check the board. it checks if the board[x][y] != board[x][y] which is never true. (well ok technically in a multithreaded environment, it could be true if a racecondition occurs and it's accessible) You have to think what checkMove does. MakeMove is ok, except you don't need to return the new playing field. if you do char[][] board = new char[4][4]; MakeMove(board, 'a', x, y); System.out.println(board[x][y]); // should print 'a' unless x or y were out of bounds. then board gets updated and the a is printed. ok I'm trying not to spoil your fun, just giving pointers. Please update…
has comment: http://stackoverflow.com/comment/42409632
has comment: http://stackoverflow.com/comment/42797116
has comment: http://stackoverflow.com/comment/42555323
score: 0
has comment: http://stackoverflow.com/comment/42628354
type: Answer
has comment: http://stackoverflow.com/comment/42554707

http://stackoverflow.com/q/26978397
has answer: http://stackoverflow.com/a/26978485
has title: How does this snippet modify the object passed in?
has comment: http://stackoverflow.com/comment/42491270
type: AnsweredQuestion
score: 3
has body: I was doing a Java quiz and came across this question: class Person { static int pid; int age; String name; Person(String s, int i) { ++pid; name = s; age = i; } } class Test { public static void main(String args[]) { Person p1 = new Person("John", 22); Test te = new Test(); Person p2 = te.change(p1); System.out.println(p2.pid + " " + p2.name + " " + p2.age); System.out.print(p1.pid + " " + p1.name + " " + p1.age); } private Person change(Object o) { Person p2 = (Person) o; p2.age = 25; return p2; } } The answer turned out to be 1 John 25 printed twice, but I am confused as to how this happens. The value of the reference of the object p1 is sent into the method change, but the contents are seemingly copied into a new object called p2. So where is p1 actually modified?
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/26978485
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42491308

http://stackoverflow.com/a/26844465
type: Answer
upvote count: 1
has body: XML is not well formed, change Start to Start because attribute content should enclosed by double quotes.
score: 1
answers question: http://stackoverflow.com/q/26843044
downvote count: 0
has comment: http://stackoverflow.com/comment/42271130

http://stackoverflow.com/q/26937570
has answer: http://stackoverflow.com/a/26948551
tagged with: kibana
has answer: http://stackoverflow.com/a/26948248
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 5
upvote count: 5
tagged with: logstash
has body: I have a Java application that writes to a log file in json format. The fields that come in the logs are variable. The logstash reads this logfile and sends it to Kibana. I've configured the logstash with the following file: input { file { path =&gt; ["[log_path]"] codec =&gt; "json" } } filter{ json { source =&gt; "message" } date { match =&gt; [ "data", "dd-MM-yyyy HH:mm:ss.SSS" ] timezone =&gt; "America/Sao_Paulo" } } output { elasticsearch_http { flush_size =&gt; 1 host =&gt; "[host]" index =&gt; "application-%{+YYYY.MM.dd}" } } I've managed to show correctly everything in Kibana without any mapping. But when I try to create a terms panel to show a count of the servers who sent those messages I have a problem. I have a field called server in my json, that show the servers name (like: a1-name-server1), but the terms panel split the server name because of the "-". Also I would like to count the number of times that a error message appears, but the same problem occurs, because the terms panel split the error message because of the spaces. I'm using Kibana 3 and Logstash 1.4. I've searched a lot on the web and couldn't find any solution. I also tried using the .raw from logstash, but it didn't work. How can I manage this? Thanks for the help.
answer count: 2
downvote count: 0
has title: Logstash + Kibana terms panel without breaking words
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42486365
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26969150
has text: Yes, but have you any idea why it takes me null ? In what direction should I go ?
score: 0

http://stackoverflow.com/comment/42507529
comment on: http://stackoverflow.com/q/26987429
score: 0
has text: Hi Aladdin, you have aded extra brace remove last one.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42379941
type: Comment
comment on: http://stackoverflow.com/a/26914614
has text: I would think that this would be cheating, as it isn't your code and it doesn't demonstrate any lesson that would be taught at your level of learning.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26922622
has comment: http://stackoverflow.com/comment/42393770
has title: Avoiding multiple lock attempts java
has comment: http://stackoverflow.com/comment/42392772
has body: I have the following method: public foo bar(String id) { Lock localLock = lockUtil.lock(id); try { do something; return foo; } finally { lock.unlock(); } } I need to override this method to take in another parameter. public foo bar(String id, Integer index) { Lock localLock = lockUtil.lock(id); try { do something with index; } finally { lock.unlock(); } return bar(id); } My question is, how can do achieve this without obtaining the locks twice (in case the second method is called)? I don't want to change the signature of the original method, since that would mean making changes at 10 different places in the system. I'd appreciate any ideas. I can give more clarification regarding the question, if required. Thanks.
answer count: 0
type: UnansweredQuestion
tagged with: reentrantlock
type: Question
has comment: http://stackoverflow.com/comment/42392733
tagged with: java
has comment: http://stackoverflow.com/comment/42393129
score: 0
tagged with: locking
tagged with: synchronization
has comment: http://stackoverflow.com/comment/42393679

http://stackoverflow.com/q/26881813
has comment: http://stackoverflow.com/comment/42319486
tagged with: java
has body: I have run this two command, 1.>mvn archetype:generate -DgroupId=com.companyname.automobile -DartifactId=trucks -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false 2.>mvn archetype:generate -DgroupId=com.companyname.bank -DartifactId=consumerBanking -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false Both are creating two different folder structure.why??
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42319839
downvote count: 4
has comment: http://stackoverflow.com/comment/42319716
answer count: 1
has comment: http://stackoverflow.com/comment/42319437
favorite count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/42319519
has answer: http://stackoverflow.com/a/26881874
tagged with: maven
has title: Maven create project command

http://stackoverflow.com/q/26876620
has answer: http://stackoverflow.com/a/51742016
downvote count: 0
has comment: http://stackoverflow.com/comment/52072750
favorite count: 0
tagged with: unity-game-engine
type: UnansweredQuestion
tagged with: android
has title: Importing a Unity3D Scene into an Android fragment
tagged with: android-fragments
tagged with: java
type: Question
score: 4
has body: I've searched online for similar questions, and while I've found several similar questions, none had reliable answers, which is why I'm posting here. When the Unity3D project is compiled for Android, it basically just gives the scene as an Activity that you can start/end/etc. I want to change this Activity into a Fragment in order to display it as a tab inside a navigation drawer, and as a sub-view inside another fragment/activity. So basically I had a MainActivity with an Open button, and a UnityPlayerNativeActivity which is the actual Unity3D project. I searched how to change a general activity to a fragment, and changed the UnityPlayerNativeActivity to match. For example, in the newly-titled UnityPlayerNativeFragment below (with comments reflecting what exactly was changed from before): import com.unity3d.player.UnityPlayer; // Other imports available in full code linked to below public class UnityPlayerNativeFragment extends Fragment { // Changes in this class: // 1- 'this' references changed to "getActivity()" // 2- onCreate -&gt; onCreateView // 3- protected -&gt; public in function names // 4- @Override added before function calls // 5- newInstance and onAttach added protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code private static final String ARG_SECTION_NUMBER = "section_number"; public static UnityPlayerNativeFragment newInstance(int sectionNumber) { UnityPlayerNativeFragment fragment = new UnityPlayerNativeFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; } @Override public void onAttach(Activity activity) { super.onAttach(activity); ((HomeActivity) activity).onSectionAttached( getArguments().getInt(ARG_SECTION_NUMBER)); } // UnityPlayer.init() should be called before attaching the view to a layout - it will load the native code. // UnityPlayer.quit() should be the last thing called - it will unload the native code. …
upvote count: 4
has answer: http://stackoverflow.com/a/27579117
answer count: 2
has comment: http://stackoverflow.com/comment/52122566

http://stackoverflow.com/comment/42282421
has text: I had a crushing suspicion it'd be a really simple solution like this. I'll test and give correct answer if it is. Could you please expand your answer to explain why `@ViewScoped` is the right approach to the solution, etc... Mostly for people who find this through Google.
type: Comment
comment on: http://stackoverflow.com/a/26860979
score: 0
type: AnswerComment

http://stackoverflow.com/q/26940542
type: Question
answer count: 1
has body: I am currently writing a server for a multiplayer game. The main class of the server is as follows: public final Logger logger = LogManager.getLogger(Turtle.class.getName()); public boolean isStopped = true; public static Turtle serverInstance; public NetworkHandler networkHandler; protected InetAddress ip; protected int port; public Turtle(InetAddress ip, int port){ this.ip = ip; this.port = port; } public static void main(String[] args){ serverInstance = new Thread(new Turtle(NetworkHandler.getipByName("0.0.0.0"), 19132)); serverInstance.start(); } public void run() { logger.info("Starting Turtle..."); isStopped = false; logger.info("Initializing Networking."); networkHandler = new NetworkHandler(ip, port); networkHandler.start(); logger.info("Done!"); } public NetworkHandler getNetworkHandler(){ return networkHandler; } public static Thread getServer(){ return serverInstance; } public static String getMOTD(){ return "MCCPP;MINECON;[0/20] Turtle Test Server"; } public Logger getLogger(){ return logger; } public void stop(){ logger.info("Turtle is stopping."); networkHandler.stahp(); System.exit(0); } This class itself is a Runnable. As you can see, I attempt to start the server by setting the static serverInstance to an instance of the server in a thread, then by calling the start method. However, this does not work, because serverInstance requires the Turtle object (the name of this class). I cannot change this to Thread, because other parts of the program require use of methods from Turtle through this instance, and changing serverInstance to Thread wouldn't let me access any methods of the class. So, the question is, how do I set serverInstance as this thread, and also retain access to all of Turtle's methods from serverInstance? Sorry if this was a bit confusing. It's a little jumbled in my head too, and I may have had some trouble getting this out.
score: 0
tagged with: multithreading
has title: How could I use an object's method calling the thread instance of it?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26940648
accepted answer: http://stackoverflow.com/a/26940648
tagged with: java

http://stackoverflow.com/q/26900655
has body: I am trying to get base object from parent object but i am not able to. Do we have anything like this?` public class A { } public class B extends A { A obj = this.getParentObject(); } Thanks Fahad Mullaji
has comment: http://stackoverflow.com/comment/42353761
type: UnansweredQuestion
tagged with: inheritance
has comment: http://stackoverflow.com/comment/42353830
favorite count: 0
has answer: http://stackoverflow.com/a/26900719
type: Question
answer count: 2
has title: Java - get parent object from child object
score: -2
has answer: http://stackoverflow.com/a/26900701
has comment: http://stackoverflow.com/comment/42353819
has comment: http://stackoverflow.com/comment/106020312
tagged with: oop
tagged with: java
downvote count: 3
upvote count: 1

http://stackoverflow.com/comment/42298649
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26869951
has text: Why would this be an argument resolver? You have no parameters and therefore no arguments.
score: 0

http://stackoverflow.com/comment/42295947
type: QuestionComment
score: 4
has text: I propose a [tag:zelda] tag.
comment on: http://stackoverflow.com/q/26867689
type: Comment

http://stackoverflow.com/comment/42253949
type: QuestionComment
type: Comment
has text: just simple: public static void main(String[] args){ <break> System.out.println("test"); ...
comment on: http://stackoverflow.com/q/26845411
score: 0

http://stackoverflow.com/q/26921976
has answer: http://stackoverflow.com/a/26922047
type: Question
score: 0
has title: having errors in my project for java
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26922049
answer count: 3
has comment: http://stackoverflow.com/comment/42391703
possible better answer: http://stackoverflow.com/a/26922006
has body: so im done with the whole thing and i compile it when i ran it it had a error for said: arrayindexexception and i try looking for my mistake and i could not find it so i need someone to see if they can help me public class Merging { public static int[] merge(int[] arrA, int[] arrB) { int[] sum = new int[arrA.length + arrB.length]; int i = 0, j = 0, k = 0; while ( i &lt; arrA.length &amp;&amp; j &lt; arrB.length) { if(arrA[i] &lt; arrB[j]) { sum[k] = arrA[i]; i++; k++; }else sum[k] = arrB[i]; j++; k++; } return sum; } public static void main(String[] args) { int a = (int)(Math.random() * (50-20+1)+20); int b = (int)(Math.random() * (50-20+1)+20); int[] a1 = new int[a]; int[] a2 = new int[b]; int i = 0; while(i &lt; a1.length &amp;&amp; 1 &lt; a2.length) { a1[i] = (int) (Math.random() * (150-20+1)+20); a2[i] = (int) (Math.random() * (150-20+1)+20); i++; } for(int j = 0; j &lt; a1.length; j++) { System.out.print(a1[j]); } System.out.println(); for(int k = 0; k &lt; a2.length; k++) { System.out.print(a1[k]); } System.out.println(); System.out.print(merge(a1,a2)); } }
accepted answer: http://stackoverflow.com/a/26922047
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26922006
tagged with: java

http://stackoverflow.com/q/26955263
tagged with: java
has comment: http://stackoverflow.com/comment/42450205
has answer: http://stackoverflow.com/a/73907227
type: Question
has title: Is there any other way(not sendKeys) to enter text into textbox using selenium webdriver?
has answer: http://stackoverflow.com/a/66148530
has answer: http://stackoverflow.com/a/26955409
has answer: http://stackoverflow.com/a/29328814
has comment: http://stackoverflow.com/comment/42451037
upvote count: 2
has answer: http://stackoverflow.com/a/65482762
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/45072577
has answer: http://stackoverflow.com/a/59280346
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 2
has body: Is there any other way(not sendKeys) to enter text into textbox using selenium webdriver ?
downvote count: 0

itext
tags question: http://stackoverflow.com/q/26864253
tags question: http://stackoverflow.com/q/26946969
tags question: http://stackoverflow.com/q/26913169
tags question: http://stackoverflow.com/q/26991896
tags question: http://stackoverflow.com/q/26838145
tag name: itext
tags question: http://stackoverflow.com/q/26925856
tags question: http://stackoverflow.com/q/26910627
tags question: http://stackoverflow.com/q/26965810
tags question: http://stackoverflow.com/q/26859473
type: Tag
tags question: http://stackoverflow.com/q/26971401
tags question: http://stackoverflow.com/q/26885163
tags question: http://stackoverflow.com/q/26891426
tags question: http://stackoverflow.com/q/26865946

http://stackoverflow.com/comment/42462185
score: 0
type: AnswerComment
type: Comment
has text: Wondering if (number of players) is large say > 10^6. Keeping `Player` object in both data structures` would lead to data redundancy.
comment on: http://stackoverflow.com/a/26961462

http://stackoverflow.com/a/45091040
has comment: http://stackoverflow.com/comment/89747474
has body: I have wrapped the answers above into two JUnit rules that does not require changes to the build script as the rules handles the native library stuff. I did this as I found that Idea did not like the Gradle/Maven solutions as it just went off and did its own thing anyhoos. This means the steps are: Get the AssortmentOfJUnitRules version 1.5.32 or above dependency Get the Direct DynamoDBLocal dependency Add the LocalDynamoDbRule or HttpDynamoDbRule to your JUnit test. Maven: com.amazonaws DynamoDBLocal 1.11.0.1 test com.github.mlk assortmentofjunitrules 1.5.36 test dynamodb-local DynamoDB Local Release Repository https://s3-us-west-2.amazonaws.com/dynamodb-local/release Gradle: repositories { mavenCentral() maven { url = "https://s3-us-west-2.amazonaws.com/dynamodb-local/release" } } dependencies { testCompile "com.github.mlk:assortmentofjunitrules:1.5.36" testCompile "com.amazonaws:DynamoDBLocal:1.+" } Code: public class LocalDynamoDbRuleTest { @Rule public LocalDynamoDbRule ddb = new LocalDynamoDbRule(); @Test public void test() { doDynamoStuff(ddb.getClient()); } }
has comment: http://stackoverflow.com/comment/89706288
upvote count: 7
downvote count: 1
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/89768250
has comment: http://stackoverflow.com/comment/89705929
answers question: http://stackoverflow.com/q/26901613
has comment: http://stackoverflow.com/comment/89777543

http://stackoverflow.com/q/26881088
tagged with: java
has title: Error in starting of wso2esb-4.8.0 server
type: AnsweredQuestion
downvote count: 0
has body: I have Configured JAVA_HOME and CARBON_HOME properly in windows7, When I try to run the server I am getting bellow error. I had restarted my system couple of times still I am getting the same error. I tried removing CARBON_HOME from environment variable still getting the same error. Please help me out. D:\Program Files\wso2esb-4.8.0\bin>wso2server.bat --run JAVA_HOME environment variable is set to C:\Program Files\Java\jdk1.7.0_60 CARBON_HOME environment variable is set to D:\Program Files\wso2esb-4.8.0 Picked up _JAVA_OPTIONS: -Xms512m -Xmx1024m Error: Could not find or load main class Files\wso2esb-4.8.0\repository\conf\carbon.xml
favorite count: 0
has answer: http://stackoverflow.com/a/26881289
type: Question
score: 1
upvote count: 1
accepted answer: http://stackoverflow.com/a/26881289
answer count: 1

http://stackoverflow.com/q/26952905
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26952922
has body: I'm reverse engineering a protocol and need some help with some of the data transmission. In the data, a value x is stored as a single byte. This piece of data, x, is then turned into values a and b using the code below. a has a maximum value of 10 and b has a maximum value of 3. Here is the code used in the software to extrapolate a and b from x. My question is: how can I generate a value for x, given a and b? int x = data.get_byte(); int a = x &gt;&gt; 2; int b = x &amp; 3;
has comment: http://stackoverflow.com/comment/42446656
has comment: http://stackoverflow.com/comment/42446305
has comment: http://stackoverflow.com/comment/42446478
possible better answer: http://stackoverflow.com/a/26952937
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26952937
accepted answer: http://stackoverflow.com/a/26952922
tagged with: java
tagged with: bit-manipulation
type: Question
has title: Packing two values into one int

http://stackoverflow.com/comment/42382920
score: 0
type: Comment
type: QuestionComment
has text: Can you explain - link contain to genericorder? What container and what do you mean by link
comment on: http://stackoverflow.com/q/26917129

http://stackoverflow.com/q/26862641
has answer: http://stackoverflow.com/a/26862952
tagged with: rmi
tagged with: java
accepted answer: http://stackoverflow.com/a/26862911
possible better answer: http://stackoverflow.com/a/26862952
type: Question
has answer: http://stackoverflow.com/a/26862733
answer count: 3
has answer: http://stackoverflow.com/a/26862911
score: 0
has body: In my RMI program I want to set up my RMI registry on the port 8080, but when I do it, I get an exception. Here is my server code public class Server { public static void main(String[] args) { try { LocateRegistry.createRegistry(8080); MathServerImpl mathServer = new MathServerImpl(); Naming.rebind("MathServer", mathServer); System.out.println("Math Server has started and is running"); } catch (RemoteException | MalformedURLException e) { System.out.println(e.getMessage()); e.printStackTrace(); } } } The code works properly for the port 1099, which is it's default port as far as I know, but for this case it gives me a java.net.ConnectException, and here is the log. java.rmi.ConnectException: Connection refused to host: 10.100.25.173; nested exception is: java.net.ConnectException: Connection refused at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619) at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216) at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202) at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:341) at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source) at java.rmi.Naming.rebind(Naming.java:177) at server.Server.main(Server.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.net.ConnectException: Connection refused at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:39…
type: AnsweredQuestion
has title: How to set a custom port for RMI regisrty?

http://stackoverflow.com/q/26916906
tagged with: java
has comment: http://stackoverflow.com/comment/42384467
type: Question
has body: I’m using log4j (1.2.14) for logging external data. It is information that could not be sent over the network to other applications. I have a RollingFileAppender with maxSize and maxBackupIndex. The logging process works fine. The process creates files as: file.out file.out1 file.out2 .. .. file.out[maxBackupIndex] The problem is that I have another process periodically (when the logging process is off) send and delete (locally) some file to another location. For example: original files list: file.out file.out1 file.out2 file.out3 file.out4 The process sends and deletes file.out1, file.out2. new files list: file.out file.out3 file.out4 Now, the logging process starts again.. Then log4j maintains the “gap” of 2 files… log4j creates: file.out file.out1 file.out4 (content of file.out3) file.out5 (content of file.out4) The problem is when maxBackupIndex is reached. Log4j not completes the gap with free space and begins overwriting the contents of my older files.
has title: Log4j Issue RollingFileAppender maxBackupIndex, maxSize, gap between index
tagged with: log4j
has comment: http://stackoverflow.com/comment/42383744
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: logging

http://stackoverflow.com/a/26955113
accepted answer of: http://stackoverflow.com/q/26951401
score: 2
answers question: http://stackoverflow.com/q/26951401
has comment: http://stackoverflow.com/comment/42454535
has body: Mixing the data model (User entity) and the state of user interface (isSelected) is never a good idea. This is how you can do it (replace T with your object, or create a column object that you can re-use): Column&lt;T, Boolean&gt; checkColumn = new Column&lt;T, Boolean&gt;(new CheckboxCell()) { @Override public Boolean getValue(T object) { return getSelectionModel().isSelected(object); } }; checkColumn.setFieldUpdater(new FieldUpdater&lt;T, Boolean&gt;() { @Override public void update(int index, T object, Boolean value) { getSelectionModel().setSelected(object, value); dataProvider.refresh(); } }); myDataGrid.setSelectionModel(getSelectionModel(), DefaultSelectionEventManager.&lt;T&gt; createCheckboxManager(0)); Header&lt;Boolean&gt; selectAllHeader = new Header&lt;Boolean&gt;(new HeaderCheckbox()) { @Override public Boolean getValue() { for (T item : getVisibleItems()) { if (!getSelectionModel().isSelected(item)) { return false; } } return getVisibleItems().size() &gt; 0; } }; selectAllHeader.setUpdater(new ValueUpdater&lt;Boolean&gt;() { @Override public void update(Boolean value) { for (T object : getVisibleItems()) { getSelectionModel().setSelected(object, value); } } }); myDataGrid.addColumn(checkColumn, selectAllHeader);
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42451475
upvote count: 2

http://stackoverflow.com/q/26924402
tagged with: odoo
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42401407
has title: OpenERP Android App connection?
has body: i am new to android environment i have installed eclipse and android developer tool. my openerp application is running and i coded in "MainActivity.java" in "On create" method that is, import java.net.MalformedURLException; import java.net.URL; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import org.apache.xmlrpc.client.*; import org.apache.xmlrpc.client.XmlRpcClient; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); OpenErpConnect connection=null; try { URL loginUrl=new URL("http","192.xxx.x.xx",xxxx,"/xmlrpc/common"); XmlRpcClient client=new XmlRpcClient(); Integer id=(Integer)client.call("login","new_db","admin","123456"); connection=new OpenErpConnect(server,port,db,user,pass,id); } catch ( XMLRPCException e) { Log.d(CONNECTOR_NAME,e.toString()); } catch ( MalformedURLException e) { Log.d(CONNECTOR_NAME,e.toString()); } catch ( ClassCastException e) { Log.d(CONNECTOR_NAME,e.toString()); } return connection; } i am getting error in line "Integer id=(Integer)client.call("login","new_db","admin","123456");" Errror is, The type org.apache.xmlrpc.common.XmlRpcController cannot be resolved. It is indirectly referenced from required .class files What wrong i am doing i want to get result in android app after connecting from openERP Hopes for your suggestion Thanks
has comment: http://stackoverflow.com/comment/42395779
tagged with: odoo-mobile
tagged with: openerp-7
score: 0
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/5547162
answer count: 0

http://stackoverflow.com/a/26847074
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/26847073
answers question: http://stackoverflow.com/q/26847073
type: Answer
has body: The easiest way to illustrate this is as a shell script. Note that much of it is commented out, but I wanted to leave those here as "notes" for things to try if this still doesn't solve your problems. In my case, suppressing GRE and Cairo was sufficient. Note that the "NOCAIRO" switch could be moved into your exlipse.ini file... I preferred to keep it here so I wouldn't forget to apply it even if I switch to another copy/version of Eclipse. I haven't written this to pass command-line arguments thru to Eclipse; that is left as a simple Exercise For The Reader. One other thought: You may (or may not) want to add the -vm switch to your Eclipse invocation to have Eclipse itself run with a particular copy of the JRE. That too may help keep things stable if you upgrade your system with a newer version of Java. Hope this helps someone... #!/bin/bash # Having some trouble running Eclipse on the latest Open Client for Linux? # This front-end collection of kluges may help. # Workaround for some other display bugs, not currently needed...? # export GDK_NATIVE_WINDOWS=true # Environment switch: Workaround for tooltip bug export GRE_HOME=/DOESNOTEXIST # Java switch: Workaround for Cairo breakage. # This could go into eclipse.ini NOCAIRO=-Dorg.eclipse.swt.internal.gtk.cairoGraphics=false # Java switch: Workaround for xulrunner breakage # There seems to be an open question about which versions work, if any. # Some suggest pointing to a specific 1.9 build, some suggest disabling. # I'm trying without that change for now. # Something like this could go into eclipse.ini #NOXUL=-Dorg.eclipse.swt.browser.XULRunnerPath=/dev/nul NOXUL= # Apply NOCAIRO/NOXUL switches from above # Plus Joe's additional opts... # Show class and workspace name in Eclipse window header eclipse -showlocation -vmargs ${NOCAIRO} ${NOXUL}

http://stackoverflow.com/q/26851538
has answer: http://stackoverflow.com/a/26859484
upvote count: 1
has answer: http://stackoverflow.com/a/26851669
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42265577
score: -1
has comment: http://stackoverflow.com/comment/42265587
has comment: http://stackoverflow.com/comment/42265851
has comment: http://stackoverflow.com/comment/42265516
has comment: http://stackoverflow.com/comment/42265784
has comment: http://stackoverflow.com/comment/42265481
has comment: http://stackoverflow.com/comment/42265405
has body: I would like to check if the result is measurable; that is, whether it has a finite number if decimal places. What do i mean? double x = 5.0 / 9.0; // x = 0.(5) x is not measurable. I want to round x to the second digit ( x = 0.56 ), but in such case: double x = 1.0 / 8.0; // x = 0.125 I don't want to round anything. So here is my question. How do i decide if the result can be measured or not?
favorite count: 0
has comment: http://stackoverflow.com/comment/42265679
has comment: http://stackoverflow.com/comment/42265567
type: UnansweredQuestion
tagged with: numbers
has comment: http://stackoverflow.com/comment/42265605
has title: java How to check if math result is measurable?
tagged with: java
linked to: http://stackoverflow.com/q/26310356
downvote count: 2

http://stackoverflow.com/comment/42320388
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26876037
has text: `android:id="@+id/btnTroop1P2"` must be **already declared** for a View, before you can reference it in another View.
score: 0

http://stackoverflow.com/a/26983383
upvote count: 7
answers question: http://stackoverflow.com/q/26982622
has body: DefaultTableModel has two means by which you can define the number of rows/columns at runtime. You could... Simply create a new DefaultTableModel, passing it the rows and columns you want... DefaultTableModel model = new DefaultTableModel(rows, cols); and then apply this to the JTable. This will, obviously, replace the existing table model, meaning you will lose all of it's data. You could... Create an master DefaultTableModel and apply it to the JTable and simply use model.setRowCount(rows); model.setColumnCount(cols); to dynamically update the number of rows and columns as required. This will allow you to preserve the data within the table model (expect when you remove rows or columns, then it's lost) Runnable example import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.FlowLayout; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSpinner; import javax.swing.JTable; import javax.swing.SpinnerNumberModel; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.table.DefaultTableModel; public class Test { public static void main(String[] args) { new Test(); } public Test() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(new TestPane()); frame.pack(); frame.setLocationRelativeTo(null); frame.setVisible(true); } }); } public class TestPane extends JPanel { private JTable t…
type: AcceptedAnswer
downvote count: 0
score: 7
type: Answer
accepted answer of: http://stackoverflow.com/q/26982622

http://stackoverflow.com/a/26860098
answers question: http://stackoverflow.com/q/26859992
upvote count: 4
has body: Here's what the official documentation says: Database, or system, transaction boundaries are always necessary. No communication with the database can occur outside of a database transaction (this seems to confuse many developers who are used to the auto-commit mode). Always use clear transaction boundaries, even for read-only operations. Depending on your isolation level and database capabilities this might not be required, but there is no downside if you always demarcate transactions explicitly. Certainly, a single database transaction is going to perform better than many small transactions, even for reading data.
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/a/26908826
answers question: http://stackoverflow.com/q/26908428
has body: Look at this simple ready to run example: public static void main(String[] args) { class Academics { String schoolID, sectionID, studentID; public Academics(String schoolID, String sectionID, String studentID) { this.schoolID = schoolID; this.sectionID = sectionID; this.studentID = studentID; } @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("Academics [schoolID="); builder.append(schoolID); builder.append(", sectionID="); builder.append(sectionID); builder.append(", studentID="); builder.append(studentID); builder.append("]"); return builder.toString(); } } List&lt;Academics&gt; academics = new ArrayList&lt;&gt;(Arrays.asList( new Academics("A", "A1", "1"), new Academics("B", "A2", "2"), new Academics("A", "A4", "3"), new Academics("C", "A1", "4"), new Academics("D", "A1", "5"), new Academics("C", "A6", "6"), new Academics("A", "A2", "7"), new Academics("B", "A2", "8") )); List&lt;Comparator&lt;Academics&gt;&gt; columnComparators = new ArrayList&lt;&gt;(); // Group By: schoolID + sectionID + studentID columnComparators.add(new Comparator&lt;Academics&gt;() { @Override public int compare(Academics a, Academics b) { int bySchoolId = a.schoolID.compareTo(b.schoolID); if(bySchoolId == 0){ // equal int bySectionID = a.sectionID.compareTo(b.sectionID); if(bySectionID == 0){// equal return a.studentID.compareTo(b.studentID); } return bySectionID; } return bySchoolId; } }); //... add more Comparators Collections.sort(academics, columnComparators.get(0)); // clickedColumn.getIndex() for (Academics a : academics) { System.out.println(a); } } perhaps you need something like this.
type: Answer
score: 0

http://stackoverflow.com/a/58580415
has body: StringBuilder inside a method would be safe. public void addProperty(String name, String value) { private StringBuilder sb = new StringBuilder("1=2"); if (value != null &amp;&amp; value.length() &gt; 0) { if (sb.length() &gt; 0) { sb.append(','); } sb.append(name).append('=').append(value); } }
type: Answer
answers question: http://stackoverflow.com/q/26860173
score: 0

http://stackoverflow.com/a/26979737
type: Answer
answers question: http://stackoverflow.com/q/26979191
has comment: http://stackoverflow.com/comment/42494298
has body: Try adding your desired locale into the SimpleDateFormat: SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US); The Java documentation for Locale.getDefault() states: The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified. It can be changed using the setDefault(Locale.Category, Locale) method. So the default locale in your JVM may be incorrect. This post delves a little deeper into how the default locale for your application is determined.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42494214
has comment: http://stackoverflow.com/comment/42495884
has comment: http://stackoverflow.com/comment/42494073
accepted answer of: http://stackoverflow.com/q/26979191

http://stackoverflow.com/comment/42448811
comment on: http://stackoverflow.com/a/26954320
has text: @imsocoolhahahaha You may have used a simple boolean variable. We want to have a boolean variable for each possible location, so we'd need a `boolean[][]` of the appropriate size.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/26847014
accepted answer: http://stackoverflow.com/a/26876937
has title: A fatal error has been detected by the Java Runtime Environment with LeapMotion Project
tagged with: leap-motion
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26876937
answer count: 1
score: 0
has body: I'm developing a LeapMotion project. Here is my source code: import java.io.IOException; import com.leapmotion.leap.Controller; import com.leapmotion.leap.Listener; public class Main { public static void main(String[] args) { Controller controller = new Controller(); controller.addListener(new Listener(){ @Override public void onConnect(Controller arg0) { super.onConnect(arg0); System.out.print("\nOnConnect"); } @Override public void onDeviceChange(Controller arg0) { super.onDeviceChange(arg0); System.out.print("\nOnDeviceChanged"); } @Override public void onDisconnect(Controller arg0) { super.onDisconnect(arg0); System.out.print("\nOnDisconnected"); } @Override public void onExit(Controller arg0) { super.onExit(arg0); System.out.print("\nOnExit"); } @Override public void onFocusGained(Controller arg0) { super.onFocusGained(arg0); System.out.print("\nOnFocusGained"); } @Override public void onFocusLost(Controller arg0) { super.onFocusLost(arg0); System.out.print("\nOnFocusLost"); } @Override public void onFrame(Controller arg0) { super.onFrame(arg0); System.out.print("\nOnFrame"); } @Override public void onInit(Controller arg0) { super.onInit(arg0); System.out.print("\nOnInit"); } @Override public void onServiceConnect(Controller arg0) { super.onServiceConnect(arg0); System.out.print("\nOnServiceConnect"); } @Override public void onServiceDisconnect(Controller arg0) { super.onServiceDisconnect(arg0); System.out.print("\nOnServiceDisconnect"); } }); System.out.print("\nKeep proccess until press a key"); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } } } When I excute it, there is an fetal error reported: # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x000000012696f957, pid=7742, tid=23043 # # JRE version: Java(TM) SE Runtime Environment (8.0_05-b13) (build 1.8.0_05-b13) # Java VM: Java HotSpot(TM) 64-Bit Server VM (25.5-b02 mixed mode bsd-amd64 compressed oops) # Problematic frame: # C [libLeap.…

http://stackoverflow.com/comment/42289203
type: Comment
has text: Probably because your method is static and your field 'a' is not. You can't set a non-static variable inside a static method. Try to change the field to static or declare the method as non-static and tell me if that worked
comment on: http://stackoverflow.com/a/26863019
type: AnswerComment
score: 0

http://stackoverflow.com/a/26909882
has body: you can achieve it using this way : -set custom broadcast receiver at the time of Alarm goes off ,in side onReceive() save what ever stuff you want in to preferences or sqlite .
has comment: http://stackoverflow.com/comment/42374295
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26909324
type: Answer
accepted answer of: http://stackoverflow.com/q/26909324
has comment: http://stackoverflow.com/comment/42369537
upvote count: 2
has comment: http://stackoverflow.com/comment/42369651
score: 2

http://stackoverflow.com/q/26953114
tagged with: median
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42446727
has title: QuickSort, Using Median as Pivot. Not Sorting Correctly
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26953180
tagged with: quicksort
tagged with: java
has body: I'm trying to make my own quickSort method and am placing the pivot to be the median value among the first, middle, and last elements of the list. However, when I put some random numbers into an array and then use my quickSort method, they occasionally aren't sorted correctly. I was wondering what the bug in my code is and how I can fix it. public static &lt;T extends Comparable&lt;T&gt;&gt; void quickSort(T[] list) { quickSort(list, 0, list.length-1); } public static &lt;T extends Comparable&lt;T&gt;&gt; void quickSort(T[] list, int first, int last) { int pivotIndex=0; if(last&gt;first) { pivotIndex=partition(list,first,last, smartPivot); quickSort(list, first, pivotIndex-1, smartPivot); quickSort(list,pivotIndex+1, last, smartPivot); } } public static &lt;T extends Comparable&lt;T&gt;&gt; void swap(T[] list, int index, int index2) { T temp=list[index]; list[index]=list[index2]; list[index2]=temp; } public static &lt;T extends Comparable&lt;T&gt;&gt; T median(T[] list, int first, int last) { int pivotIndex=(first+last)/2; if (list[last].compareTo(list[first])&lt;0) { swap(list,first,last); } else if(list[last].compareTo(list[pivotIndex])&lt;0) { swap(list,pivotIndex,last); } else if (list[pivotIndex].compareTo(list[first])&lt;0) { swap(list,first,pivotIndex); } swap(list,pivotIndex, last-1); return list[last-1]; } public static &lt;T extends Comparable&lt;T&gt;&gt; int partition(T[] list, int first, int last) { T pivot=null; int low=first+1; int high=last; pivot=median(list,first,last); while(high&gt;low) { while(low&lt;=high &amp;&amp; list[low].compareTo(pivot)&lt;=0) { low++; } while(low&lt;=high &amp;&amp; list[high].compareTo(pivot)&gt;0) { high--; } if(high&gt;low) { swap(list,high,low); } } while(high&gt;first &amp;&amp; list[high].compareTo(pivot)&gt;=0) { high--; } return first; } public static void main(String[] args) { Integer[] x={34,34543,98,562,1,6456,0,9}; quickSort(x,0,x.length-1); for(int j=0; j&lt;x.length;j++) { System.out.print(x[j]+" "); } }
type: Question

http://stackoverflow.com/comment/42441820
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26844513
has text: anyway it is possible to write a 100% object oriented code
type: AnswerComment

http://stackoverflow.com/q/26895059
has comment: http://stackoverflow.com/comment/44000517
possible better answer: http://stackoverflow.com/a/27796206
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/26895594
has answer: http://stackoverflow.com/a/27796206
accepted answer: http://stackoverflow.com/a/26895594
tagged with: java-8
has answer: http://stackoverflow.com/a/46056910
type: Question
type: AnsweredQuestion
has body: I have this: get ("/test", (req, resp) -&gt; { return repository.getAll(); }, new JsonTransformer()); My transformer looks like: public class JsonTransformer implements ResponseTransformer { ObjectMapper om = new ObjectMapper(); public JsonTransformer() { } @Override public String render(Object o) throws Exception { return om.writeValueAsString(o); } } I've tried adding a header using the header funtion on response like so: get ("/test", (req, resp) -&gt; { resp.header("Content-Type", "application/json"); return repository.getAll(); }, new JsonTransformer()); And I've tried this which I found in the docs: I think this sets the accept-type get ("/test", "application/json", (req, resp) -&gt; { return repository.getAll(); }, new JsonTransformer()); But nowhere I'm getting application/json as my Content-Type header
has comment: http://stackoverflow.com/comment/42343746
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/44000551
tagged with: spark-java
has title: How do I add headers to a response from spark, when using a transformer
answer count: 3
upvote count: 10

http://stackoverflow.com/q/26969163
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28427881
accepted answer: http://stackoverflow.com/a/28427881
tagged with: jsf-1.2
score: 0
answer count: 1
has body: I've got a modalPanel with some components (for example, a tree). At fisrt my actions and actionListners work correclty. After some time (from 5 to 10 minutes) actions stop working completely. The post is fired, but the AjaxViewRoot actions are empty. I have no validation errors. All the page component ids are fixed (not generated) to prevent conversion error. My bean is Conversation scoped and its timeout is over 30 minutes. &lt;rich:modalPanel id="modalId" resizeable="false" autosized="true"&gt; &lt;a4j:include id="myPage" viewId="#{bean.viewId}"/&gt; &lt;/rich:modalPanel&gt; Here is myPage (included page) code: &lt;ui:composition&gt; &lt;h:form id="frmPage"&gt; &lt;h:panelGrid columns="1"&gt; &lt;a4j:region id="treeRegion"&gt; &lt;rich:panel id="tbPanelTrees"&gt; &lt;h:panelGrid columns="2" &gt; &lt;h:panelGroup layout="block" style="height:#{(height-150)/2}px; width:#{(width-20)/2}px; overflow:visible; overflow-y:auto; overflow-x:auto;"&gt; &lt;rich:tree id="subjectTree" style=" height: 100%" switchType="ajax" var="item" nodeFace="#{item.nodeType}" value="#{bean.subjTree.rootSubjectsTree}" adviseNodeOpened="#{bean.subjTree.adviseNodeOpened}" changeExpandListener="#{bean.subjTree.changeExpandListener}" nodeSelectListener="#{bean.subjTree.nodeSelectListener}" ajaxSubmitSelection="true" reRender="elements outside region" ajaxSingle="true" ignoreDupResponses="true"&gt; &lt;rich:treeNode type="root" icon="#{item.subjectsIcon}" iconLeaf="#{item.subjectsIcon}" id="subjectRootNode"&gt; &lt;a4j:commandLink value="#{item.nodeName}" id="subjectRootNodeLink"/&gt; &lt;/rich:treeNode&gt; &lt;rich:treeNode type="user" icon="#{item.userIcon}" iconLeaf="#item.userIcon}" id="userNode"&gt; &lt;a4j:commandLink value="#{item.nodeName}" id="userNodeLink"/&gt; &lt;/rich:treeNode&gt; &lt;/rich:tree&gt; &lt;/h:panelGroup&gt; &lt;/a4j:region&gt; &lt;/h:panel:Grid&gt; &lt;/h:form&gt; &lt;/ui:composition&gt; Does anybody have an idea, what's the problem?
tagged with: richfaces
has comment: http://stackoverflow.com/comment/42499951
has title: JSF actionListner not called after some time
has comment: http://stackoverflow.com/comment/42746104
type: AnsweredQuestion
tagged with: jsf

http://stackoverflow.com/q/26937307
has comment: http://stackoverflow.com/comment/42421694
has comment: http://stackoverflow.com/comment/42418911
answer count: 1
downvote count: 0
has title: LWJGL - Getting error : "Cannot use offsets when Element Array Buffer Object is disabled"
has comment: http://stackoverflow.com/comment/42418951
favorite count: 0
has body: I am trying to render a basic cube in LWJGL (Java). But the program keeps crashing, telling me that it "Cannot use offsets when Element Array Buffer Object is disabled". I am guessing that this is not the exact error right here and there might be something less obvious than that. (I actually did the code that I'm about to show you in C++ and it was working very fine) Init function (called once) FloatBuffer vertices = BufferUtils.createFloatBuffer(4 * 5); vertices.put(new float[]{ // pos // Color 0.5f, 0.5f, 1.0f, 0.0f, 0.5f, 0.5f, -0.5f, 0.5f, 0.0f, 0.75f, -0.5f, -0.5f, 0.0f, 1.0f, 0.0f, -0.5f, 0.5f, 0.5f, 0.5f, 1.0f }); vertices.flip(); indices = BufferUtils.createByteBuffer(2 * 3); indices.put(new byte[]{ 0, 1, 3, 1, 2, 3 }); indices.flip(); // VAO VAO = GL30.glGenVertexArrays(); GL30.glBindVertexArray(VAO); // VBO VBO = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, VBO); glBufferData(GL_ARRAY_BUFFER, vertices, GL_STATIC_DRAW); // IBO IBO = glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER, IBO); glBufferData(GL_ARRAY_BUFFER, indices, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, VBO); glEnableVertexAttribArray(0); // ,-- position in layout (see shader) // | ,-- Nb of component per vertex (2 for 2D (x, y)) // | | ,-- Normalized ? (between 0 - 1) // | | | ,-- Offset between things (size of a line) // | | | | ,- Where to start ? glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, 5 * Float.SIZE , 0); glDisableVertexAttribArray(0); glEnableVertexAttribArray(1); glVertexAttribPointer(1, 3, GL11.GL_FLOAT, false, 5 * Float.SIZE , 2 * Float.SIZE); glDisableVertexAttribArray(1); glBindBuffer(GL_ARRAY_BUFFER, IBO); // Unbinds the VAO GL30.glBindVertexArray(0); And here is the render function (static for now, until I figure this out) glUseProgram(shaderProgram.getID()); GL30.glBindVertexArray(VAO); // Error in the line bellow GL11.glDrawElements(GL11.GL_TRIANGLES, 4, GL11.GL_UNSIGNED_BYTE, 0); GL30.glBindVertexArray(0); A little help would be very appreciated. Also, I might be so…
accepted answer: http://stackoverflow.com/a/26937412
has comment: http://stackoverflow.com/comment/42418979
type: AnsweredQuestion
tagged with: opengl
score: 1
tagged with: java
tagged with: arraybuffer
tagged with: lwjgl
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26937412

http://stackoverflow.com/a/26867401
answers question: http://stackoverflow.com/q/26859576
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42511135
has comment: http://stackoverflow.com/comment/42508275
has body: Alphabetical is how testng orders it. One way can be to use a suite.xml from which you can customize your run any way you like. The below would run all your classes in alphabetical order but one after the other //This is true by default If you want to have a particular order of class execution then instead of specifying packages tag, use the classes tag and put the class names in the order you want them to run. <classes> <class name="YahooTest" /> <class name="GoogleTest" /> <classes> You would need to specify this xml in the surefire plugin configuration section - Refer the using suitexml file section here
has comment: http://stackoverflow.com/comment/42506764
type: Answer
accepted answer of: http://stackoverflow.com/q/26859576
has comment: http://stackoverflow.com/comment/42485926
has comment: http://stackoverflow.com/comment/42508438

http://stackoverflow.com/comment/58338786
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26867322
has text: Have you found any sollution? We just steped in this same problem while trying to update do Java 1.7.
type: AnswerComment

http://stackoverflow.com/comment/42352870
type: AnswerComment
type: Comment
has text: it still doesnt work... had the same effect as i had it when i changed the code to what you posted before you posted it. would you like to see all of the code?
comment on: http://stackoverflow.com/a/26899049
score: 0

http://stackoverflow.com/comment/42370082
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26908430
score: 0
has text: If you like to run integration tests with jacoco you need an agent which must be configured in maven-failsafe-plugin (if we are talking about integration tests) appropriatley. See here: http://www.petrikainulainen.net/programming/maven/creating-code-coverage-reports-for-unit-and-integration-tests-with-the-jacoco-maven-plugin/

http://stackoverflow.com/q/26983709
tagged with: java
tagged with: slick2d
tagged with: lwjgl
has title: LWJGL Package is sealed
type: Question
tagged with: graphics
has body: I'm following along with a youtube tutorial on programming in Java using Slick2D and lwjgl. When I run this code: package game; import org.newdawn.slick.*; import org.newdawn.slick.state.*; public class Game extends StateBasedGame{ public static final String gamename = "Ham Blaster!"; public static final int menu = 0; public static final int play = 1; public Game(String name) { super(name); this.addState(new Menu(menu)); this.addState(new Play(play)); } public static void main(String[] args){ try{ AppGameContainer appgc; appgc = new AppGameContainer(new Game(gamename)); appgc.setDisplayMode(640, 360, false); }catch(SlickException e){ e.printStackTrace(); } } @Override public void initStatesList(GameContainer gc) throws SlickException { this.getState(menu).init(gc, this); this.getState(play).init(gc, this); this.enterState(menu); } } It throws a security exception saying that the package org.lwjgl is sealed. I've added the lwjgl jar file and the two jar files associated with slick (slick2d and lwjgl . jar) to the build path. Is there a solution?
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27223071
tagged with: jar
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27223071

http://stackoverflow.com/a/26835168
accepted answer of: http://stackoverflow.com/q/26835150
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26835150
upvote count: 7
score: 7
has body: Problem 1: Both float[] and Integer are Objects so null can be applied to both constructors. Since there isn't any best suited type compiler can't decide which one should be used. Problem 2: In case of Object and Integer types the most suited one is chosen. For instance if you would pass new Integer(1) as argument then both constructors could be applied because Integer is also Object, but compiler binds this invocation with code from constructor with most precise argument types. Similarly with null, since it can be used as Object and Integer compiler assumes that the more precise type would be Integer. To solve this kind of problems you can specify which type null should represent by casting new Ambigious((Integer)null); You can also try changing one of argument types to non-Object like public Ambigious(int a){//primitive type instead of public Ambigious(Integer a){

http://stackoverflow.com/comment/42532009
score: 0
comment on: http://stackoverflow.com/q/26991296
has text: This question looks like a race condition very similar to: http://stackoverflow.com/questions/2418292/delivery-of-jms-message-before-the-transaction-is-committed Look into Weblogic LLR
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42316023
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26877573
type: Comment
has text: @ajb correct, however this might be simpler to understand in the first instance. I'll add that as an alternative.

http://stackoverflow.com/q/26976704
tagged with: solr
tagged with: java
has comment: http://stackoverflow.com/comment/42488766
type: Question
has comment: http://stackoverflow.com/comment/42488958
score: 0
tagged with: oracle-database
linked to: http://stackoverflow.com/q/4388005
answer count: 0
has title: Solr data-config multiple statements in query
has body: Solr example: &lt;entity name="item" query="select * from item"&gt; If I want to do a query like this: &lt;entity name="item" query="BEGIN some_package.some_function(x,y); END; select * from item"&gt; how can I achieve this in Solr? In the event it isn't obvious what I want to do, I want to run some_function(x,y) right before I execute the standard select * query against my table. I have achieved similar functionality in JDBC
type: UnansweredQuestion

http://stackoverflow.com/comment/42234104
comment on: http://stackoverflow.com/a/26832926
has text: Edited my answer to answer this concern. You really should take time to [study Java collections and how to use them](https://docs.oracle.com/javase/tutorial/collections/).
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42462044
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26961886
has text: @user3249477 Yes, in general, it is working. I just have 213 warning since 1 month

http://stackoverflow.com/q/26984907
tagged with: windows
tagged with: path-separator
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: path
has title: Convert Windows style path into unix path in java code
score: 2
has body: I am working in a java code that was designed to run on windows and contains a lot of references to files using windows style paths "System.getProperty("user.dir")\trash\blah". I am in charge to adapt it and deploy in linux. Is there an efficient way to convert all those paths(\) to unix style (/) like in "System.getProperty("user.dir")/trash/blah". Maybe, some configuration in java or linux to use \ as /.
has answer: http://stackoverflow.com/a/40570167
tagged with: java
has answer: http://stackoverflow.com/a/26985039
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26985160
tagged with: linux
answer count: 3

http://stackoverflow.com/comment/42415690
has text: @user1902288 Glad to hear you're calm :-) The reason I asked OP if it was necessary to continue to loop through the file was to get him thinking about the question (I.E. he's not doing something correctly). Just saw your reply, no worries!
type: Comment
comment on: http://stackoverflow.com/a/26935376
score: 1
type: AnswerComment

http://stackoverflow.com/a/26844934
upvote count: 1
has body: If you have created Thread t = new Thread(); Then the run method would not do anything as Thread's run method is @Override public void run() { if (target != null) { target.run(); } } where the target is null. If you pass a target Thread t = new Thread(target) then thread would execute the target's run method. If you have extended MyThread then run method in MyThread would execute
has comment: http://stackoverflow.com/comment/42259233
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26844544
has comment: http://stackoverflow.com/comment/42253252
answers question: http://stackoverflow.com/q/26844544
type: Answer
score: 1

http://stackoverflow.com/q/26903661
accepted answer: http://stackoverflow.com/a/26903680
has answer: http://stackoverflow.com/a/26903906
downvote count: 0
tagged with: inheritance
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/26903711
favorite count: 0
has answer: http://stackoverflow.com/a/26903803
possible better answer: http://stackoverflow.com/a/26903711
has answer: http://stackoverflow.com/a/26903680
answer count: 4
type: AnsweredQuestion
has body: I have a parent class A, and its child B. Both are having doSomething method with diff type of parameters. Class A package Inheritance; public class A { public void doSomething(Object str){ System.out.println("Base impl:"+str); } } Class B package Inheritance; public class B extends A{ public void doSomething(String str){ System.out.println("Child impl:"+str); } public static void main(String[] args) { A a = new B(); a.doSomething("override"); } } When I run this, I'm getting "Base impl:override" as the output! a is pointing to an object of B, and the he passed argument is String, So shouldn't it call B's doSomething(String str) method?
has title: Why parent class method is getting called and not child class in this case?
tagged with: java
type: Question

http://stackoverflow.com/q/26936783
has comment: http://stackoverflow.com/comment/42418000
tagged with: java
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/42417868
answer count: 1
has comment: http://stackoverflow.com/comment/42418266
has comment: http://stackoverflow.com/comment/42418048
favorite count: 0
has title: Why isnt the move method working in Java?
has answer: http://stackoverflow.com/a/26937528
downvote count: 2
tagged with: swing
has body: I'm new to Java and I just want to know how to move a picture in a JFrame. Ive created a JLabel and added an Icon using the design tab, and added that label to a panel, and I want it to move when a button is pressed. private void jPanel2KeyPressed(java.awt.event.KeyEvent evt) { // TODO add your handling code here: switch (evt.getKeyCode()) { case KeyEvent.VK_UP: move(0, 10); break; case KeyEvent.VK_DOWN: move(0, -10); break; case KeyEvent.VK_LEFT: move(-10, 0); break; case KeyEvent.VK_RIGHT: move(10, 0); break; default: move(0, 10); break; } }
accepted answer: http://stackoverflow.com/a/26937528
type: AnsweredQuestion

currency
tag name: currency
tags question: http://stackoverflow.com/q/26988806
type: Tag
tags question: http://stackoverflow.com/q/26946205

http://stackoverflow.com/comment/42309234
comment on: http://stackoverflow.com/q/26866463
type: Comment
type: QuestionComment
has text: See [The Use of Multiple JFrames, Good/Bad Practice?](http://stackoverflow.com/q/9554636/418556) Either the 2nd frame should be a dialog, or there should be a single frame using a `CardLayout`.
score: 0

http://stackoverflow.com/comment/42301840
comment on: http://stackoverflow.com/a/26871706
type: Comment
score: 0
type: AnswerComment
has text: We have simple way to do it reverse `someString.split();`. So I thought it should be some very simple way to create tokenized `String` from `Array`

http://stackoverflow.com/a/26857088
answers question: http://stackoverflow.com/q/26856897
type: Answer
score: 2
has body: The double type, referred to as a primitive, (the lowercase version, if you will) cannot be null. Primitive values are initialized to a 0.0 (floats and doubles) and 0 (integers, longs, etc). The object version Double (note the uppercase), can be null. If your getValue2 field is of type Double (as opposed to double), and it is null, and you attempt to assign it to a primitive value, a process called unboxing (as mentioned by August) occurs, and you would end up with Null Pointer Exception (NPE). Otherwise, however, if getValue2 is in fact a double (note the lowercase), then you'd simply get back 0.0, and normal calculations can proceed normally from there (though perhaps not with the results you were expecting). As Hovercraft said, simply checking for a null value might be an acceptable solution.
upvote count: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26856897

http://stackoverflow.com/q/26840861
has answer: http://stackoverflow.com/a/26851901
tagged with: jackson
has comment: http://stackoverflow.com/comment/42247680
upvote count: 1
linked to: http://stackoverflow.com/q/17819710
answer count: 1
favorite count: 0
has title: How to write Java class to fetch the object from Json which doesn't have fixed fields?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42246048
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/26851901
linked to: http://stackoverflow.com/q/3522454
has body: I need to have Java class to accommodate below requirement and it should be compatible for Jackson's parsing using Object Mapper. The Json is in below format : [ { "name" : "Snehal", "property1" : "value11", "property2" : "value12", "property3" : "value13", }, { "name" : "Masne", "property1" : "value21", "property2" : "value22", "property3" : "value23", }, ] In above Json, the no. of properties are not fixed, meaning there can be, say, property4, 5, 6, etc The corresponding Java class could be thought of as below : Class MyClass { String name; List&lt;String&gt; properties; // getters, setters, etc } But this wont solve the purpose since, in this case, Json will generated something like of below format: [ { "name" : "Snehal", [ {"property" : "value1" }, {"property" : "value1" }, {"property" : "value1" } ] }, { .... [] } ] How do I implement the Java class to achieve the data in specifeid Json format ?
type: Question
has comment: http://stackoverflow.com/comment/42247434
downvote count: 0
tagged with: pojo

http://stackoverflow.com/comment/42460310
score: 3
comment on: http://stackoverflow.com/q/26961032
type: Comment
type: QuestionComment
has text: Whether s a file name is valid depends on the filesystem you are writing it to i.e. it depends on the path and the machine you are on. There is no absolute check for this.

http://stackoverflow.com/comment/42251543
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26844114
type: Comment
has text: Thanks mjn for your reply. I change session1 to session2. But problem is again same.

http://stackoverflow.com/comment/42316946
score: 0
has text: Thanks for the reply. Unfortunately it's a bit large and spread out across methods.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26878396

http://stackoverflow.com/a/77046800
score: -1
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26864662
has body: Faced the same issue while upgrading to OpenJDK17 from JDK8 and got this error while executing Java -version in cmd. Fix: goto path C:\Program Files\Java\jdk-17\bin copy files java.exe and javaw.exe, goto path C:\ProgramData\Oracle\Java\javapath and delete the existing shortcuts( I had java 8 before this and shortcuts were placed to java.exe, javaw.exe &amp; javaws.exe.) and paste these two files there.
upvote count: 0
has comment: http://stackoverflow.com/comment/135837625

http://stackoverflow.com/q/26881914
type: UnansweredQuestion
has title: How to use variable sent from modelmap in js render iteration loop
tagged with: spring
tagged with: java
linked to: http://stackoverflow.com/q/12235319
has answer: http://stackoverflow.com/a/26919314
type: Question
has comment: http://stackoverflow.com/comment/42320819
tagged with: javascript
has comment: http://stackoverflow.com/comment/42319709
has body: I am sending a variable in a modelmap from java controller to a view like this : @RequestMapping(value = "/someAction", method = RequestMethod.GET) public String search(ModelMap model) { model.addAttribute("myVariable",true); return "myView"; //returns the view } Now i have this view file "myView.html" where i've used jsrender and that has a data and i iterate it like given below.Also i need to use the "myVariable" inside that iteration like this : &lt;script id="iterData" type="text/x-jsrender"&gt; {^{for #data}} {{if Name != '-'}} {{if Age =='20'}} {{if myVariable??}} //This part doesnt work.I wonder how to use it here //Some codes {{/if}} {{/if}} {{/if}} {{/for}} &lt;/script&gt; Can anyone help me how i could use the "myvariable" inside the jsrender iteration??
score: 0
answer count: 1
tagged with: web
tagged with: jsrender
has comment: http://stackoverflow.com/comment/42346753

http://stackoverflow.com/q/26895163
answer count: 2
has comment: http://stackoverflow.com/comment/42354573
downvote count: 0
has comment: http://stackoverflow.com/comment/42355655
tagged with: 7zip
favorite count: 0
has comment: http://stackoverflow.com/comment/42351164
has comment: http://stackoverflow.com/comment/42350716
upvote count: 2
has comment: http://stackoverflow.com/comment/42358349
tagged with: archlinux
has answer: http://stackoverflow.com/a/26935852
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/30600986
accepted answer: http://stackoverflow.com/a/26935852
has title: Failed to load 7z-JBinding: no 7-Zip-JBinding in java.library.path
tagged with: java
has comment: http://stackoverflow.com/comment/42415812
possible better answer: http://stackoverflow.com/a/30600986
has body: System details: Linux 3.14.21-1-MANJARO x64 Java version: java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) dependencies installed: java-p7zip-binding and p7zip I've installed filebot to maintain a media library on my system, however, whenever I execute the program, I get the following error: SevenZipNativeInitializationException: Failed to load 7z-JBinding: no 7-Zip-JBinding in java.library.path As mentioned above, I do have the required dependencies installed. When I use java -XshowSettings:properties I get this output with my library paths Property settings: awt.toolkit = sun.awt.X11.XToolkit file.encoding = UTF-8 file.encoding.pkg = sun.io file.separator = / java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment java.awt.printerjob = sun.print.PSPrinterJob java.class.path = . java.class.version = 52.0 java.endorsed.dirs = /usr/lib/jvm/java-8-jdk/jre/lib/endorsed java.ext.dirs = /usr/lib/jvm/java-8-jdk/jre/lib/ext /usr/java/packages/lib/ext java.home = /usr/lib/jvm/java-8-jdk/jre java.io.tmpdir = /tmp java.library.path = /usr/java/packages/lib/amd64 /usr/lib64 /lib64 /lib /usr/lib java.runtime.name = Java(TM) SE Runtime Environment java.runtime.version = 1.8.0_25-b17 java.specification.name = Java Platform API Specification java.specification.vendor = Oracle Corporation java.specification.version = 1.8 java.vendor = Oracle Corporation java.vendor.url = http://java.oracle.com/ java.vendor.url.bug = http://bugreport.sun.com/bugreport/ java.version = 1.8.0_25 java.vm.info = mixed mode java.vm.name = Java HotSpot(TM) 64-Bit Server VM java.vm.specification.name = Java Virtual Machine Specification java.vm.specification.vendor = Oracle Corporation java.vm.specification.version = 1.8 java.vm.vendor = Oracle Corporation java.vm.version = 25.25-b02 line.separator = \n os.arch = amd64 os.name = Linux os.version = 3.14.21-1-MANJARO path.separator = : sun.arch.data.model = 64 sun.boot.c…
type: Question

http://stackoverflow.com/comment/42474276
score: 0
type: QuestionComment
has text: Keep duplicated values in an array and then `System.out` the values, checking if there is already one. Map can help you easily on that.
type: Comment
comment on: http://stackoverflow.com/q/26968958

http://stackoverflow.com/comment/42263710
comment on: http://stackoverflow.com/q/26850168
has text: fix the code, maybe?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/38729176
answers question: http://stackoverflow.com/q/26843104
downvote count: 0
type: Answer
score: 13
upvote count: 13
has body: In short, JNP is the official JNDI naming implementation of JBoss AS prior to its version &lt; 7.x, based on the JNP project (refer to the code repo URL). From the new AS7 documentation: Previous versions of JBoss AS (versions &lt; 7.x) used JNP project as the JNDI naming implementation. Developers of client applications of previous versions of JBoss AS will be familiar with the jnp:// PROVIDER_URL URL they used to use in their applications for communicating with the JNDI server on the JBoss server. Starting AS7, the JNP project is not used. Neither on the server side nor on the client side. The client side of the JNP project has now been replaced by jboss-remote-naming project. There were various reasons why the JNP client was replaced by jboss-remote-naming project. One of them was the JNP project did not allow fine grained security configurations while communicating with the JNDI server. The jboss-remote-naming project is backed by the jboss-remoting project which allows much more and better control over security. Its specification is poor, most of the references we find about it are located at JBoss docs prior to the version 7, like in https://docs.jboss.org/jbossas/jboss4guide/r1/html/ch3.chapter.html

http://stackoverflow.com/q/26935887
type: UnansweredQuestion
type: Question
has title: Fresh download of wso2 G-Reg server throws NoClassDefFoundError exception on startup
tagged with: wso2-governance-registry
tagged with: wso2
score: 1
tagged with: java
tagged with: middleware
upvote count: 1
answer count: 1
favorite count: 0
has body: During start-up the logs show a NoClassDefFoundError exception for class javax/servlet/ServletContextAttributeListener right after successfully loading StandardContext STRATOS_ROOT: [2014-11-14 17:03:35,840] ERROR {org.apache.catalina.core.StandardContext} - Error configuring application listener of class com.sun.xml.ws.transport.http.servlet.WSServletContextListener java.lang.NoClassDefFoundError: javax/servlet/ServletContextAttributeListener at java.lang.ClassLoader.defineClass1(Native Method) Environment: Windows 7 x64, Oracle JDK 7 (build 1.7.0_71-b14) Is anybody else experiencing this issue? Any advice on how to get it working correctly?
has answer: http://stackoverflow.com/a/27243470
downvote count: 0

http://stackoverflow.com/comment/42250326
has text: @user2517096 thats great.. hope you will upvote or accept the answer if it helped.. :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26841649
type: Comment

http://stackoverflow.com/q/26886374
tagged with: sdk
tagged with: android
has body: After updating Java and Android SDK for some reason I keep getting the following message: 'Running Android Lint' has encountered a problem. An internal error occured during: "Running Android Lint" When I click on details, it says: An internal error occurred during: "Running Android Lint". com/android/sdklib/SdkVersionInfo I changed target SDK to the latest version. Of course I could just turn off checking for errors. But how do I solve this issue properly?
has title: Android Lint issue in Eclipse after Java update
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26887569
type: Question
score: 0
answer count: 1

http://stackoverflow.com/comment/42293750
score: 1
comment on: http://stackoverflow.com/q/26867158
type: Comment
type: QuestionComment
has text: With "fast", do you mean fast to implement or is it essential that the runtime performance is fast? You can surely use XPath to select nodes based on their text content, which is fast and easy to implement, but probably won't have optimal runtime performance.

http://stackoverflow.com/a/26937461
type: Answer
has body: Instead of using a switch statement, I recommend putting every character you want to test (A, B, C, D) into an array, and then using the XOR operation to calculate the index of each character from the iteration number in a manner similar to the following: char[] l = new char[]{'A','B','C','D'}; int n = 2; char[] test1 = new char[n]; char[] test2 = new char[n]; int max = (int)Math.pow(l.length, n); for (int i = 0; i &lt; max; i++) { for (int k = 0; k &lt; n; k++) { test2[k] = l[(i % (int)Math.pow(l.length, k + 1)) / (int)Math.pow(l.length, k)]; } for (int j = 0; j &lt; max; j++) { for (int k = 0; k &lt; n; k++) { test1[k] = l[(j % (int)Math.pow(l.length, k + 1)) / (int)Math.pow(l.length, k)]; } int k = fordi.calculate(test1, test2); System.out.println(new String(test1) + "-" + new String(test2)); System.out.println(k); } } You can add more characters to l as well as increase n and it should still work. Of course, this can be further optimized, but you should get the idea. Hope this answer helps!
answers question: http://stackoverflow.com/q/26932605
score: 0

opencv
type: Tag
tags question: http://stackoverflow.com/q/26845885
tags question: http://stackoverflow.com/q/26872173
tags question: http://stackoverflow.com/q/26849618
tags question: http://stackoverflow.com/q/26908462
tags question: http://stackoverflow.com/q/26949689
tag name: opencv
tags question: http://stackoverflow.com/q/26921089
tags question: http://stackoverflow.com/q/26896815
tags question: http://stackoverflow.com/q/26860992
tags question: http://stackoverflow.com/q/26867276
tags question: http://stackoverflow.com/q/26928831
tags question: http://stackoverflow.com/q/26872350
tags question: http://stackoverflow.com/q/26948110
tags question: http://stackoverflow.com/q/26921971
tags question: http://stackoverflow.com/q/26833892

http://stackoverflow.com/comment/42435465
comment on: http://stackoverflow.com/a/26946585
type: Comment
score: 0
type: AnswerComment
has text: I misinterpreted the question then. I'll edit my answer.

http://stackoverflow.com/a/27015416
score: 1
has body: Refresh the project (project right-click > refresh) Clean the project (Window 'Project' Menu > Clean...) Fix Android Project (project right-click > Android Tools > Fix Project Properties)erties. ADT is not perfect and sometimes it gets random errors that are fixed with a general clean-up.
answers question: http://stackoverflow.com/q/26899559
downvote count: 0
has comment: http://stackoverflow.com/comment/42640319
type: Answer
upvote count: 1

http://stackoverflow.com/q/26908910
tagged with: java
upvote count: 18
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/11342010
tagged with: servlets
accepted answer: http://stackoverflow.com/a/26909479
has comment: http://stackoverflow.com/comment/107562531
answer count: 1
score: 17
favorite count: 0
has title: Spring MVC Execution Order: Filter and Interceptor
tagged with: spring
has body: I'm developing a spring MVC application that uses a filter implementing javax.servlet.Filter and an Interceptor extending org.springframework.web.servlet.handler.HandlerInterceptorAdapter. As far as I know, the control flow of Spring MVC is something like this: Request arrives at DispatcherServlet. DispatcherServlet sends it to Interceptor and the overrided preHandle method is executed. Request arrives at the matching Controller. After processing the request, if postHandle method of interceptor is also overrided Spring executes its code. DispatcherServlet uses the view resolver and sends the model to view, rendering it. Doing some tests I can see my filter is always executed BEFORE the preHandle method. It seems to be the first executed thing after DispatcherServlet. It's ok, but I do not find the reason for this behaviour. Someone with a good explanation? Thanks! UPDATE: Possibility: It's because filter is defined in web.xml (like DispatcherServlet) so Filter is executed before DispatcherServlet?
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26909479

http://stackoverflow.com/q/26895462
has comment: http://stackoverflow.com/comment/42344336
has comment: http://stackoverflow.com/comment/42346158
tagged with: tree
tagged with: treenode
has body: I stuck at the following problem: I have these input file, and I have to restore the tree schema from it. I'm new in java, I had read a lot and I have seriously difficulties with this task. Please give me some ideas to help. Thanks in advance! And now the following file: http://universumerp.com/sites/default/files/treedata.txt And once again THANK YOU!
has title: Build tree from input file on java
tagged with: java
tagged with: file
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26906693
type: UnansweredQuestion

http://stackoverflow.com/a/26909794
answers question: http://stackoverflow.com/q/26909750
has comment: http://stackoverflow.com/comment/42369449
type: Answer
has comment: http://stackoverflow.com/comment/42370020
has body: We have known, value of element will be clone when we get it from a Map No, it won't. It's unclear exactly how you're seeing your original output, but that's not the normal behaviour. Here's a short but complete example based on your code: import java.util.HashMap; import java.util.Map; class MyObject { private String name; public void setName(String name) { this.name = name; } public void printName() { System.out.println(name); } } class Test { public static void main(String[] args) throws Exception { Map&lt;String, MyObject&gt; map = new HashMap&lt;&gt;(); MyObject obj1 = new MyObject(); map.put("id1", obj1); MyObject obj2 = map.get("id1"); obj1.setName("AAA"); obj2.setName("BBB"); obj1.printName(); obj2.printName(); } } This prints "BBB" twice, contrary to the claim in the question. Presumably you've got code a bit like your sample code, which produces the different output that we can't reproduce with the code you have provided. You should examine your real code closely to work out where the difference is between that and what you've provided. No cloning occurs by default with any of the standard collections.
score: 7
upvote count: 7
has comment: http://stackoverflow.com/comment/42369670
downvote count: 0

http://stackoverflow.com/comment/42259928
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26847199
has text: Is `query` being passed on correctly?
type: Comment

http://stackoverflow.com/q/26944700
has comment: http://stackoverflow.com/comment/42432359
accepted answer: http://stackoverflow.com/a/26944832
has comment: http://stackoverflow.com/comment/42432235
upvote count: 1
has title: multithreading in java,difficulty in wait
has answer: http://stackoverflow.com/a/26944832
favorite count: 0
has comment: http://stackoverflow.com/comment/42432165
linked to: http://stackoverflow.com/q/886722
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42432195
has body: This is the part of my code,I am facing problems in using wait() class Leader extends Thread { private Table table; synchronized public void run() { while(true) { try { while(table.getResources()!=0) wait(); table.putResources(5); // here I am updating the value(I have a table class) } catch(InterruptedException e) { } } } } class Soldier extends Thread { public void run() { while(true) { try { synchronized(this) { if(table.getResources()==this.need_Value) //checking value of resource { sleep(1000); table.clearResources(); //this will put the value of resource to 0 notifyAll(); } } } catch(InterruptedException e) { } } } } So basically I have a thread of leader class and a thread of Leader class. Initially resources is 0 so in the Soldier class resources is updated to 5. Suppose now for Soldier class need_Value was 5,so it will update value of resources to 0. So now Leader class should again run as resources is 0,but actually it is still waiting. So is there anything wrong with my wait()? PS- Assume I have Table class and all the constructors and variables used. I have omitted them because the code was too long
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42432277
has answer: http://stackoverflow.com/a/26944784
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42432232
possible better answer: http://stackoverflow.com/a/26944784
type: Question
has comment: http://stackoverflow.com/comment/42432344
answer count: 2

http://stackoverflow.com/comment/42483531
has text: Sorry. Its an OLE Object
comment on: http://stackoverflow.com/q/26971621
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/26988688
has comment: http://stackoverflow.com/comment/42509665
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/26988895
has comment: http://stackoverflow.com/comment/42509521
has title: JAVA REGEX :: Could you explain this?
tagged with: regex
has comment: http://stackoverflow.com/comment/42509747
type: AnsweredQuestion
has body: My pattern is [a-z][\\*\\+\\-_\\.\\,\\|\\s]?\\b My Result: a__ not matched a_. pattern matched = a_ a._ pattern matched = a. a.. pattern matched = a why my first input is alone not matched??? Thanks in advance. [ PS: got the same result with [a-z][\\*\\+\\-\\_\\.\\,\\|\\s]?\\b ]
tagged with: word-boundary
tagged with: java
has answer: http://stackoverflow.com/a/26988756
accepted answer: http://stackoverflow.com/a/26988756
type: Question
has comment: http://stackoverflow.com/comment/42509972
has answer: http://stackoverflow.com/a/26988895
has comment: http://stackoverflow.com/comment/42509488
has comment: http://stackoverflow.com/comment/42509485

http://stackoverflow.com/comment/42485114
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26974835
has text: Unfortunately, I've never done JSONP with Spring, but as far as I am familiar with JSONP, it needs a callback function to pass the result to. This would not be the same as the `success` ajax handler. The jQuery ajax request supports a `jsonpCallback` parameter, that should be the name of the callback function. Check out [this tutorial](http://www.iceycake.com/2012/06/xml-json-jsonp-web-service-endpoints-spring-3-1/) for reference, I hope this helps you solve the issue

http://stackoverflow.com/comment/42345854
type: Comment
type: QuestionComment
score: 2
has text: It simple try to compare if two objects point to the same heap memory address
comment on: http://stackoverflow.com/q/26896228

http://stackoverflow.com/comment/42298992
has text: And read/learn about and apply indentation. Your code is very hard to read.
score: 1
comment on: http://stackoverflow.com/q/26870093
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42369837
comment on: http://stackoverflow.com/a/26909850
type: Comment
type: AnswerComment
score: 0
has text: Start the thread foodThread inside the Board class without public Food food;

http://stackoverflow.com/comment/42423113
type: QuestionComment
comment on: http://stackoverflow.com/q/26939140
has text: Yes, I am absolutely sure TestMessage is and will always be the only message stored in the stream. Does this mean I have no need for headers and I can just write as is with continual appends to the single file? Is readLine completely out of the question for this?
score: 0
type: Comment

http://stackoverflow.com/a/26981619
has comment: http://stackoverflow.com/comment/42497599
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42497565
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/26981534
downvote count: 0
answers question: http://stackoverflow.com/q/26981534
has body: Try specifying the path instead of just FirstPart.txt like src/main/java/FirstPart.txt according to the error the file is not found.

http://stackoverflow.com/comment/42287465
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26863014
has text: As correct as @Misha s answer but a bit more detail - thus accepted

http://stackoverflow.com/q/26954045
has comment: http://stackoverflow.com/comment/42448234
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26954106
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/66606510
has answer: http://stackoverflow.com/a/26954079
tagged with: class
has answer: http://stackoverflow.com/a/26954081
has comment: http://stackoverflow.com/comment/42448257
has title: Timer to measure array sort
has answer: http://stackoverflow.com/a/26954076
downvote count: 0
accepted answer: http://stackoverflow.com/a/26954081
favorite count: 0
has body: Program to create a timer, and use it to measure how long it takes to create and sort an array. I'm getting red highlights in eclipse. Further explanation in comments. public class StopWatch { private double startTime; private double endTime; public void start() { startTime = System.currentTimeMillis(); } public void stop() { endTime = System.currentTimeMillis(); } public double getElapsedTime(endTime, startTime) { return endTime - startTime; } } Test class import java.util.Arrays; public class TestStopWatch { Stopwatch.start(); int[] array = new int[1000000]; { for (int i = 0; i &lt; 999999; i++) { array[i] = (int) Math.random() * 100; } Arrays.sort(array); } Stopwatch.stop(); System.out.println(getElapsedTime()); }
possible better answer: http://stackoverflow.com/a/26954076

http://stackoverflow.com/q/26862264
has comment: http://stackoverflow.com/comment/42287670
has comment: http://stackoverflow.com/comment/42303478
tagged with: java
has body: I'm working with the dropbox api to java and i have trying to read from dropbox. When I use the path of the api it looks like this - טיול פסח path: /Public/טיול פסח (Ignore the hebrew words it's like - someFolderName paht: /Public/someFolderName) and it's looks as usual, but when I try to go to this path it's give me this exception - Exception in thread "main" java.lang.NullPointerException at node.Main.listFolders(Main.java:102) at node.Main.main(Main.java:112) When I use the toString() method of the api that give some of the metaData including the path of the folder it's shows me this - טיול פסח toString(): Folder("/Public/טיול פסח"...) When the string within the quotes should be the path. When I tried to enter this as the path it's give me this exception - Exception in thread "main" java.lang.NullPointerException at node.Main.listFolders(Main.java:102) at node.Main.main(Main.java:112) The code example: The path is "/Public" and it's the argument s. client is the access to my dropbox. listing is list of children of the root folder. public static void listFolders(String s) throws DbxException, IOException { //list of children. DbxEntry.WithChildren listing = client.getMetadataWithChildren(s); for (DbxEntry child : listing.children) { System.out.println(" " + child.name + " toString(): " + child.toString()); System.out.println(" " + child.name + " path: " + child.path); } } The output of this with "/Public" as argument is: טיול פסח toString(): Folder("/Public/טיול פסח", iconName="folder", mightHaveThumbnail=false) טיול פסח path: /Public/ Any thoughts?
has comment: http://stackoverflow.com/comment/42290616
score: 2
tagged with: api
tagged with: dropbox
answer count: 0
downvote count: 0
type: UnansweredQuestion
favorite count: 0
tagged with: dropbox-api
type: Question
tagged with: hebrew
has title: how to change hebrew path into english in dropbox api(Java)
has comment: http://stackoverflow.com/comment/42287543
has comment: http://stackoverflow.com/comment/42285767
upvote count: 2

http://stackoverflow.com/q/26904050
tagged with: java
has comment: http://stackoverflow.com/comment/42359624
type: Question
tagged with: database
has title: Specify JDBC connection details
score: 0
has comment: http://stackoverflow.com/comment/42359716
linked to: http://stackoverflow.com/q/25258461
type: UnansweredQuestion
tagged with: jdbc
tagged with: database-connection
has body: I am trying to connect to a JDBC data source (on virtual machine) I am specifying the same in the following formats. In settings.xml as below; &lt;properties&gt; &lt;jdbc.url&gt;jdbc:oracle:thin:@//remotevm.us.mycompany.com:1521/XE&lt;/jdbc.url&gt; &lt;jdbc.username&gt;my_local&lt;/jdbc.username&gt; &lt;jdbc.password&gt;my_local&lt;/jdbc.password&gt; &lt;/properties&gt; Also in my weblogic console (under Data sources), I specify the following URL; jdbc:oracle:thin:@//remotevm.us.mycompany.com:1521:XE Are there any issues with the above? I am asking this as I am getting an error: Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'jdbc.APP'. Resolved 'jdbc'; remaining name 'APP' Just to add, I am able to connect through SQL developer with the above details (Hostname, Service name, Username/Pwd).
answer count: 0

http://stackoverflow.com/q/26855102
has comment: http://stackoverflow.com/comment/70491002
score: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26857010
tagged with: jakarta-mail
answer count: 1
tagged with: mime
downvote count: 0
favorite count: 0
tagged with: smime
has title: Java - Using JavaMail to send and receive S/MIME messages
has body: JavaMail makes it easy to send MIME messages. How can I use it to send S/MIME? (I know JavaMail-Crypto is designed to solve this, but it seems incomplete and abandoned). I'd like to send and receive, encrypt and sign, decrypt and verify, using X.509 certs.
type: UnansweredQuestion
upvote count: 3
tagged with: encryption

http://stackoverflow.com/a/26938545
has body: You can't use --deep. It sounds like the right option to use, since you also need to sign the embedded JRE, but it won't work. From Apple's docs: Important: While the --deep option can be applied to a signing operation, this is not recommended. We recommend that you sign code inside out in individual stages (as Xcode does automatically). Signing with --deep is for emergency repairs and temporary adjustments only. After a lot of hair-pulling, I cobbled this together from various tutorials. This one was the most helpful. Here was my final solution as an Ant script: <arg line="a+w ${build.dir}/Mac/MyApp.app/Contents/PlugIns/jre"/> <arg line="-f -s 'Developer ID Application: My Organization'"/> <fileset dir="${build.dir}/Mac/MyApp.app/Contents/PlugIns/jre" /> <arg line="-f -s 'Developer ID Application: My Organization' MyApp.app/Contents/PlugIns/jre"/> <arg line="-f -s 'Developer ID Application: My Organization' MyApp.app/Contents/PlugIns/jre/Contents/_CodeSignature/CodeResources"/> <arg line="-f -s 'Developer ID Application: My Organization' MyApp.app"/> <arg line="-vv MyApp.app"/> <arg line="-vv --assess --type execute MyApp.app"/> Another thing to look out for is not to use the command-line zip to package your app after signing, because it will break the codesign of the app. You should package it using productbuild, PackageMaker, xip, or in a dmg.
has comment: http://stackoverflow.com/comment/42434941
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/26938414
accepted answer of: http://stackoverflow.com/q/26938414
has comment: http://stackoverflow.com/comment/42432970
has comment: http://stackoverflow.com/comment/42436358
score: 8
has comment: http://stackoverflow.com/comment/42435384
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42464805
type: Comment
score: 1
has text: thx for the useful ans. read WAITING only- passed on TIMED_WAITING all along.
comment on: http://stackoverflow.com/a/26963416
type: AnswerComment

http://stackoverflow.com/a/26956048
downvote count: 0
has body: you have to change your code to this : { View view = inflate(getContext(), R.layout.player_small, null); addView(view); } you can inflate views with layout attribute not id
answers question: http://stackoverflow.com/q/26956000
accepted answer of: http://stackoverflow.com/q/26956000
upvote count: 8
type: AcceptedAnswer
type: Answer
score: 8

http://stackoverflow.com/comment/42363927
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26884415
has text: No. What I'm saying is that this isn't a helpful response to OP's problem. It may answer the question he asked, but isn't what he needs. If OP (or anyone else reading this) follows your example, they are going down the wrong path (IMHO). Just my 2 cents.
score: 0

http://stackoverflow.com/comment/42391625
has text: http://imgur.com/iIlq1Wv Wouldn't put the picture up for some reason.
comment on: http://stackoverflow.com/q/26921915
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26976566
downvote count: 0
answers question: http://stackoverflow.com/q/26976135
has comment: http://stackoverflow.com/comment/42492182
has body: Tips: Romain guy said: "I didn’t say don’t use RelativeLayout, you just must be aware of its (possible) impact on performance if used at the top of the tree." Much better to use a simple FrameLayout if you can. Be aware of the scaleType property in ImageView's If you want the ImageView to be the same size as the parent then you need to set it as match_parent height and width. If you use wrap content it will depend on the size of the bitmap and the resolution. Consider using match_parent instead of the deprecated fill_parent I would prefer Picasso for bitmaps management. - &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout 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"&gt; &lt;ImageView android:id="@+id/myImageView" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/myImageSouce" android:scaleType="centerCrop"/&gt; &lt;TextView android:id="@+id/myImageViewText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="@dimen/spacing_medium" android:layout_gravity="center" tools:text="Test"/&gt; &lt;/FrameLayout&gt;
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/42491890
score: 2

http://stackoverflow.com/q/26975428
favorite count: 0
has comment: http://stackoverflow.com/comment/42488508
accepted answer: http://stackoverflow.com/a/26992185
upvote count: 1
has title: What does "Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1" mean
has body: I would like to save two entities with the following relationship: @Entity public class Synonyme { @OneToMany(fetch=FetchType.LAZY, cascade=CascadeType.ALL, orphanRemoval = true) @JoinColumn(name="ID", nullable = false) private List&lt;Term&gt; terms = new ArrayList&lt;&gt;(); } @Entity public class Term { private String word; public static createTerm(String word, Synonyme newSyn, Long someothercriteria) { Term term = new Term(); ... newSyn.addTerm(term); } } And I want to save them like this: Synonyme newSyn= Synonyme.createSynonyme (); entityManager.persist(newSyn); for(String word : words) { Term term = Term.createTerm(word, newSyn, 0L ); } entityManager.flush(); These codes work fine in Junit-Test (The Junit-Test uses an in-memory database of spring) but if I use them in the real database I got the following exception: Caused by: javax.persistence.PersistenceException: org.hibernate.jdbc.BatchedTooManyRowsAffectedException: Batch update returned unexpected row count from update [0]; actual row count: 2; expected: 1 I don't understand this exception. What does it mean and what I could do?
has comment: http://stackoverflow.com/comment/42514050
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/69182533
type: Question
answer count: 2
downvote count: 0
tagged with: hibernate-entitymanager
has answer: http://stackoverflow.com/a/26992185
possible better answer: http://stackoverflow.com/a/69182533
tagged with: entitymanager
tagged with: entity
tagged with: jdbc

http://stackoverflow.com/q/26898373
tagged with: java
accepted answer: http://stackoverflow.com/a/26898527
has title: opening a file on a button click
answer count: 1
score: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26898527
tagged with: file
type: Question
has body: I have java project in which a button opens a pdf file when the project was exported to runnable jar the file don't open !! that's my button listener public void about (Event event){ if (Desktop.isDesktopSupported()) { try { File myFile = new File("src/application/Documenation.pdf"); Desktop.getDesktop().open(myFile); } catch (IOException ex) { // no application registered for PDFs } } }

http://stackoverflow.com/q/26944282
has answer: http://stackoverflow.com/a/26944410
has title: Java boolean[] to byte[] and back
accepted answer: http://stackoverflow.com/a/26944410
tagged with: boolean
has body: I am sending byte[] arrays over a socket connection in Java. I have a pretty long boolean[] array, where array.length % 8 == 0. I'd like to convert this boolean[] array into a byte[] array with 8 times as few elements, so that I can then send the byte[] over the socket connection. The boolean[] array looks like this: 01011010 10101010 01100011 11001010 etc. The byte[] in this case should look like this: 0x5A 0xAA 0x63 0xCA. I have found some code on another question on how to convert a single byte into a boolean[] array and added a new method to it to convert an entire array here: public static boolean[] booleanArrayFromByteArray(byte[] x) { boolean[] y = new boolean[x.length * 8]; int position = 0; for(byte z : x) { boolean[] temp = booleanArrayFromByte(z); System.arraycopy(temp, 0, y, position, 8); position += 8; } return y; } public static boolean[] booleanArrayFromByte(byte x) { boolean bs[] = new boolean[4]; bs[0] = ((x &amp; 0x01) != 0); bs[1] = ((x &amp; 0x02) != 0); bs[2] = ((x &amp; 0x04) != 0); bs[3] = ((x &amp; 0x08) != 0); return bs; } I'd like to know if there is a more efficient way of doing this. Edit: Thanks
downvote count: 1
has answer: http://stackoverflow.com/a/26944869
favorite count: 0
upvote count: 5
tagged with: byte
answer count: 4
has comment: http://stackoverflow.com/comment/42431681
has comment: http://stackoverflow.com/comment/42431628
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/36465370
has answer: http://stackoverflow.com/a/26944494
tagged with: java
possible better answer: http://stackoverflow.com/a/26944869
has comment: http://stackoverflow.com/comment/42431429
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/42431794
score: 4

http://stackoverflow.com/a/26899783
score: 1
has body: Try this: public boolean removeAccount(String accountNumber) { Iterator&lt;Account&gt; iterator = accounts.iterator(); while (iterator.hasNext()) { if (accountNumber.equals(iterator.next().getAccountNumber())) { System.out.println("Found It!"); iterator.remove(); return true; } } return false; } Removing an item from a list while you are looping through it is not a safe operation, but the Iterator class makes this possible. More information: Iterating through a Collection, avoiding ConcurrentModificationException when removing in loop
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26896505
upvote count: 1

http://stackoverflow.com/q/26952751
has body: I've been having trouble with Maven. Searched around but couldn't find anyone with similar problem or explanation. I am packaging a webapp with maven's generate archetype using openjdk7 for jre and jdk. Using Lubuntu Os. I am not using Eclipse or Netbeans since my computer is too slow to support it (runs too slow, I can't take it). Plus I'll have to create the war for the live webapp soon (outside of eclipse). What happens: I run mvn package and it create's the .war file. There's only warnings about UTF-8 encoding. I fixed all other warnings which were about plugin version in the pom. When I open the war, my views are gone and my spring-context file is gone. Any ideas?
tagged with: maven
tagged with: spring
answer count: 1
has answer: http://stackoverflow.com/a/26952940
tagged with: java
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26952940
type: Question
has title: Maven Build Views & XML Files Missing
linked to: http://stackoverflow.com/q/19786142
has comment: http://stackoverflow.com/comment/42446035
score: 0

http://stackoverflow.com/comment/42287811
type: AnswerComment
comment on: http://stackoverflow.com/a/26844493
has text: I used this `Sysout("1)"+Class.forName("org.apache.commons.dbcp.DelegatingConnection").getClassLoader().toString()); conn=ds.getConnection(); Sysout("2)"+conn.getClass().getClassLoader().toString());` OP 1)WebappClassLoader delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: StandardClassLoader delegate: true repositories: file:D:\Apache Software Foundation\Tomcat 5.0\shared\classes\ -2) StandardClassLoader delegate: true repositories: file:D:\Apache Software Foundation\Tomcat 5.0\common\classes\
type: Comment
score: 0

http://stackoverflow.com/q/26836411
has answer: http://stackoverflow.com/a/26836437
tagged with: type-conversion
score: 0
answer count: 2
has body: I could not find out why "Encrypt" function still reads "message" as string although I have changed the data type to bytes with different methods. The error message is "The method Encrypt(long, long, long, long, int) in the type prince is not applicable for the arguments (String, long, long, long, int)". btnSendSMS.setOnClickListener(new View.OnClickListener() { public void onClick(View v, String args) { String phoneNo = txtPhoneNo.getText().toString(); String message = txtMessage.getText().toString(); if (phoneNo.length()&gt;0 &amp;&amp; message.length()&gt;0){ //prince pri = new prince(); //message = toLong(); //byte[] data = message.getBytes("UTF-8"); //LongBuffer messageToLongBuffer; //String str = message; //byte[] array = str.getBytes(); String str = message; byte[] bytes = message.getBytes(); prince.Encrypt (message, k0, kop, k1, t); //maybe check to decrypt the ciphertext here //prince.decrypt(message) //sendSMS explore the sendDataMessage sendSMS(phoneNo, message); } else Toast.makeText(getBaseContext(), "Please enter both phone number and message.", Toast.LENGTH_SHORT).show(); }
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42238565
has answer: http://stackoverflow.com/a/26836433
has title: The method Encrypt(long, long, long, long, int) in the type prince is not applicable for the arguments (String, long, long, long, int)
has comment: http://stackoverflow.com/comment/42238593
tagged with: java
type: Question

generator
tags question: http://stackoverflow.com/q/26954494
type: Tag
tag name: generator

http://stackoverflow.com/comment/42273650
type: Comment
score: 0
has text: i recommend perusing this: https://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html - it's a good place to start
type: AnswerComment
comment on: http://stackoverflow.com/a/26834042

http://stackoverflow.com/comment/42419881
comment on: http://stackoverflow.com/q/26937732
score: 0
type: Comment
has text: Sure, I believe that I put that in the first block of code. If not, let me know.
type: QuestionComment

http://stackoverflow.com/q/26971143
answer count: 2
has answer: http://stackoverflow.com/a/59390948
accepted answer: http://stackoverflow.com/a/26971172
tagged with: android
has body: I am working on a project where the user is allowed to type only password with letters, alphabets and special characters like (@.#$%^&amp;_-&amp;*) alone in a edittext. I tried various methods like. **Note: space is strictly restricted Method 1: setting digits in layout as follows android:digits="0,1,2,3,4,5,6,7,8,9,*@#$%_-\^.&amp;&lt;qwertzuiopasdfghjklyxcvbnmABCDEFGHIJKLMNOPQRSTUVWXYZ" This method is working fine but i could able to type brackets'(', semicolon ';' and i could not type slash '\' (which i have added in the digits tag) Method 2: By trying regex with following method public static boolean limitPasswordCharacters(String about){ // UserName Validation Pattern String final Pattern USER_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9@.#$%^&amp;*_&amp;\\]+$"); if(USER_NAME_PATTERN.matcher(about).matches()){ return true; } return false; } But unfortunately gettting exception as 11-17 16:18:11.155: E/AndroidRuntime(15877): java.util.regex.PatternSyntaxException: Missing closing bracket in character class near index 22: 11-17 16:18:11.155: E/AndroidRuntime(15877): [a-zA-Z0-9@.#$%^&amp;*_&amp;\]
tagged with: regex
tagged with: android-edittext
upvote count: 2
tagged with: java
type: AnsweredQuestion
score: 2
tagged with: validation
downvote count: 0
has answer: http://stackoverflow.com/a/26971172
has title: Restrict special characters in android password edittext
favorite count: 0
possible better answer: http://stackoverflow.com/a/59390948
type: Question

http://stackoverflow.com/comment/42371327
type: AnswerComment
score: 0
type: Comment
has text: The first item in an array (or list) is always located at array[0], so if you have an array with a length of 0 then array[0] does not exist! So always be careful that you check the length of an array or list before trying to access it using array[index] or you might get an ArrayIndexOutOfBoundsException. Also it looks like you'll have to find out why your array isnt being filled with the data you're trying to load. In any case, good luck and glad I could help :)
comment on: http://stackoverflow.com/a/26886471

http://stackoverflow.com/q/26980437
tagged with: sql
answer count: 1
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/26984909
tagged with: criteria-api
type: AnsweredQuestion
has body: I have an example MyTable with 3 columns - id, common_id, creation_date, where common_id groups entries. Now I would like to select using CriteriaBuilder all newest entries from each group (that is for each common_id get me latest creation_date). In SQL the query would look like this: select * from MyTable where (common_id, creation_date) in (select common_id, max(creation_date) from MyTable group by common_id) Now I have tried to create the where predicate by writing something like (cb is CriteriaBuilder, root is a Root): cb.array(root.get('common_id'), cb.max(root.get('creation_date'))) .in( query.subquery(MyTable.class) .select(cb.array(root.get('common_id'), cb.max(root.get('creation_date')))) .groupBy(root.get('common_id'))) But unfortunately cb.array is not an Expression (it's a CompoundSelect), so I cannot use .in() on it. Thanks for pointers!
tagged with: java
type: Question
has title: How to use multiple values in WHERE using JPA CriteriaBuilder
score: 2
tagged with: criteria
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/26984909

http://stackoverflow.com/q/26899550
tagged with: date
has comment: http://stackoverflow.com/comment/42351923
has answer: http://stackoverflow.com/a/26905439
type: Question
has answer: http://stackoverflow.com/a/26899623
has answer: http://stackoverflow.com/a/26899617
score: 4
linked to: http://stackoverflow.com/q/2132247
answer count: 3
has title: java date format with 6 digit micro/milli second
has body: From the Postgres Database I am getting a 6 digit microsecond (its actually a ) e.g. 2014-11-10 04:05:06.999999 now when i apply a date format of "yyyy-MM-dd HH:mm:ss.SSS" it converts the 999999 to corresponding seconds/minutes resulting in incorrect date. See code snippet below String dt = "2014-11-10 04:05:06.999999"; String timeseriesFormat = "yyyy-MM-dd HH:mm:ss.SSS"; SimpleDateFormat dateFormat = new SimpleDateFormat(timeseriesFormat); Date date = dateFormat.parse(dt); System.out.println(dateFormat.format(date)); results in 2014-11-10 04:21:45.999 I want to rather truncate the last 3 digits and keep a date of 2014-11-10 04:05:06.999. How to truncate it? I do not want to use any framework like joda etc.
favorite count: 0
downvote count: 0
type: UnansweredQuestion
upvote count: 4
tagged with: format
tagged with: java

http://stackoverflow.com/q/26923554
has comment: http://stackoverflow.com/comment/78106108
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/42537133
answer count: 0
downvote count: 0
has body: My heroku web app (java/ spring framework /boot) shows start up times of 20 - 30 seconds but still shows a port binding timeout of over 60 seconds in the logs. What is causing this? I have 2 dynos and my jvm settigs are -Xms768m -Xmx768m -Xmn192m
score: 1
has title: Heroku app crashes on boot timeout (60 seconds) but app started in 30 seconds
tagged with: java
has comment: http://stackoverflow.com/comment/42580271
type: Question
tagged with: heroku
has comment: http://stackoverflow.com/comment/42526520
tagged with: timeout

http://stackoverflow.com/comment/42452366
comment on: http://stackoverflow.com/a/26956151
score: 0
type: AnswerComment
has text: Check this to know why it is so---http://stackoverflow.com/questions/19101776/scanner-hasnext-results-in-an-infinite-loop
type: Comment

http://stackoverflow.com/comment/42472027
has text: That expression will overflow the int datatype. Try using long constants. (e.g. 365L * 24L *60L...). Also you have not taken daylight saving or leap seconds into account. Do they matter for your use cases?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26967476

http://stackoverflow.com/comment/42382329
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26895028
has text: You sure, because when I press the 2 buttons at the downside of the app, nothing is happening. While the left down button should start a new game, and the right left button should exit the app. Is it working at your side?

http://stackoverflow.com/comment/42462912
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26962388
has text: @rc is it possible you could post a link or something like that which would be helpful to start on with this ?
score: 0

http://stackoverflow.com/comment/42267836
has text: You're kind of just writing what I already gave as answer? :)
comment on: http://stackoverflow.com/a/26852593
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26876836
downvote count: 0
tagged with: arff
favorite count: 0
has comment: http://stackoverflow.com/comment/42318066
has title: Premature end of line in weka
has body: I have some data inside arff file and I can't convert it. I don't know what is wrong. @RELATION relationName @ATTRIBUTE IP STRING @ATTRIBUTE data STRING @ATTRIBUTE adress STRING @ATTRIBUTE error_code STRING @ATTRIBUTE dunno STRING @ATTRIBUTE class STRING @DATA 202.32.92.47,01:Jun:1995:00:00:59,/~scottp/publish.html,200,271 ix-or7-27.ix.netcom.com,112,/~ladd/ostriches.html,200,20 ... I'm getting error like: Unable to determine as arff (Reason: java.io.IOException: premature end of line, read Token [EOL], line 11. The line 11 is after the first row. I was also trying to convert it to csv with headers like a : a b c d e but then I'm getting an error like a : wrong headers...
accepted answer: http://stackoverflow.com/a/26877635
type: AnsweredQuestion
tagged with: ioexception
tagged with: java
type: Question
upvote count: 4
answer count: 1
score: 4
tagged with: weka
has answer: http://stackoverflow.com/a/26877635

http://stackoverflow.com/a/26966328
accepted answer of: http://stackoverflow.com/q/26966195
has body: When you do, double x = 7.0; double y = Math.pow(x, 1000.0); // &lt;-- INFINITY you do exceed the precision of double and you get Double.POSITIVE_INFINITY System.out.println(y); Output is Infinity When you cast that to int you get Integer.MAX_VALUE which is 2^31-1 or 2147483647. If you want to get a more convincing result you could use BigInteger like int n = BigInteger.valueOf(7).pow(1000).intValue(); System.out.println(n); Output is 432069569 Of course, the real result is obtained by System.out.println(BigInteger.valueOf(7).pow(1000)); Which results in a very big number indeed.
answers question: http://stackoverflow.com/q/26966195
score: 0
has comment: http://stackoverflow.com/comment/42470131
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/comment/42445361
score: 0
type: AnswerComment
type: Comment
has text: The wav may include some encoding or compression so it might be not able to be played with Java .. As Java supports PCM wav .. Try to download this wav file and test it in your code http://download.wavetlan.com/SVV/Media/HTTP/WAV/Media-Convert/Media-Convert_test1_Alaw_Mono_VBR_8SS_16000Hz.wav
comment on: http://stackoverflow.com/a/26940999

http://stackoverflow.com/comment/42336749
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26891333
has text: This class is a inner class of a bigger one. I declared button in the superclass.

.net
tags question: http://stackoverflow.com/q/26836889
tag name: .net
tags question: http://stackoverflow.com/q/26844324
type: Tag
tags question: http://stackoverflow.com/q/26905839
tags question: http://stackoverflow.com/q/26929686

http://stackoverflow.com/q/26870444
has title: Generic type extending interface, cant access interface methods without warning
type: AnsweredQuestion
downvote count: 0
accepted answer: http://stackoverflow.com/a/26870476
type: Question
possible better answer: http://stackoverflow.com/a/26870486
tagged with: hashmap
score: 1
has answer: http://stackoverflow.com/a/26870486
tagged with: java
tagged with: comparable
has answer: http://stackoverflow.com/a/26870476
answer count: 2
upvote count: 1
has body: If I have a generic class, public class Graph&lt;K, V extends Comparable&gt; { ... } My understanding is that any object of type V is going be comparable since it extends the interface Comparable. Now I want to use a HashMap&lt;K, V&gt; inside my class. An object of type V inside my map should still be comparable. I declare a method: public V getMin(HashMap&lt;K, V&gt; map, V zero) { V min = zero; for (V value : map.values()) { if (value.compareTo(min) &lt; 0) { min = value; } } return min; } When compiling, I get warning warning: [unchecked] unchecked call to compareTo(T) as a member of the raw type Comparable if (value.compareTo(min) &lt; 0) { where T is a type-variable: T extends Object declared in interface comprable I interpret this warning as that the compiler is not sure whether value is comparable or not. Why not? What is the problem here and how do I get around it?
has comment: http://stackoverflow.com/comment/42299734
favorite count: 0
tagged with: generics

http://stackoverflow.com/comment/42260350
type: Comment
has text: So just putting the junit.zip in the classpath is not enough? It should be in ant/lib folder?
comment on: http://stackoverflow.com/a/26848832
type: AnswerComment
score: 0

http://stackoverflow.com/q/26894241
answer count: 1
tagged with: persistence
has comment: http://stackoverflow.com/comment/42342391
favorite count: 0
has comment: http://stackoverflow.com/comment/42342516
type: UnansweredQuestion
tagged with: orm
downvote count: 1
has comment: http://stackoverflow.com/comment/42342632
tagged with: java
tagged with: hibernate
has body: I have a problem understanding Hibernate. I got a Object from my Database. e.g a Java object like this, created by calling a Hibernate function: Person: id,forename,name etc. When I got that Object I like write it into a HashMap and to print it as a Json, the only thing I get is: "de.test.carSharing.Person@7eab0d73" I don't know why, because I can access all Values desperately but not the Person Object. Can anyone give me a Hint? I'm using a Hibernate XML Mapping and my Transaction is alright. I'm very thankful for any Answer.
score: -1
has comment: http://stackoverflow.com/comment/42342294
type: Question
has title: Retriev Data from Persisten Object in Hibernate
has answer: http://stackoverflow.com/a/26894626
upvote count: 0

http://stackoverflow.com/q/26891449
tagged with: google-cloud-messaging
has body: Implementing gcm third party server, we decided to use http integration and followed google instructions. They provide an implementation of the integration here. We used it and sent notifications to 500 000 users using java tasks to be more effective (we need to notify our users as quick as possible). We were surprised because http request to GCM servers could take sometimes more than 15 sec. We set log in gcm-server source and find out this issue. Code with custom log: public MulticastResult sendNoRetry(Message message, List&lt;String&gt; registrationIds) throws IOException { if (nonNull(registrationIds).isEmpty()) { throw new IllegalArgumentException("registrationIds cannot be empty"); } Date startDate = new Date(); Map&lt;Object, Object&gt; jsonRequest = new HashMap&lt;Object, Object&gt;(); setJsonField(jsonRequest, PARAM_TIME_TO_LIVE, message.getTimeToLive()); setJsonField(jsonRequest, PARAM_COLLAPSE_KEY, message.getCollapseKey()); setJsonField(jsonRequest, PARAM_RESTRICTED_PACKAGE_NAME, message.getRestrictedPackageName()); setJsonField(jsonRequest, PARAM_DELAY_WHILE_IDLE, message.isDelayWhileIdle()); setJsonField(jsonRequest, PARAM_DRY_RUN, message.isDryRun()); jsonRequest.put(JSON_REGISTRATION_IDS, registrationIds); Map&lt;String, String&gt; payload = message.getData(); if (!payload.isEmpty()) { jsonRequest.put(JSON_PAYLOAD, payload); } String requestBody = JSONValue.toJSONString(jsonRequest); log.debug("JSON request: " + requestBody); HttpURLConnection conn; int status; Date beforeHttpRequest = new Date(); try { conn = post(GCM_SEND_ENDPOINT, "application/json", requestBody); status = conn.getResponseCode(); } catch (IOException e) { log.error("IOException posting to GCM", e); return null; } Date afterHttpRequest = new Date(); String responseBody; if (status != 200) { try { responseBody = getAndClose(conn.getErrorStream()); log.debug("JSON error response: " + responseBody); } catch (IOException e) { // ignore the exception since it will thrown an // InvalidRe…
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26950987
tagged with: http
type: Question
has answer: http://stackoverflow.com/a/26950987
score: 0
tagged with: multitasking
answer count: 1
has title: Why http request can take 15 sec with "GCM HTTP Connection Server "

http://stackoverflow.com/comment/42279098
type: AnswerComment
comment on: http://stackoverflow.com/a/26858629
type: Comment
has text: Not wanting to digress too much in comment, but usually its best to represent a grid with a `class` with `Width` and `Height` properties rather than just use a multidimensional array. That way the code makes more sense and effectively becomes self commenting...
score: 0

http://stackoverflow.com/q/26913315
has comment: http://stackoverflow.com/comment/42376161
has comment: http://stackoverflow.com/comment/42376301
tagged with: contacts
tagged with: android
score: 2
answer count: 0
downvote count: 0
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/26906756
has comment: http://stackoverflow.com/comment/42376356
type: Question
tagged with: android-contacts
linked to: http://stackoverflow.com/q/26906756
has comment: http://stackoverflow.com/comment/42376578
tagged with: java
has comment: http://stackoverflow.com/comment/42378605
has comment: http://stackoverflow.com/comment/42376615
upvote count: 2
has comment: http://stackoverflow.com/comment/42377068
has body: i'm kinda new to android developing, and i'm completely stuck now! so i'm hoping that you will help me! So - i'm trying to get the phone number and email address from a contact, in a contact picker. but when i'm displaying the output, it says it is 0 and null. what am I doing wrong? here's the code! if (view == btnPhonebook2) { Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); startActivityForResult(intent, PICK_CONTACT); } public void onActivityResult(int reqCode, int resultCode, Intent data) { super.onActivityResult(reqCode, resultCode, data); switch (reqCode) { case (PICK_CONTACT): if (resultCode == Activity.RESULT_OK) { // String id = null; // FIRST TRY Uri contactData = data.getData(); Cursor c = managedQuery(contactData, null, null, null, null); if(c.moveToFirst()) { String name = c.getString(c.getColumnIndexOrThrow(People.NAME)); int number = c.getInt(c.getColumnIndexOrThrow(People.PRIMARY_PHONE_ID)); String email = c.getString(c.getColumnIndexOrThrow(People.PRIMARY_EMAIL_ID)); //+" : c.getInt(c.getColumnIndexOrThrow(People.NUMBER)); Toast.makeText(getApplicationContext(),"you selected : "+name+"\n With the telephone number :"+number+"\n And the email :"+email,Toast.LENGTH_LONG).show(); DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which){ case DialogInterface.BUTTON_POSITIVE: Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + "60158096")); startActivity(intent); break; case DialogInterface.BUTTON_NEGATIVE: Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, new String[]{"emailExample@gmail.com"}); email.putExtra(Intent.EXTRA_SUBJECT, "subject"); email.putExtra(Intent.EXTRA_TEXT, "message"); email.setType("message/rfc822"); startActivity(Intent.createChooser(email, "Choose an Email client :")); break; } } }; AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.…
has title: phone number from device returns 0
favorite count: 0

http://stackoverflow.com/comment/42290812
comment on: http://stackoverflow.com/q/26865654
type: Comment
has text: I don't understand what you want to return. First you say that you want to return the indicator. Then you say that you want blank text instead of the indicator. So, if you want blank text, just don't select the indicator.
score: 0
type: QuestionComment

http://stackoverflow.com/q/26931113
has comment: http://stackoverflow.com/comment/42409791
has body: I have a custom annotation: @Target({ElementType.METHOD, ElementType.TYPE}) @Retention(RetentionPolicy.RUNTIME) public @interface FeatureSwitch { String featureName(); } I intercept this with the below aspect and use it to check if a feature is on or off. If the feature is off, then I throw an exception. Aspect: @Aspect public class FeatureSwitchAspect { private final FeatureSwitchConfigurationApi featureSwitchConfigurationApi; public FeatureSwitchAspect(final FeatureSwitchConfigurationApi featureSwitchConfigurationApi) { this.featureSwitchConfigurationApi = featureSwitchConfigurationApi; } @Before("@annotation(featureSwitch)") public void checkFeatureSwitch(final FeatureSwitch featureSwitch) { final String featureName = featureSwitch.featureName(); Boolean featSwitch = featureSwitchConfigurationApi.isFeatureActive(featureName); if (!featSwitch) { throw new FeatureSwitchOffException(); } } } The problem I am having is that the behaviour seems inconsistent. This seems to do as expected when I call a method from a different class, but if I make a call to an annotated private method, no interception occurs. Have I got it configured incorrectly? Any suggestions would be appreciated.
has answer: http://stackoverflow.com/a/26932603
tagged with: aop
upvote count: 3
answer count: 2
favorite count: 0
possible better answer: http://stackoverflow.com/a/26931178
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/26931178
downvote count: 0
has title: Intercept private annotated method with AOP
tagged with: java
accepted answer: http://stackoverflow.com/a/26932603
has comment: http://stackoverflow.com/comment/42407353
type: Question

http://stackoverflow.com/comment/42482084
has text: Then that could be the problem I mentioned in my comment. Try setting your prefix to `/WEB-INF/pages/` (notice the trailing slash).
comment on: http://stackoverflow.com/q/26972988
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42478722
type: AnswerComment
type: Comment
has text: @MichaelVandenZegel strange. I hit the URL with params and it returned `{"success":1}`. I see no reason why it should give you that exception. Are you sure the error is on your line where you call `makeHttpRequest()`?
comment on: http://stackoverflow.com/a/26971006
score: 0

http://stackoverflow.com/a/26877626
has comment: http://stackoverflow.com/comment/42339032
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
has body: What you want is getDirectories(). A branch spec is a mapping between two branches (which are usually but not necessarily top-level depot paths). Usually if you're talking about a single "branch" what you're talking about is a depot path, e.g. "//depot/main", rather than a branch spec. To get the list of folders under the "main" branch you'd ask for the list of directories matching "//depot/main/*".
accepted answer of: http://stackoverflow.com/q/26874508
has comment: http://stackoverflow.com/comment/42344072
upvote count: 3
answers question: http://stackoverflow.com/q/26874508

database-scan
tags question: http://stackoverflow.com/q/26938671
tag name: database-scan
type: Tag

http://stackoverflow.com/q/26919701
has comment: http://stackoverflow.com/comment/42387743
linked to: http://stackoverflow.com/q/2605032
favorite count: 0
has answer: http://stackoverflow.com/a/57306845
has body: I am trying to make a program that executes a particular method when the class name and method name are passed as String parameter to the caller. Consider the code below. I have a class CarBean : public class CarBean { private String brand; private String color; /** * @return the brand */ public String getBrand() { return brand; } /** * @param the brand to set */ public void setBrand(String brand) { this.brand= brand; } /** * @return the color */ public String getColor() { return color; } /** * @param the color to set */ public void setColor(String color) { this.color= color; } } Now I want to run this via a method as below : runTheMehod("CarBean","getColor"); The implementation of runTheMethod would be like this : public runTheMethod(String className, String methodName){ try { Object carObj = Class.forName(className).newInstance(); //What to do now??? } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { e.printStackTrace(); } } I can get an object using the class name. Now I need to cast it to a CarBean object and then I can run its method. So wondering how to cast it at runtime as the classname would be different for each call. Also, can I check whether the class has specific method before I try call it? Any suggestion on the problem would be appreciated. Also, I'm all ears to know if there is a better approach to do this.
has comment: http://stackoverflow.com/comment/42387905
has answer: http://stackoverflow.com/a/26919757
has answer: http://stackoverflow.com/a/26919745
accepted answer: http://stackoverflow.com/a/26919745
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/42387722
has comment: http://stackoverflow.com/comment/42387982
has comment: http://stackoverflow.com/comment/42387775
tagged with: java
has comment: http://stackoverflow.com/comment/42387951
linked to: http://stackoverflow.com/q/22419511
type: Question
has comment: http://stackoverflow.com/comment/42388832
downvote count: 0
has title: Run a java method by passing class name and method name as parameter
possible better answer: http://stackoverflow.com/a/26919757
has comment: http://stackoverflow.com/comment/101059279
upvote count: 3
has comment: http://stackoverflow.com/comment/42388888
answer count: 3
has comment: http://stackoverflow.com/comment/42387823
has comment: http://stackoverflow.com/comment/42388015

http://stackoverflow.com/a/26881738
answers question: http://stackoverflow.com/q/26881657
has body: Wrap the code in SwingUtilities.invokeAndWait() (or SwingUtilities.invokeLater()) if(i==1){ JLabel picSecond = new JLabel(new ImageIcon("Bomber.jpg"));//&lt;--Fact is I dont want to create another JLabel, I want to modify the pic location content in JLabel pic. picSecond.setSize(100, 100); panel.add(picSecond); } label.setText("Time: "+i); TO avoid recreation of the JLabel make it the class' field and add to panel just once. Then use picSecond.setIcon() to update the image. BTW it's better to have kind of images cache to avoid image recreation on each step.
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26881657

http://stackoverflow.com/comment/42281964
has text: Can you break this down into something I can finish reading before Christmas? Could you build the smallest possible program that exhibits your problem? And tell us exactly what the problem is - just "my code doesn't work" isn't really good enough.
comment on: http://stackoverflow.com/q/26860654
score: 2
type: Comment
type: QuestionComment

tomcat
tags question: http://stackoverflow.com/q/26952300
tags question: http://stackoverflow.com/q/26965494
tags question: http://stackoverflow.com/q/26880304
tags question: http://stackoverflow.com/q/26862455
tags question: http://stackoverflow.com/q/26861999
tags question: http://stackoverflow.com/q/26927717
tags question: http://stackoverflow.com/q/26835645
tags question: http://stackoverflow.com/q/26925825
tags question: http://stackoverflow.com/q/26890908
tags question: http://stackoverflow.com/q/26876943
tags question: http://stackoverflow.com/q/26973954
tags question: http://stackoverflow.com/q/26935752
tags question: http://stackoverflow.com/q/26975344
tags question: http://stackoverflow.com/q/26841349
tags question: http://stackoverflow.com/q/26875824
tags question: http://stackoverflow.com/q/26892417
tags question: http://stackoverflow.com/q/26983024
tags question: http://stackoverflow.com/q/26953634
tags question: http://stackoverflow.com/q/26950197
tags question: http://stackoverflow.com/q/26933374
tags question: http://stackoverflow.com/q/26914456
tags question: http://stackoverflow.com/q/26890405
tags question: http://stackoverflow.com/q/26886563
tags question: http://stackoverflow.com/q/26951986
tags question: http://stackoverflow.com/q/26858399
tag name: tomcat
tags question: http://stackoverflow.com/q/26891786
tags question: http://stackoverflow.com/q/26884817
tags question: http://stackoverflow.com/q/26939417
tags question: http://stackoverflow.com/q/26890168
tags question: http://stackoverflow.com/q/26903958
tags question: http://stackoverflow.com/q/26847043
tags question: http://stackoverflow.com/q/26843524
tags question: http://stackoverflow.com/q/26950279
tags question: http://stackoverflow.com/q/26980233
tags question: http://stackoverflow.com/q/26954920
tags question: http://stackoverflow.com/q/26950104
tags question: http://stackoverflow.com/q/26899528
tags question: http://stackoverflow.com/q/26884252
tags question: http://stackoverflow.com/q/26837011
tags question: http://stackoverflow.com/q/26894248
tags question: http://stackoverflow.com/q/26861163
tags question: http://stackoverflow.com/q/26939313
tags question: http://stackoverflow.com/q/26989524
tags question: http://stackoverflow.com/q/26915053
tags question: http://stackoverflow.com/q/26896510
type: Tag
tags question: http://stackoverflow.com/q/26842458
tags question: http://stackoverflow.com/q/26904005
tags question: http://stackoverflow.com/q/26894230
tags question: http://stackoverflow.com/q/26876383
tags question: http://stackoverflow.com/q/26979083
tags question: http://stackoverflow.com/q/26878764
tags question: http://stackoverflow.com/q/26946101
tags question: http://stackoverflow.com/q/26984784
tags question: http://stackoverflow.com/q/26852771
tags question: http://stackoverflow.com/q/26904952
tags question: http://stackoverflow.com/q/26861848
tags question: http://stackoverflow.com/q/26937029
tags question: http://stackoverflow.com/q/26967234
tags question: http://stackoverflow.com/q/26944802
tags question: http://stackoverflow.com/q/26866975
tags question: http://stackoverflow.com/q/26989211

http://stackoverflow.com/q/26928953
has title: java regex match string with asterisks
accepted answer: http://stackoverflow.com/a/26929844
type: Question
answer count: 2
score: -1
has comment: http://stackoverflow.com/comment/42405541
has answer: http://stackoverflow.com/a/26929844
has comment: http://stackoverflow.com/comment/42403568
downvote count: 1
tagged with: string
favorite count: 0
tagged with: pattern-matching
has answer: http://stackoverflow.com/a/26929284
upvote count: 0
tagged with: regex
possible better answer: http://stackoverflow.com/a/26929284
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42403692
has body: I have to create a regular expression that compares strings like those inserted into the following list: ArrayList&lt;String&gt; entries = new ArrayList&lt;&gt;(); entries.add("text1/*"); entries.add("text2/*/*"); entries.add("text2/*/*/*"); entries.add("text1/*/*"); entries.add("text1/value1/*"); entries.add("*/*"); If I've a string like "text1/value1/value2" how can I understand which is the matching one iterating through entries? Among the entries above, for example, the correct one would be the fifth entry "text1/value1/*".
tagged with: java

http://stackoverflow.com/comment/42546500
type: Comment
comment on: http://stackoverflow.com/q/26973196
score: 0
type: QuestionComment
has text: This is not possible.Consumer can consume only a single message at a time ,once it has been processed other message is picked up an so on..

http://stackoverflow.com/comment/42512144
type: Comment
comment on: http://stackoverflow.com/q/26983165
score: 0
type: QuestionComment
has text: Also, I would like to comment that Peter Duniho is also correct, but that's not what's currently effecting the application. (I would know, because I wrote the original tutorial.) However, the version of DataInputStream that you're using deprecated and should be replaced. (Download link in part 11 of tutorial series)

http://stackoverflow.com/a/26873859
upvote count: 2
answers question: http://stackoverflow.com/q/26873772
type: Answer
has body: No you don't "convert" the Image to a ToolKitImage, but that's what the JVM is giving you when you call new ImageIcon("res\\gui\\bar.png").getImage(), and not a BufferedImage. The ImageIcon API states that getImage() returns an object of Image type, but does not specify what type of Image. Since Image is an interface, you know that there must be some concrete type underlying the returned Image object. If you need a BufferedImage you could one, and draw this Image into it. Myself, I wouldn't even use an ImageIcon here if I wanted a BufferedImage, but rather would use ImageIO.read(...) which returns a BufferedImage. So.... BufferedImage img = ImageIO.read(getClass().getResourceAsStream("res/gui/bar.png")); Sprite healthBar = new Sprite(img);
score: 2
downvote count: 0

http://stackoverflow.com/comment/42443599
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26951069
type: Comment
has text: Sorry, I don't have time to look at the entire algorithm. Hopefully you've at least got past the initial infinite loop question and can progress. It might be worth posting a new question based on your current position.

charsequence
tags question: http://stackoverflow.com/q/26977605
type: Tag
tag name: charsequence

http://stackoverflow.com/comment/42288252
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26864116
has text: Something is fundamentally wrong here. `accounts.get(...)` returns an `Account` object, while `accountNumber` is of type `String`. Would you mind explaining what exactly are you trying to compare???

http://stackoverflow.com/comment/42441200
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26949564
has text: I'll try what you said. I did write the code myself (obviously with the help of my textbook), thanks!
score: 0

http://stackoverflow.com/comment/69893688
score: 1
type: AnswerComment
has text: did not work for me, I added two waits for it to work, invisibility then visibility
comment on: http://stackoverflow.com/a/26934458
type: Comment

http://stackoverflow.com/comment/42448257
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26954045
score: 0
has text: Are you trying to put code directly in the class? You need to put code in a (perhaps main) method.

http://stackoverflow.com/q/26970495
has body: I am using Java technology for my development. I need to find Dynamic allocated Ip address of system using previous allocated dynamic ip. There are 2 scenarios for this: 1.In first I am storing previous IP in my database so need to find IP using previous IP. 2.When user connect any USB modem/Dongle then Dynamic IP changes automatically so how to get newly allocated IP with help of previous IP. Till now I tried lots of things but won't get useful help regarding this. I want to find ip's only using java technology as I never work on such task.
has answer: http://stackoverflow.com/a/26970603
tagged with: dynamic-ip
tagged with: dynamic
upvote count: 2
type: UnansweredQuestion
downvote count: 2
type: Question
has title: Get Dynamic ip address Java?
tagged with: java
tagged with: servlets
linked to: http://stackoverflow.com/q/9481865
answer count: 1
favorite count: 0
score: 0

http://stackoverflow.com/a/26862666
upvote count: 2
type: Answer
score: 2
downvote count: 0
has body: Because StringBuilder is not a synchronized one whereas StringBuffer is a synchronized one.When using StringBuilder in a multithreaded environment multiple threads can acess the StringBuilder object simultaneously and the output it produces can't be predicted hence StringBuilder is not a thread safe... Using StringBuffer we can overcome the problem of Threads safety where the StringBuffer is a thread safety because it is synchronized where only one thread can access at a time so the output it produces can be expected and predicted.
answers question: http://stackoverflow.com/q/26860173

http://stackoverflow.com/comment/42297168
has text: The aligned address is an example to demonstrate that flipping a single bit can already be enough to turn a valid reference into NULL (there is only a single one bit in 0x10000, flip that and you have 0 -> null).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26866759

http://stackoverflow.com/a/26903334
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26903243
upvote count: 1
has body: You need to put the generic type declaration on each of the methods instead of the class, for example: public static &lt;T extends Comparable&lt;T&gt;&gt; void sort(T[] A)
score: 1

http://stackoverflow.com/a/26833491
answers question: http://stackoverflow.com/q/26833468
has comment: http://stackoverflow.com/comment/42233380
score: 1
has comment: http://stackoverflow.com/comment/50094635
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26833468
has comment: http://stackoverflow.com/comment/42233666
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42233407
has body: private Rectangle rectArray[] = new Rectangle[9]; rectArray[0] = new Rectangle(0,0,0,0); You have to initialize within constructor (generally constructor (or even initilisation block) than method for init). In your case, you mixed field (as suggested by your private keyword) with computation, leading to the compilation error you got. You may want to do: MyClass { private Rectangle rectArray[] = new Rectangle[9]; MyClass() { rectArray[0] = new Rectangle(0,0,0,0); } }

http://stackoverflow.com/comment/42312867
score: 0
type: QuestionComment
has text: @ElliottFrisch If he did, this would not compile. Even if it subclassed Map.Entry, this would fail.
comment on: http://stackoverflow.com/q/26877810
type: Comment

header
type: Tag
tags question: http://stackoverflow.com/q/26860204
tags question: http://stackoverflow.com/q/26869951
tag name: header

http://stackoverflow.com/comment/42335728
has text: Can you be more specific?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26890908

http://stackoverflow.com/q/26842914
has body: I am new to programming and have a noob question. I am trying to run a test like so... @Test public void rememberTest() throws DuplicateException{ try{ personA.remember(sighting4); } catch (Exception e) { fail("Failed" + e.getMessage()); } try{ assertEquals(personA.remember(sighting3), "The list already contains this sighting"); } catch (Exception e) { fail("Failed" + e.getMessage()); } } the first try/catch compiles but the second one does not. It tells me "'void' type not allowed here. " Why can't I use a void? If I can't use a void type, then how would I build my test so that the exception is thrown? some background info: rememberTest is a test of the remember method that adds an item to an ArrayList. the remember method, in Class Person, is as follows: public void remember(final Sighting s) throws DuplicateException { if(lifeList.contains(s)) { throw new DuplicateException("The list already contains this sighting"); } lifeList.remember(s); } If you need more info please request and I will post it as required.
tagged with: void
accepted answer: http://stackoverflow.com/a/26843302
has answer: http://stackoverflow.com/a/26844020
has comment: http://stackoverflow.com/comment/42249828
has comment: http://stackoverflow.com/comment/42250022
has comment: http://stackoverflow.com/comment/42250367
has comment: http://stackoverflow.com/comment/42249555
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42250179
has comment: http://stackoverflow.com/comment/42249711
tagged with: java
has comment: http://stackoverflow.com/comment/42249592
has title: try/catch a void type
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/42249977
score: 0
possible better answer: http://stackoverflow.com/a/26844140
has answer: http://stackoverflow.com/a/26843302
has comment: http://stackoverflow.com/comment/42249848
has comment: http://stackoverflow.com/comment/42249286
answer count: 3
has answer: http://stackoverflow.com/a/26844140
has comment: http://stackoverflow.com/comment/42249325
has comment: http://stackoverflow.com/comment/42249516
has comment: http://stackoverflow.com/comment/42250529
has comment: http://stackoverflow.com/comment/42249362
tagged with: junit

http://stackoverflow.com/a/26887070
has body: I'don't think it's a good way to try to manage your own program to avoid OutOfMemoryException. You have to size before your heap to match your need of memory. Anyway for me your code is correct but you need to call the GC : System.gc() before call runtime.freeMemory(). if (i % 1000 == 0) { try { System.gc(); Thread.sleep(500); System.out.println("Free Memory:" + runtime.freeMemory() / kb + " Kb"); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
type: Answer
has comment: http://stackoverflow.com/comment/42335437
upvote count: 1
answers question: http://stackoverflow.com/q/26886261
score: 1
downvote count: 0

http://stackoverflow.com/q/26939003
has comment: http://stackoverflow.com/comment/42431579
score: 0
tagged with: web
has title: How to stop locking record with Transactional anotation?
type: UnansweredQuestion
has body: My web application have this problem of occasionally getting DB deadlock. The problem turn out to be getting 2 requests in the almost the same times. 1 request is try to query the status of record while another request is trying to update the same record. So, it seems even the query request also try to lock the record while reading it. So, I wonder whether I can use @Transactional(readOnly = true) to force it to be read without locking ? In case that we have DAO libraries that do that actually reading, do I need the propagation to something like Never. To me, this is purely read only so I don't see why I need transaction for that. @Transactional(readOnly = true, propagation = Propagation.NEVER) or @Transactional(readOnly = true, propagation = Propagation.NOT_SUPPORTED) Any idea how to do that with Spring and Hibernate is very much appreciated. I am using Spring 1.5, Hibernate 3.6 and DB is MS SQL.
tagged with: spring
has comment: http://stackoverflow.com/comment/42426369
answer count: 0
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/42512992
type: Comment
type: QuestionComment
score: 0
has text: http://tutorials.jenkov.com/java-networking/sockets.html
comment on: http://stackoverflow.com/q/26989469

http://stackoverflow.com/a/26969736
type: Answer
has comment: http://stackoverflow.com/comment/42482592
has body: It looks as though the upload is being done as a multipart form, which allows you to insert images as part of the data being sent; but the server is reading it as a pure octet stream rather than a multipart form. You need to choose one or the other. Either interpret it as form data on the server, or just send the data as a stream rather than as form data. I'd suggest having a look at Apache Commons FileUpload, which will simplify lots of this.
score: 1
has comment: http://stackoverflow.com/comment/42480809
upvote count: 1
answers question: http://stackoverflow.com/q/26969640
downvote count: 0

http://stackoverflow.com/comment/130329950
score: 0
type: AnswerComment
has text: `function findMinimumWordDistance(words, wordA, wordB)` Some *Java*.
type: Comment
comment on: http://stackoverflow.com/a/43024606

http://stackoverflow.com/q/26944397
has title: java.lang.ClassNotFoundException: com.amazonaws.auth.AWSCredentials
tagged with: classnotfoundexception
has body: When uploading data to Amazon S3 I get a NoClassDefFoundError: exception in thread "main" java.lang.NoClassDefFoundError: com/amazonaws/auth/AWSCredentials at athiniocloudmigration.AthinioCloudMigration.main(AthinioCloudMigration.java:30) Caused by: java.lang.ClassNotFoundException: com.amazonaws.auth.AWSCredentials This is my compile statement: javac -d . -cp ../../lib/aws-java-sdk-1.2.7.jar:../ AthinioCloudMigration.java AmazonCloudMigration.java CommonResources.java And this is how I run it: java -cp ../../lib/*.jar:. athiniocloudmigration.AthinioCloudMigration
has comment: http://stackoverflow.com/comment/42431861
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42432660
type: UnansweredQuestion
answer count: 0
tagged with: amazon-s3
tagged with: java
type: Question
score: 5
has comment: http://stackoverflow.com/comment/42431978
upvote count: 5
has comment: http://stackoverflow.com/comment/42432422

http://stackoverflow.com/comment/42409199
has text: well you can easily search for other tutorials. just google `java canvas circle` or follow the link from stevietheTV's answer
comment on: http://stackoverflow.com/q/26931864
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42465204
type: AnswerComment
comment on: http://stackoverflow.com/a/26963411
type: Comment
has text: Thank you. I made the changes you suggested but it still stated the same errors. It can't seem to find the symbol for calculate.
score: 0

http://stackoverflow.com/q/26963433
has body: I have a project, that consists of two modules - core and web. Core module contains some domain classes and services, while web module has controllers and other front end staff. If I put controller into the core module I can do grails run-app and then access my service directly via REST plugin in Chrome browser. But when controllers are in web module I cannot resolve dependency between these modules. In the BuildConfig.groovy for the web module I have plugins { // plugins for the build system only build ":tomcat:7.0.53" compile ":myapp-core:0.1-SNAPSHOT" // plugins for the compile step compile ":scaffolding:2.1.0" compile ':cache:1.1.6' compile ":asset-pipeline:1.9.6" compile ":angular-annotate-asset-pipeline:1.1.2" } BuildConfig for the core looks like: grails.project.class.dir = "target/classes" grails.project.test.class.dir = "target/test-classes" grails.project.test.reports.dir = "target/test-reports" grails.project.fork = [ // configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required // compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true], // configure settings for the test-app JVM, uses the daemon by default test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true], // configure settings for the run-app JVM run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false], // configure settings for the run-war JVM war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false], // configure settings for the Console UI JVM console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256] ] grails.project.dependency.resolver = "maven" // or ivy grails.project.dependency.resolution = { //legacyResolve true // inherit Grails' default dependencies inherits("global") { // uncomment to disable ehcache excludes 'ehcache' } log "warn" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose' repositor…
answer count: 1
tagged with: dependencies
favorite count: 0
accepted answer: http://stackoverflow.com/a/26964238
upvote count: 1
tagged with: plugins
type: AnsweredQuestion
score: 1
tagged with: java
has title: Cannot resolve dependency to the homegrown module
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/26964238
tagged with: grails

http://stackoverflow.com/comment/42445742
score: 0
type: AnswerComment
has text: yeah :) debugged every line before i found it :( java needs better explanations in exceptions for this kind of stuff :p or better handle races
type: Comment
comment on: http://stackoverflow.com/a/26951898

http://stackoverflow.com/q/26908428
tagged with: grouping
score: 1
has title: Java Group by functionality
favorite count: 0
has comment: http://stackoverflow.com/comment/42366853
accepted answer: http://stackoverflow.com/a/26908848
has comment: http://stackoverflow.com/comment/42367064
type: AnsweredQuestion
has body: Let's say I have a Java class 'Academics' with the following variables: SchoolId, BatchId, SectionID, studentID, SubjectID, Marks, Marks2 Then I have a list of this class with a number of values. (List) Now I want find the SUM of Marks and Marks2 by grouping this in combinations of different columns, i.e I want to group it by: SchoolId + BatchId + SectionID SchoolId + BatchId + SectionID + studentID SchoolId + BatchId + SectionID + studentID + SubjectID This is easily attainable through SQL, but what is the best way of grouping in Java?
tagged with: list
tagged with: java
upvote count: 1
possible better answer: http://stackoverflow.com/a/26908826
type: Question
has answer: http://stackoverflow.com/a/26908826
answer count: 2
has comment: http://stackoverflow.com/comment/42367060
downvote count: 0
has answer: http://stackoverflow.com/a/26908848

http://stackoverflow.com/comment/42368340
has text: You should use `result.putExtra("BITMAP", resultBitmap);` before `setResult(Activity.RESULT_OK, result);`, not after.
comment on: http://stackoverflow.com/q/26908462
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/26964828
has body: public static int swapx(*ArrayList&lt;Integer&gt; a*, ArrayList&lt;Integer&gt; b, Integer x) { int i, pos, n = 0; Integer a1, b1; for (i = 0; i &lt; a.size(); i++) { a1 = a.get(i); b1 = b.get(i); if (a1 + b1 == x) { n++; a.set(i, b1); b.set(i, a1); } } return n; }
score: 0
answers question: http://stackoverflow.com/q/26964771
type: Answer

http://stackoverflow.com/q/26844135
has comment: http://stackoverflow.com/comment/42251439
tagged with: java
score: -4
duplicate of: http://stackoverflow.com/q/218384
accepted answer: http://stackoverflow.com/a/26844151
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/26844150
has answer: http://stackoverflow.com/a/26844151
tagged with: xmlnodelist
has body: I hope you can help me. I get an NullPointerExeption when I want to Put the NodeList / Node to my Map: Map &lt;String, NodeList&gt; config = null; public void loadConfiguration() { helper helper = new helper(); NodeList nodes = null; nodes = helper.getXPathFromFile("/root/*", "conf/config.xml"); if (nodes.getLength() &gt; 0) { for (int i = 0; i &lt; nodes.getLength(); i++) { String NodeName = nodes.item(i).getNodeName(); NodeList NodeItem = (NodeList) nodes.item(i); System.out.println(NodeName); // Here the right Name puts out System.out.println(helper.nodelistToString(NodeItem)); // here right inside XML-Code put out config.put(NodeName, NodeItem); // Here comes the NullPointerEx. } } }
answer count: 2
downvote count: 4
upvote count: 0
has title: Why I get a nullPointerExeption?
tagged with: xmlnode
favorite count: 0
possible better answer: http://stackoverflow.com/a/26844150

http://stackoverflow.com/comment/42584624
type: AnswerComment
has text: :Thanks philip, i corrected it but that doesnt seem like the error.
type: Comment
comment on: http://stackoverflow.com/a/27006140
score: 0

http://stackoverflow.com/comment/42490201
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/26977523
has text: Okay thanks, would i need to have parameters in my methods and wouldn't i have to use arrays to do {one, two, three,.....}?

http://stackoverflow.com/comment/42409879
type: AnswerComment
comment on: http://stackoverflow.com/a/26929537
type: Comment
has text: @Adam yes and in a mathematical sense an identity operation preserves that property, i.e. an "indentiy" function `f(x) = x` preserves the "identity" of the value, i.e. the value returned is still the same as the value passed as a parameter.
score: 0

http://stackoverflow.com/q/26898818
has body: I'm trying to get into bukkit plugin development but I am stuck. I am currently learning java and I feel like I have enough knowledge to make a plugin- except I'm missing the most important thing. I'm trying to use the loadChunk() method or the load() method to load a game chunk. I thought what I would do is something like Chunk chunk = new chunk(); but that spits out the chunk cannot be resolved to a type error message. If I try Chunk() with a capital then I get this error: Cannot instantiate the type Chunk. I also know if the Chunk/World method were static then I would just have to do Chunk.load() or World.loadChunk() to load the chunk. Is it better to use the chunk's load method or the world's loadChunk method for loading specific chunks? I understand that this is a beginner question, so if you can describe how you know what to do so that in the future I can figure out what I'm supposed to do. UPDATE: Thanks for the help. This is what I used in case anyone views this looking for an answer World world = Bukkit.getWorld(worldName); Chunk chunk = world.getChunkAt(x,y); worldName is whatever is the name of the world and x,y are the x and y coordinates of the block.
type: Question
has answer: http://stackoverflow.com/a/26910827
tagged with: java
tagged with: bukkit
score: 0
tagged with: api
answer count: 1
has title: How do I call class methods with Bukkit API?
accepted answer: http://stackoverflow.com/a/26910827
tagged with: load
type: AnsweredQuestion
tagged with: methods

http://stackoverflow.com/a/26911715
answers question: http://stackoverflow.com/q/26908179
score: 0
has body: one more pattern to have trimmed results (#[^#]+#|[^#]+)(?:\s|$) Demo ( Capturing Group \1 # "#" [^#] Character not in [^#] + (one or more)(greedy) # "#" | OR [^#] Character not in [^#] + (one or more)(greedy) ) End of Capturing Group \1 (?: Non Capturing Group \s &lt;whitespace character&gt; | OR $ End of string/line ) End of Non Capturing Group
type: Answer

http://stackoverflow.com/comment/42249283
type: QuestionComment
has text: The contents of the arrays are equal. But each one is a reference to a different object.
score: 1
comment on: http://stackoverflow.com/q/26842917
type: Comment

http://stackoverflow.com/q/26858352
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26859825
has comment: http://stackoverflow.com/comment/42298143
has comment: http://stackoverflow.com/comment/42278068
accepted answer: http://stackoverflow.com/a/26858629
has answer: http://stackoverflow.com/a/26859095
has comment: http://stackoverflow.com/comment/42297567
type: Question
has answer: http://stackoverflow.com/a/26858629
tagged with: java
has title: Java Math.random with arrays
has answer: http://stackoverflow.com/a/26858641
score: 0
possible better answer: http://stackoverflow.com/a/26859825
tagged with: random
has body: I am trying to populate my 2d array that is 5 by 5 with a char such as A in random coordinates in the 2d array. When I use my nested for loop i wanted to make the coordinates of the 2d array where my char will be to be random. So lets say I asked for 40 percent of A's, in a 5 by 5 I should get 10 A's but I get 8. When i run it, it doesn't show the percentage of A's i wanted sometimes. it would only print out like 6. Is this because when the row and col in the if statement are randomized, so is the row and col in the for loop? Is this why the char sometimes populates less then asked for because the for loop stops if the number randomizes the length of the 2d array which is 5? Also when it does print out 10 char, sometimes they go over the 5 by 5. an example would be 2 As in the line and 7 in the second and 1 in the 3rd. Why is that? public static void grid(char[][] arr, int percentofchar) { double charx = 0.0; double totalpercentchar = 0; totalpercentchar = (double) percentofchar / 100; cellx = totalpercentchar * (arr.length * arr.length); for (int row = 0; row &lt; arr.length; row++) { for (int col = 0; col &lt; arr[row].length; col++) { if (charx &gt; 0) { row = (int) (Math.random() * arr.length); col = (int) (Math.random() * arr.length); charx--; arr[row][col] = 'A'; System.out.print(arr[row][col] + " "); } } System.out.println(); } }
tagged with: arrays
answer count: 4

http://stackoverflow.com/comment/42335437
comment on: http://stackoverflow.com/a/26887070
has text: +1 for System.gc(). It has made the output more exact.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26908462
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42368340
tagged with: android
has answer: http://stackoverflow.com/a/26912855
accepted answer: http://stackoverflow.com/a/26912855
has comment: http://stackoverflow.com/comment/42368464
has comment: http://stackoverflow.com/comment/42371651
favorite count: 0
has comment: http://stackoverflow.com/comment/42371305
has comment: http://stackoverflow.com/comment/42371574
tagged with: opencv
score: 2
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5302085
tagged with: java
has title: Android cannot finish activity
has body: I'm writing an app using the OpenCV android library. I've created a CameraActivity which I want to call, and return an image. public class CameraActivity extends Activity implements CvCameraViewListener2 { private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) { @Override public void onManagerConnected(int status) { switch (status) { case LoaderCallbackInterface.SUCCESS: { Log.i(TAG, "OpenCV loaded successfully"); mOpenCvCameraView.enableView(); } break; default: { super.onManagerConnected(status); } break; } } }; @Override public void onCreate(Bundle savedInstanceState) { ... Button snap = (Button) findViewById(R.id.snap); snap.setOnClickListener(new OnClickListener() { public void onClick(View v) { processVideo(); } }); snap.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { processPicture(); return true; } }); } @Override public void onPause() { ... } @Override public void onResume() { ... } public void onDestroy() { ... } public void onCameraViewStarted(int width, int height) { ... } @Override public void onCameraViewStopped() { ... } public Mat onCameraFrame(CvCameraViewFrame cvf) { // Grab frame cvf.rgba().copyTo(frame); // Filter frame filterLaser(); // Retrieve contour center point contourLaser(); // Draw draw(); // Display the result. return cvf.rgba(); } private void draw(){ ... } private void filterLaser(){ ... } void processVideo(){ ... } void processPicture(){ Intent result = new Intent(); if(frame != null) { // Convert the processed Mat to Bitmap Bitmap resultBitmap = Bitmap.createBitmap(frame.cols(), frame.rows(),Bitmap.Config.ARGB_8888);; Utils.matToBitmap(frame, resultBitmap); setResult(Activity.RESULT_OK, result); result.putExtra("BITMAP", resultBitmap); } else { setResult(Activity.RESULT_CANCELED); // No frame found } Log.d("LastPoint", "FINISHED"); finish(); } }; This Activity gets called using the following code in MainActivity. Button reply = (Button) findViewById(R.id.buttonRepl…
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42371126

http://stackoverflow.com/comment/42491719
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26978601
has text: That just means that the `b` condition isn't the one that made the statement `false`. Perhaps you want "or" instead of "and"?
type: Comment

http://stackoverflow.com/a/26963777
answers question: http://stackoverflow.com/q/26963766
type: Answer
score: 3
downvote count: 0
has body: It's not your switch statement that's causing problems but rather the while loop prior. You test x as in while (x==1), but where do you change x within the while loop? If you never change the state of x, the test will never become false, and the loop will never exit. As Tom astutely points out, you will want your while loop that validates your y input, to enclose all the code that is related to getting the y input. while ( y &gt; 0 &amp;&amp; y &lt; 9) { System.out.println("Enter a number from 1-8: "); y = broncos.nextInt(); if (y &gt; 0 &amp;&amp; y &lt; 9) { System.out.println( y ); System.out.print ( "That's not a valid number. Try again. "); } } Now use your correct y in your switch statement. Also, once you have a correct y, there's no need to get an a: // System.out.println ("Enter a number from 1-8: "); // a = broncos.nextInt(); Again, just use y in the switch statement. As for your x, there's no need to validate it (unless you need to check to see that it is infact a number) since any number entered should work.
has comment: http://stackoverflow.com/comment/42465793
has comment: http://stackoverflow.com/comment/42465399
has comment: http://stackoverflow.com/comment/42465867
upvote count: 3

http://stackoverflow.com/a/26948214
has comment: http://stackoverflow.com/comment/42472687
has comment: http://stackoverflow.com/comment/42472639
downvote count: 0
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42479480
has body: You can't. Even if you pass a reference, the reference will be lost since all you get is a proxy. The proxy is meant to look at active threads and do work on those threads. When it's getting to your managed executor, the thread isn't part of the original HTTP session and as a result, you get the ContextNotActiveException. Technically speaking, HTTP sessions aren't well understood for JAX-RS, there's no actual requirement in the spec that a JAX-RS resource participates in an HTTP session. The most common workaround I recommend to people is to have some centralized location to store these types of big results and have the session scoped object read from there. Have the executor talk to that component as well. That could be as simple as a hashmap keyed off of HTTP session id. To get the session id, just call HttpSession.getId(). You can also destroy the map reference by using a @PreDestroy method in one of your @SessionScoped beans to call the central spot and destroy the reference. As far as the thread goes, I can't think of any way to kill it other than to be able to inject a reference to the runnable from your session scoped bean (or make the runnable your session scoped bean) and tell it to cease the thread from there. @SessionScoped public class SessionBean implements Runnable,Serializable { private HttpSession httpSession; @PostConstruct public void init() { httpSession = CDI.current().select(HttpSession.class).get(); // register the session } @Override public void run() { } @PreDestroy public void unregister() { // unregister the session // kill the thread. } }
answers question: http://stackoverflow.com/q/26934461

http://stackoverflow.com/q/26887417
tagged with: websphere
downvote count: 0
has comment: http://stackoverflow.com/comment/42329558
has title: WebSphere 8.5 web service deployment
tagged with: deployment
favorite count: 0
has comment: http://stackoverflow.com/comment/42331006
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42330024
upvote count: 1
score: 1
tagged with: java
has body: I have created a web service with @WebService annotation then I package it in war archive with a simple web.xml file containing displayname tag. I have deployed it on WebSphere 8.5.5.3 server and it deployed successfully with deploy web service option, but then when I tried to go to address in browser ex: http:// localhost:9080 /(context-root)/ServiceNameService it shows me that ServiceNameService file not found and in the ffdc log there is a message: [12.11.14 17:22:51:890 UZT] FFDC Exception:java.io.FileNotFoundException SourceId:com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters -IOE ProbeId:1044 java.io.FileNotFoundException: SRVE0190E: Файл не найден: /DailyCursWeatherService at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor._processEDR(DefaultExtensionProcessor.java:949) at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.processEDR(DefaultExtensionProcessor.java:930) at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:484) at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1071) at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3878) at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304) at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:981) at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662) at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:461) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:528) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:314) at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:285) at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewC…
tagged with: jax-ws
tagged with: websphere-8
type: Question

http://stackoverflow.com/a/26896057
score: 2
upvote count: 2
has body: Short answer: register a listener with the showing property. import javafx.application.Application; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.scene.Scene; import javafx.scene.control.MenuItem; import javafx.scene.control.SplitMenuButton; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class SplitMenuButtonTest extends Application { @Override public void start(Stage primaryStage) { IntegerProperty count = new SimpleIntegerProperty(); SplitMenuButton splitMenuButton = new SplitMenuButton(); splitMenuButton.setText("Action"); splitMenuButton.showingProperty().addListener((obs, wasShowing, isNowShowing) -&gt; { if (isNowShowing) { int c = count.get() + 1; count.set(c); splitMenuButton.getItems().clear(); for (int choice = 1; choice &lt;= 3; choice++) { MenuItem mi = new MenuItem("Choice "+choice+" (" + c + ")"); splitMenuButton.getItems().add(mi); } } }); BorderPane root = new BorderPane(null, splitMenuButton, null, null, null); primaryStage.setScene(new Scene(root, 350, 150)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } Sort of as an aside, I'm not sure this is a really good idea. Database connections are typically long-running processes (i.e. long enough to be visually noticeable in a UI environment). If you run this on the FX Application Thread, then you're going to block the UI from doing anything while the data is retrieved, and that's also right at the moment the user has just tried to do something. Of course, if you run it as a background task, then the menu will popup with the previous data, and then later update once the data is downloaded. I would recommend finding a way to populate this before the user requests it.
answers question: http://stackoverflow.com/q/26895534
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42346128
type: Answer
accepted answer of: http://stackoverflow.com/q/26895534

http://stackoverflow.com/comment/42507859
type: QuestionComment
comment on: http://stackoverflow.com/q/26987676
has text: Netbeans has a built in tool that will export to windows EXE, Mac DMG, and Linux DEB...
score: 0
type: Comment

http://stackoverflow.com/q/26899933
has answer: http://stackoverflow.com/a/26900353
tagged with: java
type: Question
answer count: 1
has body: So, I have a custom linkedList(single) class that uses the provided node class. Now I have another class to QuickSort this.(left out for brevity, i just wanna focus on editing the L.head) However, instead of passing the quicksort method the entire linkedList, I want to pass it just the head from the linkedlist. My problem is accessing this head node and changing it from the quckSort method/class, and I dont want to delete it or simply just change the element value Main: public class TestLinkedList { public static &lt;E extends Comparable&lt;E&gt;&gt; void main(String[] args) { MyLinkedList&lt;Integer&gt; L = new MyLinkedList&lt;Integer&gt;(); L.add(3); L.add(1); L.add(2); System.out.println("Initial=" + L); MySort.quickSort(L.head); System.out.println("After ="+L); } } QuickSort: public class MySort { public static &lt;E extends Comparable&lt;E&gt;&gt; void quickSort(MyNode&lt;E&gt; list) { list = list.next; } Node Class: public class MyNode&lt;E extends Comparable&lt;E&gt;&gt; { E element; MyNode&lt;E&gt; next; public MyNode(E item) { element = item; next = null; } } LinkedList class: public class MyLinkedList&lt;E extends Comparable&lt;E&gt;&gt; { public MyNode&lt;E&gt; head; /** * Default constructor */ public MyLinkedList() { this.head = new MyNode&lt;E&gt;(null); } /** * Adds given element to MylinkedList * * @param e * Given element to be added */ public void add(E e) { assert e != null : "Violation of: e is not null"; MyNode&lt;E&gt; temp = new MyNode&lt;E&gt;(e); if (head.element != null) { temp.next = head; head = temp; } else { this.head = temp; } } /** * Given a certain element, will try to locate and return whether it exists * in the MylinkedList * * @param e * Element being searched for * @return Result Result of whether this MyLinkedList contains the given * Element */ public boolean find(E e) { assert e != null : "Violation of: e is not null"; boolean result = false; MyNode&lt;E&gt; temp = head; outerloop: while (temp.element != null &amp;&amp; temp.n…
score: 0
has title: Accessing specific class variables from another class
type: UnansweredQuestion

http://stackoverflow.com/comment/42446643
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26875822
has text: Have you tried specifying the primary key in MapsId such as MapsId("sNum") because your sNum is the primary key. Btw its tough to give you exact mappings unless the field names listed and such are not 100% as per your code.

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/26890398
tags question: http://stackoverflow.com/q/26942142
tags question: http://stackoverflow.com/q/26892452
tags question: http://stackoverflow.com/q/26963916
tags question: http://stackoverflow.com/q/26849356
tags question: http://stackoverflow.com/q/26881923
tags question: http://stackoverflow.com/q/26922774
tags question: http://stackoverflow.com/q/26897624
tags question: http://stackoverflow.com/q/26850955
tags question: http://stackoverflow.com/q/26935170
tags question: http://stackoverflow.com/q/26970782
tags question: http://stackoverflow.com/q/26970584
tags question: http://stackoverflow.com/q/26930232
tags question: http://stackoverflow.com/q/26973876
tags question: http://stackoverflow.com/q/26967234
tags question: http://stackoverflow.com/q/26954914
tags question: http://stackoverflow.com/q/26880364
tags question: http://stackoverflow.com/q/26877814
tags question: http://stackoverflow.com/q/26880241
tags question: http://stackoverflow.com/q/26936156
tags question: http://stackoverflow.com/q/26940693
tags question: http://stackoverflow.com/q/26906732
tags question: http://stackoverflow.com/q/26930778
tags question: http://stackoverflow.com/q/26928147
tags question: http://stackoverflow.com/q/26924654
tags question: http://stackoverflow.com/q/26876786
tags question: http://stackoverflow.com/q/26887182
tags question: http://stackoverflow.com/q/26840190
tags question: http://stackoverflow.com/q/26913090
tags question: http://stackoverflow.com/q/26991298
type: Tag
tags question: http://stackoverflow.com/q/26975611
tags question: http://stackoverflow.com/q/26892906
tags question: http://stackoverflow.com/q/26937570
tags question: http://stackoverflow.com/q/26970497
tags question: http://stackoverflow.com/q/26968554
tags question: http://stackoverflow.com/q/26918868
tags question: http://stackoverflow.com/q/26834399
tags question: http://stackoverflow.com/q/26881687
tags question: http://stackoverflow.com/q/26959816
tags question: http://stackoverflow.com/q/26984208
tags question: http://stackoverflow.com/q/26885494
tags question: http://stackoverflow.com/q/26934861
tags question: http://stackoverflow.com/q/26971326
tags question: http://stackoverflow.com/q/26833439
tags question: http://stackoverflow.com/q/26979330
tags question: http://stackoverflow.com/q/26931734
tags question: http://stackoverflow.com/q/26958816
tags question: http://stackoverflow.com/q/26890149
tags question: http://stackoverflow.com/q/26956042
tags question: http://stackoverflow.com/q/26868067
tags question: http://stackoverflow.com/q/26861883
tags question: http://stackoverflow.com/q/26977649
tags question: http://stackoverflow.com/q/26938936
tags question: http://stackoverflow.com/q/26875386
tags question: http://stackoverflow.com/q/26849139
tag name: json
tags question: http://stackoverflow.com/q/26938250
tags question: http://stackoverflow.com/q/26898003
tags question: http://stackoverflow.com/q/26884345
tags question: http://stackoverflow.com/q/26840861
tags question: http://stackoverflow.com/q/26981426
tags question: http://stackoverflow.com/q/26887184
tags question: http://stackoverflow.com/q/26953995
tags question: http://stackoverflow.com/q/26914209
tags question: http://stackoverflow.com/q/26925058
tags question: http://stackoverflow.com/q/26860358
tags question: http://stackoverflow.com/q/26950605
tags question: http://stackoverflow.com/q/26934757
tags question: http://stackoverflow.com/q/26940940
tags question: http://stackoverflow.com/q/26987343
tags question: http://stackoverflow.com/q/26911603
tags question: http://stackoverflow.com/q/26989004
tags question: http://stackoverflow.com/q/26973349
tags question: http://stackoverflow.com/q/26958206
tags question: http://stackoverflow.com/q/26897538
tags question: http://stackoverflow.com/q/26867122
tags question: http://stackoverflow.com/q/26936436
tags question: http://stackoverflow.com/q/26990545
tags question: http://stackoverflow.com/q/26909541

http://stackoverflow.com/q/26936917
answer count: 1
downvote count: 0
duplicate of: http://stackoverflow.com/q/153724
favorite count: 0
linked to: http://stackoverflow.com/q/153724
has body: I get number representing strings like 248.03500000066338 313.44999999979470 4.2346999999 and I need to round them to something like 248.035 313.45 4.2347 while keeping a fixed relative precision of let's say 6 significant figures. I could do it using Math.log10, computing what absolute precision is needed, and rounding correspondingly, but I wonder if there's a simple way. Ideally, the resulting number should be such that it does not produce the trailing nines when converted to string, but this is not needed and maybe impossible.
linked to: http://stackoverflow.com/q/7548841
tagged with: floating-point
accepted answer: http://stackoverflow.com/a/26937288
has title: Rounding to a fixed relative precision
type: AnsweredQuestion
tagged with: rounding
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26937288
type: Question
duplicate of: http://stackoverflow.com/q/7548841
upvote count: 1

http://stackoverflow.com/a/26851762
has body: You Can Try This: if(playerValue &gt; 10 &amp;&amp; playerValue &lt; 21){ while(true){ System.out.println("Players Value so far " + playerValue + ", Do you want to draw another card? Y/N"); // input a y or n answer decision=sob.next(); if(decision!=null &amp;&amp; (decision.equalsIgnoreCase("y")||decision.equalsIgnoreCase("n"))){ break; } else{ System.out.println("please answer with Either y or n"); continue; } }//end of while loop //put your code here }
type: Answer
answers question: http://stackoverflow.com/q/26851308
score: 0

http://stackoverflow.com/q/26991810
tagged with: object
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/26992127
tagged with: jvm
type: UnansweredQuestion
has title: View Java Objects in 3D Space
tagged with: java
has body: A while ago, I believe I heard of an application that hooked into the JVM and created a live 3D view of sorts. The view showed objects currently in use/in memory, and I think other things like how much memory the particular object was taking up. Has anyone heard of such a program? Was I dreaming?
type: Question

http://stackoverflow.com/a/42158890
upvote count: 10
score: 10
answers question: http://stackoverflow.com/q/26913923
downvote count: 0
type: Answer
has body: This is the way we shall use: UIManager.getLookAndFeelDefaults().put("OptionPane.messageFont", new Font("Arial", Font.BOLD, 14)); UIManager.getLookAndFeelDefaults().put("OptionPane.buttonFont", new Font("Arial", Font.PLAIN, 12)); UIManager.put("OptionPane.messageFont", new Font("Arial", Font.BOLD, 14)); UIManager.put("OptionPane.buttonFont", new Font("Arial", Font.PLAIN, 12)); Just remember to set it before any JOptionPane dialog appears. I just put it in the first line of the main method. To see why I do this, the DOC of UIManager is always useful. Defaults UIManager manages three sets of UIDefaults. In order, they are: Developer defaults. With few exceptions Swing does not alter the developer defaults; these are intended to be modified and used by the developer. Look and feel defaults. The look and feel defaults are supplied by the look and feel at the time it is installed as the current look and feel (setLookAndFeel() is invoked). The look and feel defaults can be obtained using the getLookAndFeelDefaults() method. System defaults. The system defaults are provided by Swing. Invoking any of the various get methods results in checking each of the defaults, in order, returning the first non-null value. For example, invoking UIManager.getString("Table.foreground") results in first checking developer defaults. If the developer defaults contain a value for "Table.foreground" it is returned, otherwise the look and feel defaults are checked, followed by the system defaults. It's important to note that getDefaults returns a custom instance of UIDefaults with this resolution logic built into it. For example, UIManager.getDefaults().getString("Table.foreground") is equivalent to UIManager.getString("Table.foreground"). Both resolve using the algorithm just described. In many places the documentation uses the word defaults to refer to the custom instance of UIDefaults with the resolution logic as previously described. So, we should change first the developer defaults. And th…

http://stackoverflow.com/comment/42433209
type: AnswerComment
has text: Thanks so much for the answer, but I can't really change the printSequenz method since that's how the professor gave it to us...
type: Comment
comment on: http://stackoverflow.com/a/26945179
score: 0

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

http://stackoverflow.com/comment/42480169
comment on: http://stackoverflow.com/a/26972230
type: AnswerComment
score: 0
has text: @goedkoop,NP when test let know.
type: Comment

http://stackoverflow.com/comment/42261036
comment on: http://stackoverflow.com/a/26848852
has text: Should I write public static DrawMode currentDrawMode; instead of private ? Eclipse asks me to do that
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42336100
has text: @Allanallan where u have saved the program... in bin or somewhere else
comment on: http://stackoverflow.com/a/26885589
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42460675
comment on: http://stackoverflow.com/a/26961116
type: Comment
has text: Thanks. Are they the same in terms of number of function evaluations/memory use/runtime?
score: 0
type: AnswerComment

http://stackoverflow.com/q/26860144
has body: We're using a service layer class for executing hibernate entitymanager operations, like find or persist entities to our mysql database. We run an integration test (10000 times), which performs a persist to the database and in the second step, we want to find this entity and update a column ('state') of the entity. The problem is, that both operations are independent, what means: Create entity and persist Find this particular entity through a named query and update Sometimes, the entity is not found by the named query after random repeats (1000, 3500, 6000), but we see the entity is in database while debugging and getting a NoResultException. Here is our sample code: persistence.xml org.hibernate.jpa.HibernatePersistenceProvider com.ikea.hrms.gdct.persistence.config.domain.Sequence com.ikea.hrms.gdct.persistence.config.domain.Journal <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/DB_RU_PT"/> <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/> <property name="hibernate.connection.username" value="dbru_pt"/> <property name="hibernate.connection.password" value="peterkloeppel1234"/> <property name="hibernate.connection.useUnicode" value="true" /> <property name="hibernate.connection.characterEncoding" value="UTF-8" /> <property name="hibernate.connection.release_mode" value="on_close"/> <property name="hibernate.connection.pool_size" value="100" /> <property name="org.hibernate.flushMode" value="COMMIT"/> <property name="hibernate.hbm2ddl.auto" value="create"/> SequenceService.java public static synchronized Sequence findOne(String personnelAreaCode, String documentType, String documentCreationDate, int seqNumber) { logger.info("Find one specific Sequence."); Sequence sequence = null; try { checkEM(); if (EMFGlobal.getInstance().getLock().tryLock(10, TimeUnit.SECONDS)) { logger.info("Find one: " + personnelAreaCode + "-" + documen…
answer count: 0
type: UnansweredQuestion
type: Question
linked to: http://stackoverflow.com/q/2613113
tagged with: java
tagged with: hibernate
tagged with: mysql
has comment: http://stackoverflow.com/comment/42282225
has comment: http://stackoverflow.com/comment/42280995
has title: Hibernate EntityManager can't find object (NoResultException), but object is in DB
tagged with: jpa
linked to: http://stackoverflow.com/q/8138458
tagged with: entity
score: 0

http://stackoverflow.com/q/26958591
has answer: http://stackoverflow.com/a/26958895
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26959003
tagged with: string
has comment: http://stackoverflow.com/comment/42456191
type: Question
has comment: http://stackoverflow.com/comment/42456982
tagged with: text
has comment: http://stackoverflow.com/comment/42456420
has answer: http://stackoverflow.com/a/26958912
score: 0
tagged with: java
has title: splitting string in infix form
possible better answer: http://stackoverflow.com/a/26958875
has answer: http://stackoverflow.com/a/26958875
tagged with: split
answer count: 4
linked to: http://stackoverflow.com/q/22718744
has body: There is something that I want to know. I have homework where they want us to take two string input in polynomial form, and there is lots of implementation. Here my question: when I take the input from the user, I can split the string into polynomial parts but it goes wrong: The string: "-x^3 - 6x^2 + 4x + 22" I want to split this like: -x^3 - 6x^2 + 4x + 22 but it prints package splitmethod; import java.util.Scanner; import java.io.*; public class uygulama { public static void main(String args[]){ System.out.println("lütfen parçalmak istidigniz polinomu girniz "); Scanner input= new Scanner(System.in); String polinom= input.nextLine(); String[] result; System.out.println(""); result=polinom.replaceAll("\\s+","").split("(?&lt;=[+-])"); for(int i=0;i&lt;result.length;i++){ System.out.println(result[i]);
has comment: http://stackoverflow.com/comment/42455953
accepted answer: http://stackoverflow.com/a/26958912

http://stackoverflow.com/q/26872975
has comment: http://stackoverflow.com/comment/42305286
score: 2
has body: I am trying to pull in html validation errors and strip out the first part of the error to only show the actual text part but am having trouble. I would like to remove the "ValidationError line 23 col 40:' " and the last " ' " after the text. package htmlvalidator; import java.util.ArrayList; public class ErrorCleanup { public static void main(String[] args) { //Saving the raw errors to an array list ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); //Add the text to the first spot list.add("ValidationError line 23 col 40:'Bad value ius-cors for attribute name on element &gt;meta: Keyword ius-cors is not registered.'"); //Show what is in the list System.out.println("The error message is: " + list); } }
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/16746395
type: Question
downvote count: 0
has title: How to remove text in arraylist element after a specific character?
favorite count: 0
tagged with: arraylist
answer count: 1
accepted answer: http://stackoverflow.com/a/26873044
upvote count: 2
has answer: http://stackoverflow.com/a/26873044

http://stackoverflow.com/q/26882936
answer count: 1
tagged with: junit
downvote count: 0
tagged with: maven-3
favorite count: 0
has title: Why does SpringJUnit4ClassRunner not work with surefire parallel=methods?
tagged with: spring
has answer: http://stackoverflow.com/a/26882964
type: AnsweredQuestion
tagged with: java
tagged with: maven-surefire-plugin
type: Question
has body: Why do my tests throw random exceptions when I use the surefire setting parallel=methods ?
upvote count: 5
accepted answer: http://stackoverflow.com/a/26882964
score: 5

http://stackoverflow.com/comment/42500342
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26962112
type: AnswerComment
has text: So the code that I have written now, I need to be able to put it on a file. I'm getting an error message when using PrintWriter, and I'm not sure were to place it to print the file name. How exactly do I print out a file?

http://stackoverflow.com/comment/42330023
type: AnswerComment
has text: The best answer seemed to relate to the [httr library](http://cran.r-project.org/web/packages/httr/index.html)
comment on: http://stackoverflow.com/a/26887656
score: 0
type: Comment

http://stackoverflow.com/q/26867689
has answer: http://stackoverflow.com/a/26913735
answer count: 3
has answer: http://stackoverflow.com/a/26870182
has title: I need to make a triforce containing 3 lines of number for each triangle
has body: Each line is the same number and in all three triangles the number is the same. Input: The first line contains an integer n that represents the number of data sets to follow. Each data set will consist of 1 integer m that represents the number that the Triforce of Courage contains throughout. Output: Print out a triforce, using this template (replacing 0 with the integer specified): 0 000 00000 0 0 000 000 00000 00000 Assumptions: The number to be replaced will be:0&lt;=m&lt;=9 Sample Input: 1 2 Sample Output: 2 222 22222 2 2 222 222 22222 22222 The following is my code thus far: import java.lang.Math; import java.util.Scanner; import java.io.*; import java.util.*; import java.io.FileNotFoundException; public class TriforceOfCourage { public static void main(String[] args) throws FileNotFoundException { Scanner scan=new Scanner(new File("num.dat")); int n = scan.nextInt(); int count = 0; while(count&lt;n) { for (int i=0; i&lt;3; i++) { for (int k=0; k&lt;3-i; k++) { System.out.print(" "); } for (int j=0; j&lt;i*2+1; j++) { System.out.print(n); } System.out.println(""); } break; } } }
has comment: http://stackoverflow.com/comment/42295027
tagged with: println
has comment: http://stackoverflow.com/comment/42294563
has comment: http://stackoverflow.com/comment/42295942
favorite count: 0
has answer: http://stackoverflow.com/a/26869182
has comment: http://stackoverflow.com/comment/42296746
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26870182
has comment: http://stackoverflow.com/comment/42295947
upvote count: 3
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42296279
possible better answer: http://stackoverflow.com/a/26913735

http://stackoverflow.com/comment/89103355
type: Comment
comment on: http://stackoverflow.com/a/32544358
score: 0
type: AnswerComment
has text: the devil is in the details! thanks for writing this detailed answer

http://stackoverflow.com/comment/92783383
has text: I used @EnableAutoConfiguration to address it.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/31891805
score: 1

http://stackoverflow.com/q/26985862
tagged with: http-status-code-404
has answer: http://stackoverflow.com/a/26986131
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: tomcat7
has body: This is the first time I have ever tried to set up a web application project on my own and for some reason I can't even get it to work with a hello world setup. I have everything set to default, the JDK1.8 selected for compiling and an Tomcat7 server with a index.html page that has only text in it. I should be able to right click on the projet and Run on Server after adding the project to the server but I keep getting a 404 even with this simple setup. What am I missing? Web.xml welcome list: <welcome-file-list> index.html index.htm index.jsp default.html default.htm default.jsp
has comment: http://stackoverflow.com/comment/42505015
type: Question
has comment: http://stackoverflow.com/comment/42505449
tagged with: eclipse
upvote count: 2
has title: 404 when setting up Eclipse Dynamic Web Application
has comment: http://stackoverflow.com/comment/42506239
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/comment/42424941
comment on: http://stackoverflow.com/q/26939755
score: 0
has text: You should re-examine *why* you need to do this. Possibly you should be using a database instead?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42337274
comment on: http://stackoverflow.com/q/26891371
type: QuestionComment
type: Comment
has text: I do have a concrete problem. I searched the web already, did not able to find a component like this.
score: 0

http://stackoverflow.com/comment/42343035
has text: @Deltharis the code posted is typically used in academic texts to teach the use of arrays. Although you are right about this being done better using an `enum`, you are missing the intent of the code (which is not about best practices).
comment on: http://stackoverflow.com/q/26893045
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42392448
type: QuestionComment
comment on: http://stackoverflow.com/q/26922275
has text: You should probably rethink your design, as the code is a bit of a tangled mess of if statement. Unless you resupply a value to `location0`, you wouldn't want to use that in a `while` loop.
type: Comment
score: 0

htmlunit
tags question: http://stackoverflow.com/q/26973509
type: Tag
tags question: http://stackoverflow.com/q/26969714
tags question: http://stackoverflow.com/q/26987714
tags question: http://stackoverflow.com/q/26858357
tag name: htmlunit

http://stackoverflow.com/q/26877611
has comment: http://stackoverflow.com/comment/42312446
has comment: http://stackoverflow.com/comment/42312365
has comment: http://stackoverflow.com/comment/42312497
has comment: http://stackoverflow.com/comment/42312415
has body: I am having an issue with my code that calculates an integer for the hand total in a game of Black Jack. For some reason the for loop is iterating the first time through twice, meaning that it uses i = 0 twice through the loop before incrementing i. Is there a reason why it is doing this? I don't know what to change. private void setTotal(){ boolean ace = false; for (int i = 0; i&lt;hand.size(); i++){ if((hand.get(i).getValue()) == 1){ handTotal += 1; ace = true; } else if((hand.get(i).getValue()) &gt; 10){ handTotal += 10; } else { handTotal += (hand.get(i).getValue()); } } if(ace == true &amp;&amp; handTotal&lt;12){ handTotal += 10; } } Below is the code with a bunch of print statements I've been using to check it. private void setTotal(){ boolean ace = false; for (int i = 0; i&lt;hand.size(); i++){ System.out.println("start " + i); if((hand.get(i).getValue()) == 1){ handTotal += 1; ace = true; System.out.println("ace one"); } else if((hand.get(i).getValue()) &gt; 10){ handTotal += 10; System.out.println("face card"); } else { handTotal += (hand.get(i).getValue()); System.out.println("num"); } System.out.println("end " + i); } if(ace == true &amp;&amp; handTotal&lt;12){ handTotal += 10; System.out.println("ace plus"); } } In the main, I run this public class BlackJack { public static void main(String[] args){ Deck deck = new Deck(); Dealer dealer = new Dealer(); deck.shuffle(); for(int i =0; i&lt;2; i++){ dealer.dealCard(deck.draw()); } System.out.println(dealer.getHand()); System.out.println(dealer.getHand().size()); System.out.println(dealer.getTotal()); } } And for example it printed start 0 num end 0 start 0 num end 0 start 1 num end 1 [7 of Clubs, 4 of Clubs] 2 18
has answer: http://stackoverflow.com/a/26877783
has comment: http://stackoverflow.com/comment/42312470
has comment: http://stackoverflow.com/comment/42312368
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42312459
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42312599
has title: Java for loop error, first item repeating
favorite count: 0
has comment: http://stackoverflow.com/comment/42312394
accepted answer: http://stackoverflow.com/a/26877783
has comment: http://stackoverflow.com/comment/42312357
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42312428
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42312656
tagged with: loops
upvote count: 1
has comment: http://stackoverflow.com/comment/42312525
type: Question
has comment: http://stackoverflow.com/comment/42312474

http://stackoverflow.com/a/48984472
has body: Simple we are adding semicolon after spring.jpa.hibernate.ddl-auto = create; which is wrong spring.jpa.hibernate.ddl-auto = create enough
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26881739

http://stackoverflow.com/q/26934791
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/42414066
tagged with: bubble-sort
has comment: http://stackoverflow.com/comment/42414109
has answer: http://stackoverflow.com/a/26935036
has comment: http://stackoverflow.com/comment/42414132
favorite count: 0
type: UnansweredQuestion
has body: Here is the source code. I don't see any problems with this bubble sorting code: int[] numbers = { 5, 8, 14, 1, 5678 }; int tempVar; for (int i = 0; i &lt; numbers.length; i++) { for(int j = 0; j &lt; numbers.length; j++) { if(numbers[i] &gt; numbers[j + 1]) { tempVar = numbers [j + 1]; numbers [j + 1]= numbers [i]; numbers [i] = tempVar; } } } for (int i = 0; i &lt; numbers.length; i++) { System.out.println(numbers[i].toString()); }
has title: Java array giving "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 6"
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/26935301
score: -1
has comment: http://stackoverflow.com/comment/42414166
type: Question
has comment: http://stackoverflow.com/comment/42414080

http://stackoverflow.com/a/26882212
has comment: http://stackoverflow.com/comment/42345267
has comment: http://stackoverflow.com/comment/42426790
has body: From my observation, I think your Query SELECT prod,price,count(*) FROM cart WHERE c_id="+cust+" GROUP BY i_id returns only one row. First of all you should not use res.next(); just before returning RESULTSET object. This is a wrong way of designing a function. What getCart(int item,int cust) should do is just return the RESULTSET. Problem that I assume , that seems to be here is that, your query just returns one row. As you call res.next(); just before returning the RESULTSET object. The resultset cursor already points to the first row of the result. When you call &lt;%while(r.next()){%&gt; , this time it gets NULL , because next row in resultset is non-existent. That`s why result cannot be printed. What I have observed now that you have made a typo in you jsp code. &lt;%=re.getString(1)%&gt; what it should be is &lt;%=r.getString(1)%&gt; beacause you are creating &lt;%ResultSet r=(ResultSet)request.getAttribute("cart");%&gt; Resultset variable named r but you are using re . But re does not exist in the file. I think JSP should not even compile, because re variable is never defined. Thats the reason its not working.
has comment: http://stackoverflow.com/comment/42396975
has comment: http://stackoverflow.com/comment/42432602
has comment: http://stackoverflow.com/comment/42362569
score: 0
has comment: http://stackoverflow.com/comment/42361716
answers question: http://stackoverflow.com/q/26875316
type: Answer

http://stackoverflow.com/q/26938123
has answer: http://stackoverflow.com/a/26938341
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42420763
possible better answer: http://stackoverflow.com/a/26938267
has answer: http://stackoverflow.com/a/26938267
tagged with: variables
answer count: 6
favorite count: 0
has body: Assume that i have two object Light and LightSwitch what i want to do is Switch on the LightSwitch then check that Light is turn on or turn off (In this case expected answer is 'on') note that when switch is turned on the shared variable name current will set to true then Light will also turn on What i am interested in on this problem are: How two classes (in this case are class Light and LightSwitch) can share variable value without using global variable (In this case the shared variable is current)? How to implements this simple problem in object-oriented concept? expected output (or just another output you prefer that can tell me ok, light is turn on/off): switch on: true // This line just set variable `current` in `LightSwitch` class Light is turned on // This line just check that `current` variable in `Light` class is True or false switch on: false Light is turned off
has comment: http://stackoverflow.com/comment/42420669
accepted answer: http://stackoverflow.com/a/26938341
has comment: http://stackoverflow.com/comment/42420864
has answer: http://stackoverflow.com/a/26938327
has answer: http://stackoverflow.com/a/26938526
upvote count: 1
has answer: http://stackoverflow.com/a/26938275
downvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26938311
has title: How to share variable between two classes without using global variable in Java?
tagged with: oop
tagged with: java

http://stackoverflow.com/q/26987665
downvote count: 0
linked to: http://stackoverflow.com/q/10305153
has body: If I have n lists: List&lt;int&gt; list1 = new List&lt;int&gt; List&lt;int&gt; list2 = new List&lt;int&gt; ... List&lt;int&gt; listn = new List&lt;int&gt; each of them contains different number of elements,e.g. list1.add(1) list1.add(2) list2.add(3) list2.add(4) list2.add(5) list3.add(6) ... listn.add(100000) listn.add(100001) and one list of lists List&lt;List&lt;int&gt;&gt; biglist = new ArrayList&lt;List&lt;int&gt;&gt; biglist.add(list1) biglist.add(list2) ... biglist.add(listn) then how can I generate permuationList from the biglist that contains elements, suppose the listn has m elements: [biglist.get(1).get(1),biglist.get(2).get(1), ..., biglist.get(n-1).get(1), biglist.get(n).get(1)] [biglist.get(1).get(1),biglist.get(2).get(1), ..., biglist.get(n-1).get(1), biglist.get(n).get(2)] ... [biglist.get(1).get(1),biglist.get(2).get(1), ..., biglist.get(n-1).get(1), biglist.get(n).get(m)] [biglist.get(1).get(1),biglist.get(2).get(1), ..., biglist.get(n-1).get(2), biglist.get(n).get(1)] .... Thanks!
has comment: http://stackoverflow.com/comment/42508503
has comment: http://stackoverflow.com/comment/42508522
type: Question
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/42519539
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42586377
has comment: http://stackoverflow.com/comment/42549255
has title: Find all permutations(cartesian product) from a list<list<int>> in java
has comment: http://stackoverflow.com/comment/42518370
upvote count: 1
has comment: http://stackoverflow.com/comment/42519292
has answer: http://stackoverflow.com/a/26988293
accepted answer: http://stackoverflow.com/a/26988293
has answer: http://stackoverflow.com/a/26999678
tagged with: arraylist
tagged with: int
has answer: http://stackoverflow.com/a/26988183
answer count: 3
linked to: http://stackoverflow.com/q/11485497
possible better answer: http://stackoverflow.com/a/26988183
favorite count: 0

http://stackoverflow.com/comment/42428982
type: Comment
comment on: http://stackoverflow.com/a/26942825
has text: `std::string::replace` can be called with either indexes or iterators.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42386919
comment on: http://stackoverflow.com/q/26919264
has text: Thank you ajb that makes complete sense, I should have remembered that
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26836145
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26836093
has body: Don't use an if statement to do this use a try/catch, it does exactly what you want. Here is a tutorial I found on Google for you to take a look at. For you it would look something like this: if (a &gt;= 0) for (int i = 0; i &lt; a; i++){ System.out.print("*Please enter an enteger: "); try{ //Try to get an int as input, continue if proper input is given n[i] = scan.nextInt(); }catch(Exception e){ //Handle your error here } } This captures all exceptions but if you only want to capture InputMismatchExceptions then you could do this: if (a &gt;= 0) for (int i = 0; i &lt; a; i++){ System.out.print("*Please enter an enteger: "); try{ //Try to get an int as input, continue if proper input is given n[i] = scan.nextInt(); }catch(InputMismatchException e){ //Handle your error here } }
downvote count: 0
type: Answer

http://stackoverflow.com/a/26908243
has body: ([^#]+)|(#[^#]+#) Try this.Grab the captures.See demo.use g flag or global match. http://regex101.com/r/pQ9bV3/1
answers question: http://stackoverflow.com/q/26908179
score: 0
has comment: http://stackoverflow.com/comment/42366822
accepted answer of: http://stackoverflow.com/q/26908179
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/42367205

http://stackoverflow.com/q/26979309
accepted answer: http://stackoverflow.com/a/27061722
tagged with: image
has body: I'm trying to extract the Date info from a picture. I'm getting along quite good but I have this problem bugging me for 2 days. I've even rewriten the entire code once and still get it. I obviously get an NP because I return a null in the method grabExifSubIFDDirectory. This is the main problem, it claims there is no Directory available while there should be one. Why can't it grab the directory? I'm using standrd jpegs and other formats. The jar is placed inside a folder with pictures. If somebody could point (hehe) me int the direction? Package utils: package utils; import com.drew.imaging.ImageMetadataReader; import com.drew.imaging.ImageProcessingException; import com.drew.metadata.Metadata; import com.drew.metadata.exif.ExifSubIFDDirectory; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Date; import javax.swing.JOptionPane; public class FileUtils { private ArrayList&lt;String&gt; fileNamesList; public FileUtils(String jarFilePath) { setFileNames(jarFilePath); } // Retrieves a Metadata object from a File object and returns it. public Metadata grabFileMetaData(String filePath) { Metadata metadata = null; File file = new File(filePath); try { metadata = ImageMetadataReader.readMetadata(file); } catch (ImageProcessingException e) { JOptionPane.showMessageDialog(null, "Error: " + e); } catch (IOException e) { JOptionPane.showMessageDialog(null, "Error: " + e); } return metadata; } // Retrieves a ExifSubIFDDirectory object from a Metadata object and returns it. public ExifSubIFDDirectory grabExifSubIFDDirectory(Metadata metadata, String filePath) { ExifSubIFDDirectory directory; if (metadata.containsDirectory(ExifSubIFDDirectory.class)) { directory = (ExifSubIFDDirectory) metadata.getDirectory(ExifSubIFDDirectory.class); return directory; } else { JOptionPane.showMessageDialog(null, "File at: " + filePath + " does not contain exif date."); return null; } } // Retrieves a Date object from a ExifSubIFDDirectory object and r…
answer count: 3
has title: Can't seem to retrieve a ExifSubIFDDirectory
downvote count: 0
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/27061722
has answer: http://stackoverflow.com/a/27073489
tagged with: exif
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42637741
tagged with: metadata
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27073265
type: Question
has answer: http://stackoverflow.com/a/27073265

http://stackoverflow.com/a/26955935
answers question: http://stackoverflow.com/q/26955841
score: 0
type: Answer
has body: Match the data you want, not the one you don't want. You probably want ([^ ]+), and keep the bracketed data, separated by whitespace. You might even want to narrow it down to ([^ ]+§[^ ]+),. Usually, stricter is better.

http://stackoverflow.com/q/26949249
type: Question
has title: Sentiment Analysis java Library
upvote count: 9
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/42454236
has comment: http://stackoverflow.com/comment/42441925
tagged with: sentiment-analysis
has answer: http://stackoverflow.com/a/26949370
tagged with: data-mining
has body: I have some unlabeled microblogging posts and I want to create a sentiment analysis module. To do this I have try Stanford library and Alchemy Api web service but the result it is not very good. For now I don't want training my classifier. So I would like to suggest me some libraries or some web services about that. I would prefer a tested Library. The language of this posts is English. Also the preprocessing has been done. P.S. The programing language that I use is Java EE
tagged with: text-mining
has answer: http://stackoverflow.com/a/28370936
favorite count: 0
has comment: http://stackoverflow.com/comment/42459887
accepted answer: http://stackoverflow.com/a/26949370
has answer: http://stackoverflow.com/a/40179753
answer count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26950384
downvote count: 2
has answer: http://stackoverflow.com/a/26950384
tagged with: machine-learning
has comment: http://stackoverflow.com/comment/42441911
has comment: http://stackoverflow.com/comment/42454161

http://stackoverflow.com/comment/42439477
score: 0
has text: How about posting some code for a simple example of what you want to do (as far as you can get), then maybe someone can help you out from there. But you will need a cell factory for what you want, and while you could hook into that in FXML, it has to be written in Java - either in the controller or in a stand alone class.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26945122

http://stackoverflow.com/comment/42270182
type: QuestionComment
has text: First count the number of 1s. Do this once only (your logic would have you count once per loop).
type: Comment
comment on: http://stackoverflow.com/q/26853802
score: 0

http://stackoverflow.com/comment/42287165
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26863738
score: 2
has text: And what you tried already?

http://stackoverflow.com/comment/107188387
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/36919009
has text: @deprecated The view drawing cache was largely made obsolete with the introduction of * hardware-accelerated rendering in API 11. With hardware-acceleration, intermediate cache * layers are largely unnecessary and can easily result in a net loss in performance due to the * cost of creating and updating the layer.

http://stackoverflow.com/q/26879358
upvote count: 1
has body: I am confusing with how to work well with encoding. Actually, I read some books and it says we should setCharacterEncoding before firstly getParameter(). While according to https://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#setCharacterEncoding%28java.lang.String%29 Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader(). Otherwise, it has no effect. So, I think since the container must know what the charset is in the HTTP body, so it seems we do not need setCharacterEncoding() if charset is declared in the HTTP body. I tried with my existing project, which will submit a request with a xml outputstream, I use conn.setRequestProperty("Content-type", "text/xml;charset=utf-8"); PrintWriter pw = new PrintWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8")); to encode the stream , and when I submit this request to a Servlet, even though I do not callrequest.setCharacterEncoding("UTF-8");` I can see that the Chinese Text is decoded well. So it seems it works , but when I remove charset=utf-8 from the content-type , it also works, this is even more confusing . Here is how I read the xml stream into a map. public static Map&lt;String, String&gt; parseXml(HttpServletRequest request) throws IOException, DocumentException { Map&lt;String,String&gt; map=new HashMap&lt;String,String&gt;(); InputStream is =request.getInputStream(); SAXReader reader=new SAXReader(); Document document=reader.read(is); Element root =document.getRootElement(); List&lt;Element&gt; elementList=root.elements(); for(Element e: elementList){ map.put(e.getName(), e.getText()); } return map; } Can anybody please explain a little bit about the how encoding works when Servlet handles POST request.And what will be the time we need explicitly setCharacterEncoding()? PS: I run my client project and server project in Eclipse.
type: Question
tagged with: java
tagged with: character-encoding
tagged with: servlets
tagged with: encoding
downvote count: 0
has comment: http://stackoverflow.com/comment/42316238
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42315544
tagged with: utf-8
answer count: 0
score: 1
has title: Is setCharacterEncoding() needed if charset is declared in content type?

http://stackoverflow.com/comment/42352151
has text: @Loafayyy Then wouldn't it be more entertaining to try to do it on your own instead of pasting a minimal attempt and asking others to do it for you?
comment on: http://stackoverflow.com/q/26899631
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26902218
downvote count: 0
has body: This usually happens because of library conflicts and resource issues, If you have already tried clean up. Check the dependencies, make sure you check if you have duel dependency for android API 4 jar
type: Answer
has comment: http://stackoverflow.com/comment/42379399
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42381874
answers question: http://stackoverflow.com/q/26902051
has comment: http://stackoverflow.com/comment/42382667
accepted answer of: http://stackoverflow.com/q/26902051
type: AcceptedAnswer

http://stackoverflow.com/q/26857976
has body: I am posting a code snippet which worked well on other forms to print Jasperreport as Pdf. &lt;p:commandButton id="cmdPrint" value="Print" actionListener="#{receiptMB.print()}" disabled="#{receiptMB.chkSave == false}" process="@this" /&gt; Backing Bean code snippet : public void print(){ try { JRBeanCollectionDataSource beanCollectionDataSource = new JRBeanCollectionDataSource(getObjPrintList()); String reportPath= FacesContext.getCurrentInstance().getExternalContext().getRealPath("/reports/Receipt.jasper"); JasperPrint jasperPrint=JasperFillManager.fillReport(reportPath,getReportParameters(), beanCollectionDataSource); HttpServletResponse httpServletResponse = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); httpServletResponse.setContentType("application / pdf"); httpServletResponse.addHeader("Content-disposition", "inline; filename=Receipt_" +objPrint.getDateNp()+".pdf"); ServletOutputStream servletOutputStream = httpServletResponse.getOutputStream(); servletOutputStream.write(JasperExportManager.exportReportToPdf(jasperPrint)); servletOutputStream.flush(); servletOutputStream.close(); FacesContext.getCurrentInstance().renderResponse(); FacesContext.getCurrentInstance().responseComplete(); } catch(JRException e){ e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } The above code is working well on other forms but it is not working in a particular form which is a Dialog.It gives no error but, also it doesn't give any output. I went around with some solutions but no work.
has comment: http://stackoverflow.com/comment/42317081
has comment: http://stackoverflow.com/comment/51025156
downvote count: 0
has comment: http://stackoverflow.com/comment/42295779
has comment: http://stackoverflow.com/comment/42359552
favorite count: 0
has title: Jasper Report integration in Primefaces
has comment: http://stackoverflow.com/comment/42332900
answer count: 0
tagged with: jsf
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42359581
linked to: http://stackoverflow.com/q/13682692
type: Question
tagged with: jasper-reports
has comment: http://stackoverflow.com/comment/42317568
tagged with: primefaces

protected
tags question: http://stackoverflow.com/q/26936567
tag name: protected
type: Tag

http://stackoverflow.com/comment/42262690
score: 0
comment on: http://stackoverflow.com/q/26849853
has text: So my next question is how would I do that? Do I need to create a new class for that set of buttons?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26848745
has comment: http://stackoverflow.com/comment/42282798
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26848496
upvote count: 1
type: Answer
has body: If you query for an entity and change the entity, the default behavior is to persist those changes via an update to the database. This is usually what you want to happen, but obviously not in all cases. If you want to avoid the update, you need to detach the entity by calling session.evict(apDaRip) where session is a reference to the hibernate session (see Session.evict()). You probably want to evict the entity right after you get it (immediately following the call to findById).

http://stackoverflow.com/q/26939774
upvote count: 0
has answer: http://stackoverflow.com/a/26940168
favorite count: 0
tagged with: cryptography
has comment: http://stackoverflow.com/comment/42434164
possible better answer: http://stackoverflow.com/a/26939887
accepted answer: http://stackoverflow.com/a/26940168
tagged with: encryption
has answer: http://stackoverflow.com/a/26939887
tagged with: python
has body: I've finished writing the encryption code for Caesar cipher in Java and my plan is to rewrite the program using the same logic in Python as well. Although it can be done in many ways, is there any way I can use something equivalent to StringBuilder in Python? If I have a hold variable in Python that stores a string value then how can I append new characters or strings in a way similar done in Java below? static String encrypt(String s, int shift) { shift = shift % 26 + 26; StringBuilder hold = new StringBuilder(); for (char i : s.toCharArray()) { if (Character.isLetter(i)) { if (Character.isUpperCase(i)) hold.append((char)('A' + (i - 'A' + shift) % 26 )); else hold.append((char)('a' + (i - 'a' + shift) % 26 )); } else hold.append(i); } return hold.toString(); }
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
has title: Python string concatation for Caesar cipher, comparable with Java code
type: Question
answer count: 2

http://stackoverflow.com/comment/42335881
type: Comment
type: QuestionComment
has text: Please search StackOverflow before posting. Your Question's topics have been addressed in hundreds of questions and answers. Tips: (1) when serializing a date-time value to a string, use the standard ISO 8601 format. (2) For a database, use a date-time data type rather than strings. Probably TIMESTAMP WITH TIME ZONE. Databases such as Postgres support an array of such values.
score: 0
comment on: http://stackoverflow.com/q/26884557

http://stackoverflow.com/q/26941145
type: Question
has body: I would like to read an array in from a file that is in the format of {{"text text text","text text","also text"},{"text text text","text text","also text"},{"text text text","text text","also text"}} from a file and don't know the best way to do it. How can I efficiently split the line in order to add them to an ArrayList in a for loop?
score: 0
tagged with: file-io
has answer: http://stackoverflow.com/a/26941244
answer count: 1
tagged with: arrays
type: UnansweredQuestion
tagged with: android
has title: Array of arrays from file in Java
tagged with: java

byte
tags question: http://stackoverflow.com/q/26895857
tag name: byte
tags question: http://stackoverflow.com/q/26975300
tags question: http://stackoverflow.com/q/26981097
tags question: http://stackoverflow.com/q/26836951
tags question: http://stackoverflow.com/q/26966446
tags question: http://stackoverflow.com/q/26976480
tags question: http://stackoverflow.com/q/26953964
tags question: http://stackoverflow.com/q/26944282
tags question: http://stackoverflow.com/q/26967252
tags question: http://stackoverflow.com/q/26837506
tags question: http://stackoverflow.com/q/26926132
type: Tag

http://stackoverflow.com/comment/42237489
type: AnswerComment
has text: @JasonC as per your comment, explanation added.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26835748

http://stackoverflow.com/a/26931380
score: 0
answers question: http://stackoverflow.com/q/26928735
type: Answer
has body: In the mean time I have found customizeContext method in ContextLoader which reads defined ApplicationContextInitializers. It is executed after the environment was created and before the context is reloaded, so decryption in an initializer should work (at least in the base case): ConfigurableEnvironment env = wac.getEnvironment(); (...) customizeContext(sc, wac); wac.refresh();

http://stackoverflow.com/q/26946284
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: First off, I am sorry to ask this question, as this has been asked by others several months and years back. I could however not find a fix for this. I was following the Google Play Services tutorial to include the G+ Sign-In button in one of my XML layouts for one of my apps that uses Google Play Services. Meaning adding the following snipped to my layout: &lt;com.google.android.gms.common.SignInButton android:id="@+id/sign_in_button" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; I however am unable to do so, because eclipse always tells me : The following classes could not be instantiated: - com.google.android.gms.common.SignInButton The exception stack trace looks like this: java.lang.VerifyError: Expecting a stackmap frame at branch target 15 Exception Details: Location: com/google/android/gms/common/SignInButton.z(Landroid/content/Context;)V @4: ifnull Reason: Expected stackmap frame at this location. Bytecode: 0000000: 2ab4 0016 c600 0b2a 2ab4 0016 b600 252a 0000010: 2b2a b400 182a b400 15b8 0029 b500 16a7 0000020: 001c 4d12 0512 04b8 001a 572a 2b2a b400 0000030: 182a b400 15b8 0021 b500 162a 2ab4 0016 0000040: b600 222a b400 162a b600 24b6 001b 2ab4 0000050: 0016 2ab6 001c b1 Exception Handler Table: bci [15, 31] =&gt; handler: 34 at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:367) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:194) at com.android.layoutlib.bridge.android.BridgeInflater.loadCustomView(BridgeInflater.java:205) at com.android.layoutlib.bridge.android.BridgeInflater.createViewFromTag(BridgeInflater.java:133) at android.view.LayoutInflater.rInflate(LayoutInflater.java:623) at and…
has comment: http://stackoverflow.com/comment/42751981
downvote count: 0
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/33113353
has title: Failed to instantiate com.google.android.gms.common.SignInButton
tagged with: eclipse
tagged with: google-play-services
upvote count: 1
answer count: 1

http://stackoverflow.com/comment/42456168
has text: Yes ..even with using javascript failing to set/send text in text field.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26958449
score: 0

http://stackoverflow.com/q/26974162
tagged with: timeout
tagged with: httpclient
tagged with: proxy
score: 0
type: Question
has title: org.apache.http.conn.ConnectTimeoutException though setting proxy
answer count: 1
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/26974288
type: UnansweredQuestion
has body: I am using HttpClient to send get requests. It works fine when I am at home. But when I run my application with my company's network, I will have org.apache.http.conn.ConnectTimeoutException although I tried below ways to set proxy: 1. System.setProperty("http.proxyHost", "cn-proxy.cn.oracle.com"); System.setProperty("http.proxyPort", "80"); Add to the VM arguments at Run configuration -Dhttp.proxyHost=proxyserver.com -Dhttp.proxyPort=80
tagged with: java

http://stackoverflow.com/q/26887269
downvote count: 0
tagged with: tnef
has body: I have a HMEFMessage and iterating all attachments using for (Attachment tnefAttachment : hmef.getAttachments()) { Attachment size can be obtained using tnefAttachment.getMAPIAttribute(MAPIProperty.ATTACH_SIZE) . This method returns MAPIAttribute instance and it has only getData(), which returns byte[]. How can I convert byte[] from MAPIAttribute to Long (size)? According to this - https://poi.apache.org/apidocs/org/apache/poi/hmef/attribute/package-summary.html - there is a MAPIStringAttribute.getAsString(attr), which does not work with ATTACH_SIZE. EDIT - ATTACH_SIZE is Long according to http://grepcode.com/file/repo1.maven.org/maven2/org.openl.rules/org.openl.lib.poi.dev/5.9.4.1/org/apache/poi/hsmf/datatypes/MAPIProperty.java .
answer count: 1
has answer: http://stackoverflow.com/a/26887555
favorite count: 0
linked to: http://stackoverflow.com/q/1026761
type: UnansweredQuestion
upvote count: 1
has title: Apache POI HMEF - How to get attachment size from MS TNEF message?
tagged with: apache-poi
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/32371640
score: 13
downvote count: 1
has body: Check your module dependencies. Project Structure (Ctrl+Alt+Shift+S). Modules Select your problem module. Change tab on top of window "Dependencies". Check what needed library (maybe, you need to add specified library in the tab 'libraries') or module has listed here and it has right scope ('complile' mostly).
answers question: http://stackoverflow.com/q/26952078
type: Answer
upvote count: 14

http://stackoverflow.com/a/26968269
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42478909
has comment: http://stackoverflow.com/comment/112719497
has comment: http://stackoverflow.com/comment/42475085
score: 10
accepted answer of: http://stackoverflow.com/q/26968213
upvote count: 10
has body: public static void main(String[] args) { String quote = "\u005c\u0022"; System.out.println(quote); } Output " public static void main(String[] args) { String quote = "\u005c\u0022" + "abc" + "\u005c\u0022"; System.out.println(quote); } Output "abc" If you wanted to put the two double quote chars into the string literal, you can do it with normal escape sequences. But you can't do with Unicode escapes because Java provides no special treatment for Unicode escapes within string literals. String quote = "\""; // We can't represent the same string with a single Unicode escape. // \u0022 has exactly the same meaning to the compiler as ". // The string below turns into """: an empty string followed // by an unterminated string, which yields a compilation error. String quote = "\u0022";
answers question: http://stackoverflow.com/q/26968213
type: AcceptedAnswer

http://stackoverflow.com/a/26931634
type: Answer
score: 6
has body: The standard Period object divides the period into years, months, weeks, days, and the time fields. A duration of more than a week will add to the weeks field, and the days field is, more or less, the remainder of dividing the duration by 7. The PeriodFormatter merely prints the fields as they are inside the Period object. It doesn't make any calculations. If the days field is 2, it will stay 2 even if you haven't included the weeks. To get the period with weeks represented in the days field instead of the weeks field, you should either create a period with a different type: Period periodWithoutWeeks = new Period( Date().getTime(), new DateTime(2014, 12, 25, 0, 0).getMillis(), PeriodType.yearMonthDayTime()); Or convert your period to the type without weeks by assuming a week is a standard 7 days: Period periodWithoutWeeks = period.normalizedStandard(PeriodType.yearMonthDayTime()); Now you can print it with either of the formatters: System.out.println( f2.print(periodWithoutWeeks) );
downvote count: 0
has comment: http://stackoverflow.com/comment/75866335
accepted answer of: http://stackoverflow.com/q/26930961
answers question: http://stackoverflow.com/q/26930961
upvote count: 6
type: AcceptedAnswer

http://stackoverflow.com/comment/42581059
has text: Well,I still believe there must be a way to do this purely with java, but I can't figure it out. I have no issues getting the file names from the header, but they are useless if I don't know which input they were uploaded from. I did find a suitable solution though. Since I do know which input the files are uploaded from before I upload them, I wrote a simple JavaScript function to set the file names in hidden inputs. I hard coded it for the maximum number of files, which is 12, but I'm exploring changing it to use files.length instead.
type: Comment
comment on: http://stackoverflow.com/q/26947054
score: 0
type: QuestionComment

http://stackoverflow.com/q/26973754
tagged with: java
has comment: http://stackoverflow.com/comment/42527415
type: Question
has answer: http://stackoverflow.com/a/26997133
tagged with: websphere
answer count: 2
has comment: http://stackoverflow.com/comment/42523993
has title: Add a parameter to a shared library in WebSphere
has comment: http://stackoverflow.com/comment/42524769
score: 0
has comment: http://stackoverflow.com/comment/42497450
tagged with: shared-libraries
has answer: http://stackoverflow.com/a/26973969
type: UnansweredQuestion
has body: I developped a shared library used by 2 web applications deployed in WebSphere 7. This library is defined a the 'server' level. It main purpose is to read a file on the file system. I set the path to the file in the Java code but I want to put it in WebSphere. Even if the path should not change before a long time, it would be much more cleaner. Is it possible ? If no, what would be the best alternative ? Thanks !
has comment: http://stackoverflow.com/comment/42526613

http://stackoverflow.com/a/27120533
score: 0
type: Answer
has body: How to deal with the StackOverflowError: The simplest solution is to carefully inspect the stack trace and detect the repeating pattern of line numbers. These line numbers indicate the code being recursively called. Once you detect these lines, you must carefully inspect your code and understand why the recursion never terminates. If you have verified that the recursion is implemented correctly, you can increase the stack’s size, in order to allow a larger number of invocations. Depending on the Java Virtual Machine (JVM) installed, the default thread stack size may equal to either 512KB, or 1MB. You can increase the thread stack size using the -Xss flag. This flag can be specified either via the project’s configuration, or via the command line. The format of the -Xss argument is: -Xss&lt;size&gt;[g|G|m|M|k|K] By the way it seems a eclipse bug(Read this ref) which has been fixed in the latest version.
answers question: http://stackoverflow.com/q/26911263

http://stackoverflow.com/a/26950033
upvote count: 41
has comment: http://stackoverflow.com/comment/42444255
type: Answer
has comment: http://stackoverflow.com/comment/42444216
has comment: http://stackoverflow.com/comment/134626171
downvote count: 2
has comment: http://stackoverflow.com/comment/42441897
has comment: http://stackoverflow.com/comment/42451293
has comment: http://stackoverflow.com/comment/42445973
has body: Just move the file directly to the project folder which calls Java (and something under the blue-blurred stripe you made :P). If that doesn't help, then move the test123.txt file to FirstJavaProgram directory. You can also change filename to one of these: src/test123.txt FirstJavaProgram/src/test123.txt I am not sure which one will be fine in your case.
answers question: http://stackoverflow.com/q/26949985
accepted answer of: http://stackoverflow.com/q/26949985
type: AcceptedAnswer
score: 39

http://stackoverflow.com/q/26949085
has comment: http://stackoverflow.com/comment/42439765
has comment: http://stackoverflow.com/comment/42439790
possible better answer: http://stackoverflow.com/a/26949121
linked to: http://stackoverflow.com/q/2535723
type: AnsweredQuestion
has title: Java generate random solution
has comment: http://stackoverflow.com/comment/42439797
has comment: http://stackoverflow.com/comment/42439755
has comment: http://stackoverflow.com/comment/42439907
has answer: http://stackoverflow.com/a/26949245
type: Question
tagged with: stack
tagged with: java
accepted answer: http://stackoverflow.com/a/26949245
tagged with: random
answer count: 2
has comment: http://stackoverflow.com/comment/42439964
has answer: http://stackoverflow.com/a/26949121
has body: I am doing scheduling system and it will produce a random timetable, due to random method it will cause some of the exam can't add to the timetable and it will result stack over flow error..... but sometime it will able to produce a complete timetable. So I want to ask here how can i do like this: if result == stack over flow error { redo the function }
score: 0
has comment: http://stackoverflow.com/comment/42439796

http://stackoverflow.com/a/26876487
upvote count: 1
has comment: http://stackoverflow.com/comment/42310810
has comment: http://stackoverflow.com/comment/42310740
has comment: http://stackoverflow.com/comment/42349883
type: Answer
has comment: http://stackoverflow.com/comment/42311080
answers question: http://stackoverflow.com/q/26874072
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42321495
has comment: http://stackoverflow.com/comment/42359121
has body: First of all, the biggest mistake you make is to add to your variables inside the loop without resetting them first. Why is that? In the first iteration of the loop, you may get the correct numbers based on the initializations you made outside the box. But then, in the second loop, the numbers are already adjusted for the first moved box (supposedly). But now we move a box from a stack that comes before it, and you add to the numbers that were there from the first moving. So if you had topNum as 8 from the first calculation (for box 5), you now add to it! It certainly can't be the correct topNum for box 3 if it is a number bigger than 8. The only variable that should increase from iteration to iteration is the counter. All the others need to be reset every time. But given a box number, you probably want to calculate the stack by looping: starting with p, and then adding p+k numbers and checking if it's the correct stack, and if not, adding another p+2k numbers etc. You need a loop. I think you got the too loops confused. There should be one outer loop to get the numbers, and one inner loop to calculate the stacks, starting from the first stack every time. So the math is: We notice that stack number n is always size p + (n-1)×k. The first is 3, the second is 5, the third is 7 boxes tall. We also notice that each stack ends with a number is the sum of the height of itself plus the previous ones. topNumber = p + ( p + k ) + ( p + 2k ) ... ( p + (n-1)×k ) For n=1 this would be p (3). For n=2 this would be 2p+2 (8), for n=3 this would be 3p+k+2k which is 9+2+4 (15). So for a single box number, given as numBox, you do something like: int topNumber = p; int height = p; while ( topNumber &lt; numBox ) { height += k; topNumber += height; } movedBoxes = topNumber - numBox; (In case you haven't learned this yet, x += y is the same as x = x + y). So you see, you were almost there. You shouldn't have added anything to your base as you were not using it. In fact if you have a var…

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/26849572
tags question: http://stackoverflow.com/q/26842454
type: Tag
tags question: http://stackoverflow.com/q/26957477
tags question: http://stackoverflow.com/q/26883687

http://stackoverflow.com/comment/42457370
comment on: http://stackoverflow.com/q/26959446
has text: Have you initialized this loginOpenHelper ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26960410
has answer: http://stackoverflow.com/a/26960786
favorite count: 0
has title: Getting ArrayOutofBoundsException in my for Loop
has answer: http://stackoverflow.com/a/26960458
answer count: 5
has body: public class WeightOnPlanetsV1 { public static double[] calcWeight(double[] gravity, double[]mass) { double[] weight = new double[gravity.length]; for (int i = 0; i &lt; gravity.length; i++) { weight[i] = (mass[i] * 1000) / gravity[i]; weight[i] = weight[i] / 433.59237; } return weight; } public static double[] takeFromFile(double[] gravity)throws IOException { File fileName = new File("GravityResults.txt"); Scanner inFile = new Scanner(fileName); for (int i = 0; i &lt; gravity.length; i++) { gravity[i] = inFile.nextDouble(); gravity[i] = gravity[i] / 10; } inFile.close(); return gravity; } public static void printResults(String[] names, double[] gravity, double weight[]) { System.out.printf("%37s \n","My Weight on the Planets"); System.out.printf("%5s %20s %15s \n","Planet","Gravity","Weight(lbs)"); System.out.println("---------------------------------------"); for (int i = 0; i &lt; names.length; i++) { System.out.printf("%5s %10f %15f \n",names[i], gravity[i], weight[i]); } } public static void main(String[] args)throws IOException { String[] names = {"Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto"}; double[] weightOnPlanets = {100, 100, 100, 100, 100, 100, 100, 100, 100}; double[] gravity = {}; double[] masses = {3.3022 * Math.pow(10,23), 4.8685 * Math.pow(10,24), 5.9736 * Math.pow(10,24), 6.4185 * Math.pow(10,23), 1.8986 * Math.pow(10,27), 5.6846 * Math.pow(10,26), 8.6810 * Math.pow(10,25), 1.0243 * Math.pow(10,26), 1.312 * Math.pow(10,22)}; double[] gravities = takeFromFile(gravity); double[] finalWeights = calcWeight(gravities,masses); printResults(names, gravities, finalWeights); } } My error comes from for (int i = 0; i &lt; names.length; i++) { System.out.printf("%5s %10f %15f \n",names[i], gravity[i], weight[i]); } when I try to print the results. It gives me java.lang.ArrayIndexOutOfBoundsException: 1 at WeightOnPlanetsV1.printResults(WeightOnPlanetsV1.java:45) at WeightOnPlanetsV1.main(WeightOnPlanetsV1.java:63) as…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26960786
has answer: http://stackoverflow.com/a/26960430
score: 1
tagged with: java
tagged with: loops
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/42459178
possible better answer: http://stackoverflow.com/a/26960430
tagged with: for-loop
has answer: http://stackoverflow.com/a/26960520
tagged with: arrays
has answer: http://stackoverflow.com/a/26960507
downvote count: 0

http://stackoverflow.com/q/26937744
answer count: 1
has comment: http://stackoverflow.com/comment/42419832
has comment: http://stackoverflow.com/comment/42419703
favorite count: 0
has comment: http://stackoverflow.com/comment/42419779
has comment: http://stackoverflow.com/comment/42419791
type: AnsweredQuestion
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/26937944
type: Question
has comment: http://stackoverflow.com/comment/42419748
score: -2
has title: Weird type mismatch error
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26937944
upvote count: 0
has body: I am getting a strange type mismatch error in Eclipse which says Type mismatch: cannot convert from MyLinkedList.Node&lt;Type&gt; to MyLinkedList.Node&lt;Type&gt; Both from and to are same. Still Type mismatch ? :( Code: import java.util.Iterator; public class MyLinkedList&lt;Type&gt; implements Iterable&lt;Type&gt; { private Node&lt;Type&gt; head; // default contructor initializes the null list public MyLinkedList(){ head = null; } // Static Inner Node Class private static class Node&lt;Type&gt;{ private Type data; private Node&lt;Type&gt; next; public Node(Type dataValue, Node&lt;Type&gt; nextNode){ this.data = dataValue; this.next = nextNode; } } @Override public Iterator&lt;Type&gt; iterator() { // TODO Auto-generated method stub return null; } private class LinkedListIterator&lt;Type&gt;{ private Node&lt;Type&gt; nextNode; public LinkedListIterator(){ ///////////////////////////////// ERROR /////////////////////////// nextNode = head; } } } error goes away if I apply this cast: nextNode = (Node&lt;Type&gt;) head;

http://stackoverflow.com/comment/42286616
comment on: http://stackoverflow.com/q/26863299
score: 0
has text: No the level of microphone is not the problem. If I select another audio device as primary in my OS then it works fine too.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42482323
type: QuestionComment
type: Comment
has text: Why you want to use Set and perform split and why not just array/List so when you put element into you check for duplication?
score: 0
comment on: http://stackoverflow.com/q/26973561

http://stackoverflow.com/comment/54085779
has text: I had to wait a while before I saw the changes in my program. I'm guessing that the FTP host was doing some weird caching of my files.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26883943
score: 0

http://stackoverflow.com/q/26951719
has body: I am trying to rotate a first person view "camera" around it's own coordinates, instead, it is getting rotated around the origin. Here is my current code for the camera translation and rotation. if (Keyboard.isKeyDown(Keyboard.KEY_W)) { xMod -= 0.0025f * (float)delta * (float)Math.sin(Math.toRadians(camera.rotation.y)); zMod += 0.0025f * (float)delta * (float)Math.cos(Math.toRadians(camera.rotation.y)); } if (Keyboard.isKeyDown(Keyboard.KEY_S)) { xMod += 0.0025f * (float)delta * (float)Math.sin(Math.toRadians(camera.rotation.y)); zMod -= 0.0025f * (float)delta * (float)Math.cos(Math.toRadians(camera.rotation.y)); } if (Keyboard.isKeyDown(Keyboard.KEY_A)) { xMod -= 0.0025f * (float)delta * (float)Math.sin(Math.toRadians(camera.rotation.y-90)); zMod += 0.0025f * (float)delta * (float)Math.cos(Math.toRadians(camera.rotation.y-90)); } if (Keyboard.isKeyDown(Keyboard.KEY_D)) { xMod -= 0.0025f * (float)delta * (float)Math.sin(Math.toRadians(camera.rotation.y+90)); zMod += 0.0025f * (float)delta * (float)Math.cos(Math.toRadians(camera.rotation.y+90)); } if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { Mouse.setGrabbed(false); } if (Mouse.isButtonDown(0)) { Mouse.setGrabbed(true); } if (Mouse.isGrabbed()) { camera.rotation.y += (Mouse.getDX() * 0.005f) * delta; camera.rotation.x += (Mouse.getDY() * -0.005f) * delta; } if (camera.rotation.x &gt;= 90f) { camera.rotation.x = 90f; } else if (camera.rotation.x &lt;= -90f) { camera.rotation.x = -90f; } if (Mouse.isGrabbed()) { camera.position.x += xMod; camera.position.z += zMod; } camera.reset(); Matrix4f.translate(camera.rotation, camera.matrix(Camera.VIEWMATRIX), camera.matrix(Camera.VIEWMATRIX)); Matrix4f.rotate(degToRad(camera.rotation.x), new Vector3f(1f,0f,0f), camera.matrix(Camera.VIEWMATRIX), camera.matrix(Camera.VIEWMATRIX)); Matrix4f.rotate(degToRad(camera.rotation.y), new Vector3f(0f,1f,0f), camera.matrix(Camera.VIEWMATRIX), camera.matrix(Camera.VIEWMATRIX)); Matrix4f.rotate(degToRad(camera.rotation.z), new Vector3f(0f,…
type: AnsweredQuestion
tagged with: opengl
tagged with: java
tagged with: lwjgl
type: Question
tagged with: camera
has answer: http://stackoverflow.com/a/26953081
accepted answer: http://stackoverflow.com/a/26953081
has title: LWJGL ViewMatrix First Person View
score: 0
answer count: 1

http://stackoverflow.com/q/26901995
tagged with: jira
type: Question
answer count: 1
downvote count: 0
has body: Hi I am trying to post the build failure status to jira from jenkins. I am using Jenkins 1.588 and jira plugin 1.39 I have configured the jenkis to use my jira account. Its not working. I am hosting jenkins in Apache Tomcat 7.0.14 and my java version is 1.7. I am getting the logs as follows.The issue is not creating in jira....please help. Nov 13, 2014 10:25:28 AM org.kohsuke.stapler.RequestImpl$TypePair convertJSON WARNING: 'stapler-class' is deprecated: hudson.scm.subversion.UpdateUpdater Nov 13, 2014 10:25:29 AM org.kohsuke.stapler.RequestImpl$TypePair convertJSON WARNING: 'stapler-class' is deprecated: hudson.plugins.jira.JiraCreateIssueNotif ier Nov 13, 2014 10:25:29 AM org.kohsuke.stapler.RequestImpl$TypePair convertJSON WARNING: 'stapler-class' is deprecated: hudson.scm.subversion.UpdateUpdater Nov 13, 2014 10:25:29 AM org.kohsuke.stapler.RequestImpl$TypePair convertJSON WARNING: 'stapler-class' is deprecated: hudson.plugins.jira.JiraCreateIssueNotif ier There is no such file...!! Nov 13, 2014 10:25:53 AM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data : 5BAD035FB714EB55 Nov 13, 2014 10:25:53 AM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data : 5BAD035FB714EB55 Nov 13, 2014 10:25:54 AM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data : 5BAD035FB714EB55 Nov 13, 2014 10:25:56 AM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data : 5BAD035FB714EB55 Nov 13, 2014 10:26 0 AM javax.jmdns.impl.DNSIncoming readAnswer WARNING: There was an OPT answer. Not currently handled. Option code: 65002 data : 5BAD035FB714EB55 Nov 13, 2014 10:26 4 AM org.jboss.resteasy.core.ExceptionHandler SEVERE: failed to execute
favorite count: 0
tagged with: jira-plugin
score: 2
upvote count: 2
tagged with: jenkins
type: UnansweredQuestion
has title: Jira plugin for Jenkins is not woking?
tagged with: java
has answer: http://stackoverflow.com/a/35574600
tagged with: jenkins-plugins

http://stackoverflow.com/q/26952988
has comment: http://stackoverflow.com/comment/42446518
has comment: http://stackoverflow.com/comment/42446538
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/26953090
has answer: http://stackoverflow.com/a/26953090
tagged with: maven
accepted answer: http://stackoverflow.com/a/26953126
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42446591
has comment: http://stackoverflow.com/comment/42446535
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42446570
has title: accessing a random variable from another class
answer count: 2
has body: It maybe a really easy question, but I'm confused. I have a main class and many other classes. In class DATA, one array (X_TRAIN) will be generated randomly. public class DATA { public double[][] X_TRAIN; public DATA() throws FileNotFoundException, IOException { X_TRAIN = new double[2][2]; // X_TRAIN will be filled randomly } public double[][] X_TRAIN() { return X_TRAIN; } } the way I call DATA class in other classes is the following: DATA data_input = new DATA(); and the problem is that each time I call DATA, a totally new arrays (X_TRAIN) will be generated and it is not what I want. I want to have a unique X_TRAIN array. I need to call DATA because I need to have access to X_TRAIN in other classes. Maybe I'm using a wrong method to have access to X_TRAIN. My code is written in maven and the IDE is netbeans. I even tried to define X_TRAIN as private: private double[][] X_TRAIN; and got the following error: Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - X_TRAIN has private access in com.mycompany.cpxr_main.DATA at com.mycompany.cpxr_main.MAIN_CLASS.main(MAIN_CLASS.java:61)
has answer: http://stackoverflow.com/a/26953126
tagged with: private

http://stackoverflow.com/q/26901902
favorite count: 0
has body: I was just converting Json file to excel. I am getting this error. Could anyone please help out. why does this error occurred. net.sf.json.JSONException: A JSONObject text must end with '}' at character 1 of { at net.sf.json.util.JSONTokener.syntaxError(JSONTokener.java:502) at net.sf.json.JSONObject.&lt;init&gt;(JSONObject.java:668) at net.sf.json.JSONObject.&lt;init&gt;(JSONObject.java:840) at net.sf.json.JSONObject.fromString(JSONObject.java:260) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:91) at net.sf.json.JSONSerializer.toJSON(JSONSerializer.java:52) at javanewprog.ReadJson.main(ReadJson.java:40) JSON: { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": [ "GML", "XML" ] }, "GlossSee":"markup" } } } } }
has comment: http://stackoverflow.com/comment/42356172
has comment: http://stackoverflow.com/comment/42355790
has answer: http://stackoverflow.com/a/26903897
has title: Java Program for coverting Json to Excel new
has comment: http://stackoverflow.com/comment/42356134
type: UnansweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/42357649
has comment: http://stackoverflow.com/comment/42357904
type: Question
has comment: http://stackoverflow.com/comment/42355809
score: -2
has comment: http://stackoverflow.com/comment/42356067
has comment: http://stackoverflow.com/comment/42356021
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/42498245
type: QuestionComment
comment on: http://stackoverflow.com/q/26938205
score: 0
type: Comment
has text: All I can say is that this usually works fine. Perhaps try with a simplified build, to rule out other problems. Also, don't apply the `ear` plugin to the root project.

http://stackoverflow.com/a/26877048
accepted answer of: http://stackoverflow.com/q/26876945
score: 2
has comment: http://stackoverflow.com/comment/42311428
has body: The @Override annotation only makes sense when you're extending a class or implementing an interface. You're doing neither here. My guess is that you're trying to extend Application.Adapter which is documented here. If so, replace public class Chief { //... with public class Chief extends Adapter { //... while importing org.apache.pivot.wtk.Application.Adapter.
answers question: http://stackoverflow.com/q/26876945
downvote count: 0
has comment: http://stackoverflow.com/comment/42351651
has comment: http://stackoverflow.com/comment/42311277
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42321912
type: Answer
has comment: http://stackoverflow.com/comment/42312106

http://stackoverflow.com/comment/42383633
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26916599
score: 1
has text: feedList.getContext()

http://stackoverflow.com/a/26891831
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
has body: If x is less or equal to 0, i will be initialized with x value and the for loop won't execute anything due to the condition i &gt;= 1, thus the method will return 0. Probably you should try to initialize i to (int)Math.abs(x).
upvote count: 1
answers question: http://stackoverflow.com/q/26891789
accepted answer of: http://stackoverflow.com/q/26891789

http://stackoverflow.com/comment/42458372
comment on: http://stackoverflow.com/q/26959855
score: 0
has text: problem was user was a reserved word in postgres
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26922525
downvote count: 1
tagged with: android-ndk
type: Question
answer count: 2
tagged with: java-native-interface
has comment: http://stackoverflow.com/comment/42433873
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/42397133
has comment: http://stackoverflow.com/comment/42396029
score: 0
has comment: http://stackoverflow.com/comment/42395366
has answer: http://stackoverflow.com/a/26927684
has body: I'm new to android and JNI. I want to access files in the device. I've added permissions to the Manifest yet it doesn't work. The Java code: public class MainActivity extends ActionBarActivity { public native String setFilePath(String path); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView tv = new TextView(this); tv.setText( "1111" ); setContentView(tv); String path = Environment.getExternalStorageDirectory().getPath()+"/xyz"; Log.i("java ", path); setFilePath(path); } } The C code: jint Java_package_MainActivity_setFilePath(JNIEnv* env, jobject this,jstring Path){ path = (*env)-&gt;GetStringUTFChars( env, Path , NULL ) ; __android_log_print(ANDROID_LOG_DEBUG, "SO", "fopen(%s)", path); FILE* file = fopen(path,"ab+"); (*env)-&gt;ReleaseStringUTFChars( env, Path , path ); fputs("Testing!\n", file); fclose(file); return 0; } An error comes up as: Fatal signal 11 (SIGSEGV) at 0x0000000c (code=1), thread 16152
has comment: http://stackoverflow.com/comment/42399266
tagged with: android
has comment: http://stackoverflow.com/comment/42398671
has comment: http://stackoverflow.com/comment/42394844
has comment: http://stackoverflow.com/comment/42394814
favorite count: 0
has comment: http://stackoverflow.com/comment/42398010
has comment: http://stackoverflow.com/comment/42395921
has title: File operations JNI
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42395399
upvote count: 1
has comment: http://stackoverflow.com/comment/42413153
has comment: http://stackoverflow.com/comment/42393670
has comment: http://stackoverflow.com/comment/42395073
has comment: http://stackoverflow.com/comment/42397074
tagged with: java
has comment: http://stackoverflow.com/comment/42392976
has answer: http://stackoverflow.com/a/26924202

http://stackoverflow.com/q/26970501
has title: Regex to extract only String from a matched content using lookahead and lookbehind
score: 2
tagged with: java
has answer: http://stackoverflow.com/a/26973636
type: Question
tagged with: regex-lookarounds
has comment: http://stackoverflow.com/comment/42477539
downvote count: 0
has answer: http://stackoverflow.com/a/26970721
favorite count: 0
answer count: 3
has body: Consider the following text which is part of a file Name &amp; Emp No Jack Doe 1234 John 12345 Dob : 28/12/1987 Now i would like to write a single regex (java flavor) to extract only the names from the above text. I tried the following regex with lookahead and lookbehind (?&lt;=(Name\s&amp;\sEmp\sNo)\s{2,3})((.{1,100}\s{0,3}){0,5}?)(?=Dob) and the output which i got was Jack Doe 1234[CR][LF]John 12345[CR][LF] If i want only the names as output, how can i modify this regex?
tagged with: regex
has comment: http://stackoverflow.com/comment/42477280
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26974649

http://stackoverflow.com/q/26897198
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26897515
tagged with: weak-references
tagged with: android
tagged with: memory-leaks
favorite count: 0
has body: Consider I have a class structure similar to this class Outer extends Activity { Map&lt;String, String&gt; outerMap; public Map getSampleMap() { return sampleMap; } static class Inner { Map&lt;String, String&gt; innerMap; Inner(Outer outer) { /* Weak ref to outer class object */ WeakReference weakref = new WeakReference&lt;Outer&gt;(outer); /* reference to the outer map using the weak ref */ innerMap = weakref.get().getSampleMap(); } void doSomething() { // Operations on the innerMap } } } Now in the above code structure Is innerMap hold a strong reference to the outerMap ? If I were to pass the innerMap in a callback such that it outlives the Outer Class (perhaps config changes) would it leak ? Will the outer class object be GC'ed ? Can someone point me to a good source for reference.
upvote count: 1
has comment: http://stackoverflow.com/comment/42348235
type: AnsweredQuestion
score: 1
tagged with: java
has title: Understanding Weak References
has comment: http://stackoverflow.com/comment/42348015
has answer: http://stackoverflow.com/a/26897515
type: Question
has comment: http://stackoverflow.com/comment/42347952

http://stackoverflow.com/comment/42380898
type: Comment
comment on: http://stackoverflow.com/q/26893717
has text: @HovercraftFullOfEels what update answer from yesterday has not been edited for over 19 hours ?
score: 0
type: QuestionComment

http://stackoverflow.com/a/26969662
has comment: http://stackoverflow.com/comment/42478796
score: 3
downvote count: 0
has body: Unless you're going to use a managed service like AWS RDS or Heroku Postgres, the only Java APIs for this are those that concern file access and process management. If you're using AWS RDS you can use the AWS Java SDK; for Heroku there may be something similar. If you're working with stock directly-managed PostgreSQL instances you'll need to open/parse/modify/write any relevant config files, or use external tools to do so. For starting/stopping DBs you'll need to use the regular utilities like pg_ctl via process invocation. If you need to work remotely on machines you'll probably want to use one of the Java SSH libraries. So you'll be using things like ProcessBuilder, java.io.InputStreamReader, etc, possibly alongside remote shell tools like JSCH. If you want to get fancy, you can use SSH as the transport between your master JVM and a JVM on each node, which is responsible for running processes and modifying files, and you can exchange serialized messages over the SSH channel for communication. While it's a bit more code to get it set up, this works extremely well and lets you "think in Java" to a greater degree than most other approaches. Personally - I strongly suggest using Puppet, Chef, Ansible, etc to automate as much as possible, then just have your Java code invoke the automation tools. Also look into repmgr.
answers question: http://stackoverflow.com/q/26969404
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42509279
has comment: http://stackoverflow.com/comment/42476556
accepted answer of: http://stackoverflow.com/q/26969404
upvote count: 3
has comment: http://stackoverflow.com/comment/42509035
type: Answer

http://stackoverflow.com/a/26886715
has body: the answer is yes. The order of the configuration override is use internal configuration use run-time parameters code You need to specify -Dtangosol.pof.enabled=true. see oracle doc In our implementation we use following arfuments -Dtangosol.coherence.cacheconfig=$COHERENCE_HOME/local-config.xml -Dtangosol.pof.enabled=true -Dtangosol.pof.config=$COHERENCE_HOME/pof-config.xml
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26865310
score: 1

http://stackoverflow.com/q/26980875
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: hadoop
accepted answer: http://stackoverflow.com/a/26981630
tagged with: apache-spark
answer count: 1
downvote count: 0
favorite count: 0
tagged with: bigdata
type: AnsweredQuestion
has body: I need some help about Spark+Java programming. This is my issue: I have a big file in hdfs, called A and an other big one called B. Basically, I need to iterate on the first one (A) and the second one (B) at the same moment. I mean something like that (This is pseudocode): a = read.A; //Read record from A b = read.B; // Read record from B while( a != EOF ) { if ( a &gt; b) { b= read.B; // Write Output in some way } else { a= read.A; //Write output in some way } } Is possibile to do something like that using Spark+Java ?
has answer: http://stackoverflow.com/a/26981630
has title: Spark: Read Iterate on 2 files

http://stackoverflow.com/comment/122023467
comment on: http://stackoverflow.com/a/57893103
type: Comment
score: 1
has text: Some further info on the command is available here: https://maven.apache.org/plugins/maven-idea-plugin/usage.html
type: AnswerComment

http://stackoverflow.com/comment/42376161
has text: Share some more code like what is getData();
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26913315
score: 0

http://stackoverflow.com/q/26965272
has answer: http://stackoverflow.com/a/26965352
upvote count: 3
answer count: 3
possible better answer: http://stackoverflow.com/a/26965341
has answer: http://stackoverflow.com/a/26965375
accepted answer: http://stackoverflow.com/a/26965375
has comment: http://stackoverflow.com/comment/42468079
tagged with: multithreading
has comment: http://stackoverflow.com/comment/42468140
type: AnsweredQuestion
score: 3
downvote count: 0
has answer: http://stackoverflow.com/a/26965341
tagged with: java
linked to: http://stackoverflow.com/q/5483047
has comment: http://stackoverflow.com/comment/42468086
has title: Why m2() runs first?
has body: Below is the code. The output is 1000, b=1000. I don't understand why m2() runs first every time. public class TT implements Runnable{ int b = 100; public synchronized void m1() throws Exception { b = 1000; Thread.sleep(100); System.out.println("b =" + b); } public synchronized void m2() throws Exception { Thread.sleep(2000); b = 2000; } public void run() { try { m1(); } catch(Exception e) { e.printStackTrace(); } } public static void main(String[] args) throws Exception { TT tt = new TT(); Thread t = new Thread(tt); t.start();// m1() starts tt.m2();// m2() starts System.out.println(tt.b); } }
type: Question
has comment: http://stackoverflow.com/comment/42468122
favorite count: 0

http://stackoverflow.com/comment/42444732
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26951643
has text: When you do it on quad paper, how do you know how far from the left margin to put your first asterisk?
type: Comment

http://stackoverflow.com/comment/42484636
comment on: http://stackoverflow.com/a/26974353
has text: aahh i could have thought of this... thank you for your explaination!
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/42243572
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26838194
has text: @PM2Ring No answer is satisfying in your suggested question because I need something(SOME_CLASS) which can persist any Hash object from hashlib.

http://stackoverflow.com/comment/42500969
has text: Thank you. Using an abstract base class for all test cases is the solution that I've been flirting with but I'm not very happy with it. For starters it's a decent amount of (albeit simple) refactoring for my several hundred existing test class files. It also seems silly that junit would design a solution that provides hookpoints at the suite level without providing a way for dependant test classes to trigger those hooks. If using a base class for the tests is the best answer, does that then imply that it's bad practice to do any meaningful (stateful) work at the suite level?
comment on: http://stackoverflow.com/a/26940034
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/a/46992617
score: 5
has body: I found the following answer from @jossef-harush and @matt-leidholm useful from another link in IntelliJ editor, click on the red keyword (Integer for example) and press ALT + ENTER (or click the light bulb icon) select Setup JDK from the intentions menu click on Configure In my case, the JDK path was incorrect (pointed on /opt/jdk1.7.0_51 instead of /opt/jdk1.7.0_65) click on the ... and browse to the right JDK path let's clear the cache
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26952078

http://stackoverflow.com/a/26858122
downvote count: 0
has body: There are an infinite number of strings that may generate a given UUID, so even if somebody guesses the string you used to create a given UUID, they may never be sure.
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/42277860
has comment: http://stackoverflow.com/comment/42278174
upvote count: 1
answers question: http://stackoverflow.com/q/26858090

http://stackoverflow.com/comment/42252194
comment on: http://stackoverflow.com/a/26844539
type: Comment
score: 1
has text: Yes =) , run as -> junit test
type: AnswerComment

http://stackoverflow.com/a/26898352
score: 1
answers question: http://stackoverflow.com/q/26896798
has body: Some recommendations: You don't need to (and should not) explicitly add a reference to jfxrt.jar to the classpath if you are using Java 8. Add full error handling to your application as documented in the JavaFX media javadoc. Your code has threading issues - you should interact with JavaFX controls on the JavaFX application thread, see Platform.runLater Use a JavaFX Application rather than a JFXPanel. If you use a JavaFX Application, you will already be on the JavaFX application thread, so a Platform.runLater call would not be necessary in that case. Ensure that you are using the Oracle Java 8 runtime and OpenJDK (check using java -version). Ensure that your system meets the minimum requirements for a certified configuration for JavaFX media playback. In particular: "You must install GLIB 2.28 in order to run JavaFX Media. You must install the following in order to support AAC audio, MP3 audio, H.264 video, and HTTP Live Streaming: libavcodec53 and libavformat53 on Ubuntu Linux 12.04 or equivalent." The exact cause of your issue is not possible to verify given the information you have provided, but hopefully the above recommendations will allow you to resolve your issue.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/42443452
comment on: http://stackoverflow.com/q/26951216
type: Comment
type: QuestionComment
has text: Works for me... what locale are you in? Perhaps it's expecting 5,5?
score: 3

http://stackoverflow.com/a/26983412
type: Answer
has body: So I finally solved it. The problem was in endianess all along. I couldn't see it because the values I was reading were Denormal numbers and my compiler treated them as zero's by default. So I switched byte orders back in Java to generate new binary file to use in C and it works fine.
answers question: http://stackoverflow.com/q/26976337
accepted answer of: http://stackoverflow.com/q/26976337
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/42358407
has text: Yes. To apply all the manipulations (set 1 and set 2), it takes almost 1 second for 1 record. I wish to reduce the time taken.
score: 0
comment on: http://stackoverflow.com/q/26903411
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42431062
type: QuestionComment
type: Comment
score: 0
has text: @Xline That would give the range 60-300
comment on: http://stackoverflow.com/q/26944033

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/26871081

http://stackoverflow.com/comment/42342184
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26894085
has text: savingData is not an activity in the code that you posted. Since it is a class, using getSharedPreferences with the preference name and mode should work.
type: AnswerComment

http://stackoverflow.com/a/26919851
has comment: http://stackoverflow.com/comment/42392045
score: 0
has comment: http://stackoverflow.com/comment/42391918
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42391869
has comment: http://stackoverflow.com/comment/42391818
has body: Your if test cannot be correct. If any of your String(s) are null you would get a NullPointerException. I think you wanted if (userName == null || userName.isEmpty() || passString == null || passString.isEmpty() || !passString.equals(passStringConfirm)) { enterUsername.setText(""); enterPassword.setText(""); enterConfirmPassword.setText(""); } Then your UI code should check if those are empty before allowing the user to proceed. Finally, in the code above I believe you might use setBorder() to give those fields a red border. if (userName == null || userName.isEmpty() || passString == null || passString.isEmpty() || !passString.equals(passStringConfirm)) { Border redLine = BorderFactory.createLineBorder(Color.red); enterUsername.setText(""); enterPassword.setText(""); enterConfirmPassword.setText(""); enterUsername.setBorder(redLine); enterPassword.setBorder(redLine); enterConfirmPassword.setBorder(redLine); } Edit Based on the code you provided, but you need it in an else! if(userName == null || userName.isEmpty() || passString == null || passString.isEmpty() || !passString.equals(passStringConfirm)) { enterUsername.setText(""); enterPassword.setText(""); enterConfirmPassword.setText(""); Border redLine = BorderFactory.createLineBorder(Color.red); enterUsername.setBorder(redLine); enterPassword.setBorder(redLine); enterConfirmPassword.setBorder(redLine); repaint(); } else { // &lt;-- add this super.dispose(); int response = 0; String firstDesposit = JOptionPane.showInputDialog( "Welcome " + userName + ". Enter your initial deposit."); initialDeposit = Double.parseDouble(firstDesposit); if (response == JOptionPane.OK_OPTION) { new Menu(); } }
has comment: http://stackoverflow.com/comment/42391991
type: Answer
has comment: http://stackoverflow.com/comment/42391894
has comment: http://stackoverflow.com/comment/42388455
accepted answer of: http://stackoverflow.com/q/26919678
answers question: http://stackoverflow.com/q/26919678
has comment: http://stackoverflow.com/comment/42391961

http://stackoverflow.com/comment/42255880
has text: If foo takes in a List of base objects, why are you trying to treat it's the elements as Child? If you decide to pass it with `<? extends Base>` then you should only call methods which are in Base.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26846354
type: QuestionComment

http://stackoverflow.com/comment/42475337
score: 0
has text: First of all, thank you for the response Alex! In my jtree i have file names like: Name_someNumber_2014.txt, this method sort only file names with only letter or it will sort names with both number and letters in the name?
type: AnswerComment
comment on: http://stackoverflow.com/a/26968514
type: Comment

http://stackoverflow.com/comment/42255358
score: 0
type: Comment
has text: Using JavaEE, additional plug-in: runJettyRun using plain java project: no server, no maven; same issue with JUnit
type: QuestionComment
comment on: http://stackoverflow.com/q/26845411

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/26853891
tags question: http://stackoverflow.com/q/26912996
type: Tag

http://stackoverflow.com/comment/42385662
has text: @TylerSonger The exception must be posted ***in the question.*** you've been told that before.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26899049

http://stackoverflow.com/comment/42265910
has text: https://docs.oracle.com/javase/tutorial/jdbc/basics/prepared.html - this would be a good starting point.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26851649
score: 0

http://stackoverflow.com/comment/42410923
has text: I know it's not a singleton as is. I was wondering whether this was an appropriate situation in which to use the pattern. I'm convinced now that it isn't.
comment on: http://stackoverflow.com/a/26919999
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/44169715
score: 3
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26853851
upvote count: 3
has body: For those who want to pass in constructor arguments (which is not possible with the accepted answer and suppliers as mentioned here) - you can use the following (I do not know if there is a better solution but it at least fulfilled my needs): final List&lt;MyObject&gt; result = IntStream.range(0, n) .mapToObj(index -&gt; new MyObject(...)) .collect(Collectors.toList()); whereas you would replace n by the number of elements you want to fill the list with and MyObject and new MyObject(...) with your type and ctor-call respectively. This creates a stream of integers ranging from 0 to n (n exclusive), maps every "index" to any object returned by the lambda-expr. in mapToObj and finally converts the stream to a list which will contain n distinct instances of MyObject.
has comment: http://stackoverflow.com/comment/97640406

http://stackoverflow.com/comment/42417280
score: 1
comment on: http://stackoverflow.com/a/26936457
has text: @whiskeyspider, I almost didn't see that one.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42313449
has text: I'm actually basically finished the project, I just have this bug and then some GUI and finalizing stuff. If #2 works, I'll use that. Otherwise I'll redesign and attempt #1. The \n idea should work well, thanks!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26878180

http://stackoverflow.com/a/39964619
answers question: http://stackoverflow.com/q/26893692
has body: Using the documentation of Kodo with JDO: Kodo provides explicit APIs to lock objects and to retrieve their current lock level. The Kodo JDO KodoPersistenceManager exposes the following methods to lock objects explicitly You have the next methods of locking a object: public void lockPersistent (Object pc); public void lockPersistent (Object pc, int level, long timeout); public void lockPersistentAll (Object[] pcs); public void lockPersistentAll (Object[] pcs, int level, long timeout); public void lockPersistentAll (Collection pcs); public void lockPersistentAll (Collection pcs, int level, long timeout); And the next example: // retrieve the lock level of an object Stock stock = ...; int level = KodoJDOHelper.getLockLevel (stock); if (level == KodoJDOHelper.LOCK_WRITE) PersistenceManager pm = ...; pm.currentTransaction ().setOptimistic (true); pm.currentTransaction ().begin (); // override default of not locking during an opt trans to lock stock object KodoPersistenceManager kpm = KodoJDOHelper.cast (pm); kpm.lockPersistent (stock, KodoPersistenceManager.LOCK_WRITE, -1); stock.setPrice (market.calculatePrice (stock)); pm.currentTransaction ().commit ();
score: 0
type: Answer

http://stackoverflow.com/comment/42427426
type: AnswerComment
type: Comment
has text: @BenGorman It's OK to make this type of mistake when you are new. ; )
comment on: http://stackoverflow.com/a/26941855
score: 0

http://stackoverflow.com/a/26835032
has body: Use the Builder to set the icon and also double check the documentation. Required notification contents A Notification object must contain the following: - A small icon, set by setSmallIcon() - A title, set by setContentTitle() - Detail text, set by setContentText()
score: 0
answers question: http://stackoverflow.com/q/26834861
type: Answer
has comment: http://stackoverflow.com/comment/42247625

http://stackoverflow.com/q/26984168
has answer: http://stackoverflow.com/a/26984342
has title: (Java) Is it possible to generate 2 different graphics window? If so, how to do it with this code?
has body: The code below is programmed to produce a coloured image in a 200x200 display. However, I am wondering, lets say I want to generate another window but this window will be a 200x200 sketch which is mostly white but the colour boundaries of the original picture are in black, how do I achieve this? In short, the first window is coloured. The second window is a black and white sketch of the first window. Both windows are to appear next to each other. Do you know how to generate such results? If so, could you please help me? //Setting the size of the graphics window final int WINDOW_DIMENSION = 200; EasyGraphics generate = new EasyGraphics(WINDOW_DIMENSION,WINDOW_DIMENSION); //Constructing the arrays char[][] firstArray = new char[WINDOW_DIMENSION][WINDOW_DIMENSION]; char[] secondArray = scan.toCharArray(); //Using "for" loop to generate 2D array int line = WINDOW_DIMENSION; int column = -1; for (int i = 0; i &lt; WINDOW_DIMENSION*WINDOW_DIMENSION; i++) { column++; if (i%WINDOW_DIMENSION == 0) { line--; column = 0; } firstArray[column][line]=secondArray[i]; } //Plotting the colours for respective range of numbers for (int a = 0; a &lt; WINDOW_DIMENSION; a++) { for (int b = 0; b &lt; WINDOW_DIMENSION; b++) { if (firstArray[a][b]=='0' || firstArray[a][b]=='1' || firstArray[a][b]=='2' || firstArray[a][b]=='3') { generate.setColor(66,167,243); generate.plot(a,b); } else if (firstArray[a][b]=='4' || firstArray[a][b]=='5') { generate.setColor(0,255,77); generate.plot(a,b); } else if (firstArray[a][b]=='6' || firstArray[a][b]=='7') { generate.setColor(51,183,91); generate.plot(a,b); } else if (firstArray[a][b]=='8' || firstArray[a][b]=='9') { generate.setColor(102,51,0); generate.plot(a,b); } } } } Your help would be sincerely appreciated.
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26984632
downvote count: 1
tagged with: java
score: -1
type: Question
answer count: 2
upvote count: 0

http://stackoverflow.com/q/26886342
score: 0
tagged with: jnlp
tagged with: serial-port
answer count: 1
has body: I am developing a Web page using jsp and html where in I need to read/write from/to a Device connected on Client's System who are accessing the Webpage. The Device is a Serial Device which is connected as COM1(Eg) in Windows. I went through different options available. I found this which serves my purpose. I started learning JNLP for the same. I imported the project and made changes according to my needs. (This project is using jssc.jar). I generated the jar (jSSC-Terminal.jar) and signed with self-generated key. The GUI is being loaded properly but I am unable to access the Serial port on client's machine. Here is my jnlp file launch.jnlp <?xml version="1.0" encoding="UTF-8" standalone="no"?> jSSC-Terminal scream3r <homepage href="scream3r.org"/> jSSC-Terminal jSSC-Terminal <update check="background"/> <all-permissions/> <j2se version="1.5+"/> <jar href="jSSC-Terminal.jar" main="true"/> <jar href="jssc.jar" download="eager"/> Here is my html jSSC-Terminal I have placed all these files in Tomcat directory as below /Tomcat/webapps/abc/launch.jnlp /Tomcat/webapps/abc/jSSC-Terminal.jar /Tomcat/webapps/abc/index.html /Tomcat/webapps/abc/lib/jssc.jar I am unable to get the SerialPort List when run as jnlp. Kindly help me out with a fix if available. Or are there any alternate things available in JSP. Thanks and Regards. Edit : Finally found out thank you. I replaced my applet tag and included jnlp location as below :
has answer: http://stackoverflow.com/a/26896461
type: AnsweredQuestion
tagged with: jssc
tagged with: java
has title: Access COM Port on Client Side in Web Programming Java
type: Question
accepted answer: http://stackoverflow.com/a/26896461
tagged with: applet

http://stackoverflow.com/comment/42420514
type: AnswerComment
type: Comment
has text: Glad to have been a help :)
comment on: http://stackoverflow.com/a/26937663
score: 0

http://stackoverflow.com/comment/42241357
has text: If it is `end-1`, it should be `j<=end-1`. The point here is, the array.length will give you the length of the array and as the index starts from zero we usually do `array.length-1` which will give us the last index. So you are already doing that when you start the `QuickSort` recursively.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26838126
score: 1

http://stackoverflow.com/comment/42440133
comment on: http://stackoverflow.com/a/26949326
type: AnswerComment
score: 0
type: Comment
has text: `getByName` accepts IP addresses, not just host names.

jframe
tags question: http://stackoverflow.com/q/26897368
tags question: http://stackoverflow.com/q/26915568
tags question: http://stackoverflow.com/q/26877517
tag name: jframe
tags question: http://stackoverflow.com/q/26886708
tags question: http://stackoverflow.com/q/26850259
tags question: http://stackoverflow.com/q/26909176
tags question: http://stackoverflow.com/q/26957069
tags question: http://stackoverflow.com/q/26986219
tags question: http://stackoverflow.com/q/26956815
tags question: http://stackoverflow.com/q/26967230
tags question: http://stackoverflow.com/q/26840383
tags question: http://stackoverflow.com/q/26946267
tags question: http://stackoverflow.com/q/26882768
tags question: http://stackoverflow.com/q/26958119
tags question: http://stackoverflow.com/q/26844631
tags question: http://stackoverflow.com/q/26933411
tags question: http://stackoverflow.com/q/26937230
tags question: http://stackoverflow.com/q/26895455
tags question: http://stackoverflow.com/q/26902243
tags question: http://stackoverflow.com/q/26884369
tags question: http://stackoverflow.com/q/26959148
tags question: http://stackoverflow.com/q/26866463
tags question: http://stackoverflow.com/q/26987669
type: Tag
tags question: http://stackoverflow.com/q/26923062
tags question: http://stackoverflow.com/q/26842842

http://stackoverflow.com/q/26981140
score: 0
tagged with: tableview
answer count: 1
tagged with: tablecolumn
type: AnsweredQuestion
tagged with: sha256
accepted answer: http://stackoverflow.com/a/26982004
tagged with: javafx
has title: JavaFX table view don't display scrambled strings
type: Question
has body: My problem is that my JavaFX TableView cannot display my String that is crypted with SHA-256. It works with a normal string. Here my code for the my scramble method. private String scrambleName(String name, String surname) { MessageDigest messageDigest; String cryptedName; StringBuilder builder = new StringBuilder(); builder.append(name); builder.append(" "); builder.append(surname); String fullName = builder.toString(); try { messageDigest = MessageDigest.getInstance("SHA-256"); messageDigest.update(fullName.getBytes()); cryptedName = new String(messageDigest.digest()); return cryptedName; } catch (NoSuchAlgorithmException ex) { Logger.getLogger(Scrambler.class.getName()).log(Level.SEVERE, null, ex); } return null; } This method returns a string for my scrambled vote object. public class ScrambledVote { private int key; private String scrambledName; private int age; private String party; public ScrambledVote(int key, String scrambledName, int age, String party) { this.key = key; this.scrambledName = scrambledName; this.age = age; this.party = party; } //Getter Setter I load the data from a file. The command line output works fine. But the TableView throws an exception. Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: 0 at com.sun.javafx.font.directwrite.DWGlyphLayout.getIndices(DWGlyphLayout.java:198) at com.sun.javafx.font.directwrite.DWGlyphLayout.renderShape(DWGlyphLayout.java:401) at com.sun.javafx.font.directwrite.DWGlyphLayout.layout(DWGlyphLayout.java:154) at com.sun.javafx.text.PrismTextLayout.shape(PrismTextLayout.java:832) at com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1062) at com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:221) at com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:244) at com.sun.javafx.scene.control.skin.Utils.computeTextHeight(Utils.java:129) at com.sun.javafx.scene.control.skin.LabeledSkinBase.computePrefHeight(LabeledSkinBase.java:832)…
has answer: http://stackoverflow.com/a/26982004
tagged with: java

http://stackoverflow.com/comment/42351923
has text: Are the microseconds coming out 0-padded? `2014-11-10 04:05:06.15` vs. `2014-11-10 04:05:06.000015` makes a difference.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26899550

http://stackoverflow.com/comment/42256557
has text: For exporting to Excel, have a look at Apache POI.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26846765
score: 0

http://stackoverflow.com/a/26910282
has body: First of all, String does override hashCode and equals, so your code uses String's version of those methods (since you are adding Strings to your HashSet). Second of all, even if it didn't, in your example, "a" is interned, so both calls to s.add("a") are adding the exact same object, so even Object's default implementation of hashCode and equals would have given the same results.
has comment: http://stackoverflow.com/comment/42370802
has comment: http://stackoverflow.com/comment/42370666
has comment: http://stackoverflow.com/comment/42370762
answers question: http://stackoverflow.com/q/26910225
has comment: http://stackoverflow.com/comment/42370936
has comment: http://stackoverflow.com/comment/42370123
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42370168

http://stackoverflow.com/q/26989208
tagged with: pdf-generation
has comment: http://stackoverflow.com/comment/42511609
upvote count: 2
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/26989511
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/19635275
tagged with: pdfbox
has body: I am trying to generate tables using pdfbox library using below code. //Draw lines for (int i = 0; i &lt;= cols; i++) { contentStream.drawLine(nextx,y,nextx,y-tableHeight); nextx += colWidth; } //fill with data float textx = margin+cellMargin; float texty = y-15; for(int i = 0; i &lt; content.length; i++){ for(int j = 0 ; j &lt; content[i].length; j++){ String text = content[i][j]; contentStream.beginText(); contentStream.moveTextPositionByAmount(textx,texty); contentStream.drawString(text); contentStream.endText(); textx += colWidth; } texty-=rowHeight; textx = margin+cellMargin; } While doing so data in created cell doesn't get wrapped . I couldn't find a way to do so in pdfbox library. Please suggest solution.
score: 2
downvote count: 0
favorite count: 0
type: Question
has title: How to wrap text while generating tables in apache PDFbox

http://stackoverflow.com/q/26953578
answer count: 1
has comment: http://stackoverflow.com/comment/42447429
type: UnansweredQuestion
tagged with: audio
has comment: http://stackoverflow.com/comment/42447627
tagged with: java
has body: I have written a method in java to play a sound. It works fine on my ubuntu laptop but doesnt work on windows. There is no error but i think it might be bypassing the drain method on windows for some reason. public static void runOnce(final String location) { new Thread(new Runnable() { public void run() { try { File audioFile = new File(Game.gameFolder + "/sounds/" + location); final AudioInputStream audioStream = AudioSystem.getAudioInputStream(audioFile); AudioFormat format = audioStream.getFormat(); DataLine.Info info = new DataLine.Info(Clip.class, format); final Clip audioClip = (Clip) AudioSystem.getLine(info); audioClip.open(audioStream); audioClip.start(); audioClip.drain(); try { audioClip.close(); audioStream.close(); } catch (Exception e) { System.out.println("heyeyeyeyye"); } System.out.println("sound method ran"); } catch(Exception e) {} } }).start(); } thanks -Tyler EDIT: i remember actually it worked on windows before i used drain but after a certain amount of time it wouldnt load anymore so i switched to drain
has comment: http://stackoverflow.com/comment/42447411
type: Question
has title: Sound loading working in ubuntu but not working in windows
has answer: http://stackoverflow.com/a/26953669
has comment: http://stackoverflow.com/comment/42447508
has comment: http://stackoverflow.com/comment/42447489
linked to: http://stackoverflow.com/q/18009542
tagged with: ubuntu
score: 0

http://stackoverflow.com/comment/42315920
type: QuestionComment
comment on: http://stackoverflow.com/q/26879442
has text: http://ideone.com/yVZP3Q
score: 0
type: Comment

http://stackoverflow.com/comment/42257787
comment on: http://stackoverflow.com/q/26847488
score: 0
type: QuestionComment
type: Comment
has text: You do NOT need all those JPanels. Bad design right off the bat.

http://stackoverflow.com/q/26986864
tagged with: java
tagged with: dom
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/42624951
has comment: http://stackoverflow.com/comment/42511831
has body: I have written down a DOM parser in java which reads tags and attributes from 1 xml file, makes some changes to them, and finally writes them down to a new xml file. The problem lies with the readability. In the original xml file, for every tag, each attribute is on a separate line making the xml quite readable and easier to manually make changes. On the other hand, the new xml file that is being filled by my DOM parser has all the attributes of a tag on the same line making the xml very difficult to manually comprehend and make changes to due to the abundance of both tags and their attributes. I was thinking if there is a way to put every attribute of a tag on a separate line through DOM? Or do I have to use some other parser which provides this capability? Current xml file - &lt;tag id="1" name="a" age="3" /&gt; And, I want my xml to look like - &lt;tag id="1" name="a" age="3" /&gt;
has title: Is there a way to put each attribute of an xml tag on new line using DOM parser?
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/a/26839708
type: Answer
has body: I just got this working...I took the pom.xml(one copied locally from the network at location user/rajesh/.m2/repository/....) from the local repository and changed the name to pom.xml to some folder and run the mvn versions:display-plugin-updates and that worked for me.I could see all the version updates. Rajesh
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26837850

http://stackoverflow.com/q/26941635
tagged with: gridworld
type: Question
tagged with: for-loop
tagged with: algorithm
score: 0
has body: I am having trouble with my conway's game of life program(If you are not familiar with it here is a link that explains it and towards the top are the rules. http://en.wikipedia.org/wiki/Conway's_Game_of_Life). I am using gridworld and when I run the code it produces the grid and changes its state. It all looks as if it were working properly. However the cells that are supposed to die/come alive do not. Instead a seemingly random assortment of cells change their state. I cannot figure out the problem. I have checked to make sure the right number of neighbors is found, the if statements are working properly, and if I am comparing the correct things. All of these seem to work, yet I see an unexpected result. Please help me fix this. Thanks in advance. PS. Please Ignore the commented out code. They are tests/failed attempts to make it work. Here is my code: import info.gridworld.actor.Actor; import info.gridworld.actor.ActorWorld; import info.gridworld.actor.Rock; import info.gridworld.grid.Grid; import info.gridworld.grid.BoundedGrid; import info.gridworld.grid.Location; import java.util.ArrayList; /** * Game of Life starter code. Demonstrates how to create and populate the game using the GridWorld framework. * Also demonstrates how to provide accessor methods to make the class testable by unit tests. * * @author @ * @version 14 Nov 2014 */ public class GameOfLife { // the world comprised of the grid that displays the graphics for the game private static ActorWorld world; // the game board will have 10 rows and 10 columns private final int ROWS = 10; private final int COLS = 10; // constants for the location of the three cells initially alive private final int X1 = 0, Y1 = 0; private final int X2 = 0, Y2 = 4; private final int X3 = 0, Y3 = 5; private final int X4 = 0, Y4 = 9; private final int X5 = 1, Y5 = 0; private final int X6 = 1, Y6 = 5; private final int X7 = 1, Y7 = 9; private final int X8 = 2, Y8 = 0; private final int X9 = 2, Y9 = 9; private final int X10 = 4,…
answer count: 1
has title: conways game of life not working properly
tagged with: conways-game-of-life
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26942058
tagged with: java

http://stackoverflow.com/a/26923440
has comment: http://stackoverflow.com/comment/42396061
has comment: http://stackoverflow.com/comment/42395395
score: 0
answers question: http://stackoverflow.com/q/26922960
type: Answer
has body: You could use the source address of the packet. If you are receiving the datagrams with a DatagramChannel, receive returns the source address. If you are using a DatagramSocket you can get the address of a packet by calling getSocketAddress after you receive it. This still isn't completely secure since someone could spoof someone else's address if they know it, although it has 0 overhead.

http://stackoverflow.com/q/26852939
has answer: http://stackoverflow.com/a/26853061
tagged with: sorting
has answer: http://stackoverflow.com/a/26853053
has answer: http://stackoverflow.com/a/30345600
has comment: http://stackoverflow.com/comment/42268437
score: 0
answer count: 3
has body: Right, so I have a 2 part sorting algorithm. It's all based on an array of 14 random integers. For example: int[] a = {9,2,4,8,9,4,3,2,8,1,2,7,2,5}; Now, the first thing I'm trying to figure out how to do is to count how many a certain number exists in the original array. So, we know that 1 exists once, and 2 exists four times in the original array. But as easy as it is to visually see this, what if we don't have access to the original array. So I need to craft a method that will count how many of each number 1-9 exists and put this in a new array called count. So that index 0 in count would represent the integer 1 and would have a value of 1. Index 1 will represent the integer 2 and have a value of 4. And so on and so forth. Here is what I've got so far but I'm stuck. Sorting is pretty challenging for me. public static void main(String[] args) { // int[] countFinal = {1,4,1,2,1,0,1,2,2}; // The number of times a number 1-9 appears in a[]. // int[] sortedFinal = {1,2,2,2,2,3,4,4,5,7,8,8,9,9}; // What we need as a final product. int[] a = {9,2,4,8,9,4,3,2,8,1,2,7,2,5}; //int[] count = {}; int[] sorted = {}; countHowMany(a, 1); countHowMany(a, 2); countHowMany(a, 3); countHowMany(a, 4); countHowMany(a, 5); countHowMany(a, 6); countHowMany(a, 7); countHowMany(a, 8); countHowMany(a, 9); } public static int countHowMany(int[] array, int value) { // Gathering a count for how many times a number 1-9 exists and adding it to count[]; int howManyCount = 0; for (int i = 0; i &lt; array.length; i++) { if (array[i] == value) { howManyCount++; } } System.out.println(howManyCount); count = new int[9]; count[howManyCount]; System.out.println(Arrays.toString(count); // Testing the input return howManyCount; } It appears to count the number of times an item in the array exists properly. Now I just gotta figure out how I can add that value into a new array count[] and do it for each countHowMany(). This is the part I'm stuck on. Once I have figured out count[] I can use it to create s…
linked to: http://stackoverflow.com/q/8098601
has comment: http://stackoverflow.com/comment/42268797
type: UnansweredQuestion
tagged with: java
type: Question
has title: Creating a custom sort for an array of integers?
tagged with: algorithm
tagged with: arrays

http://stackoverflow.com/q/26861883
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26955898
answer count: 1
accepted answer: http://stackoverflow.com/a/26955898
has body: Migrating from Jackson 1.8.6 to 2.4.2, org.codehaus.jackson.map.ObjectMapper has changed to com.fasterxml.jackson.databind.ObjectMapper, and the following method is undefined for the new implementation: defaultPrettyPrintingWriter(), is there a replacement? Thanks
tagged with: jackson
score: 0
tagged with: undefined
type: Question
has title: Jackson fasterxml ObjectMapper defaultPrettyPrintingWriter() method undefined replacement required
type: AnsweredQuestion

http://stackoverflow.com/q/26960290
tagged with: java
has answer: http://stackoverflow.com/a/26960505
tagged with: dom
has answer: http://stackoverflow.com/a/27151294
type: Question
has title: XML into data structure in java using sax, stax or DOM
has comment: http://stackoverflow.com/comment/42844010
score: 4
upvote count: 4
answer count: 2
tagged with: xml-parsing
has body: So I've been working on this project of mine for the past two weeks and I've not made any headway with this. My issue isn't with parsing the XML file to begin with, but rather what to do with it afterwards. So I've made programs with SAX, StAX and DOM parsers in which I take a very large XML file and then print out the elements and their values in order. However, the XML I'm dealing with is large so using DOM is inefficient of course. Another problem I have however is that the xml file has 40,000 entries of information and its structure is complicated. This is a little excerpt of it: <metabolite> 3.5 <creation_date>2005-11-16 08:48:42 -0700</creation_date> <update_date>2013-02-08 17:07:44 -0700</update_date> HMDB00002 <secondary_accessions> </secondary_accessions> 1,3-Diaminopropane 1,3-Diaminopropane is a stable, flammable and highly hydroscopic fluid. It is a polyamine that is normally quite toxic if swallowed, inhaled or absorbed through the skin. It is a catabolic byproduct of spermidine. It is also a precursor in the enzymatic synthesis of beta-alanine. 1, 3-Diaminopropane is involved in the arginine/proline metabolic pathways and the beta-alanine metabolic pathway. 1,3-Diamino-N-propane 1,3-Propanediamine 1,3-Propylenediamine 1,3-Trimethylenediamine 3-Aminopropylamine a,w-Propanediamine Propane-1,3-diamine Trimethylenediamine <chemical_formula>C3H10N2</chemical_formula> So this one of 40 entries, and it contains many more elements etc in it. What I need to be able to do with my program is allow the user to select what information he wants from the 40,000 entry, and then return the information in the form of an excel sheet. So if I only wanted say the version number and name for all 40,000 entries, it'll return just those values into excel. Currently I've made a program that loops through using StAX and returns all the elements and values through print onto console. How would I go about creating a data structure, such as a tree or something, that would then all…
downvote count: 0
favorite count: 0
tagged with: stax
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/42238832
has text: When you say "they both produce the same result", did you use `Collections.sort()`? Please show us your test code.
score: 1
comment on: http://stackoverflow.com/q/26836428
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42571938
has text: Do you get this exception in an IDE or in Maven?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26833880
score: 0

ieee-754
tags question: http://stackoverflow.com/q/26846402
type: Tag
tag name: ieee-754

http://stackoverflow.com/q/26875429
has title: How to create BufferedImage for 32 bits per sample, 3 samples image data
has comment: http://stackoverflow.com/comment/42332701
tagged with: bufferedimage
has answer: http://stackoverflow.com/a/26889653
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: rgb
tagged with: image
type: Question
answer count: 1
tagged with: 32-bit
has body: I am trying to create a BufferedImage from some image data which is a byte array. The image is RGB format with 3 samples per pixel - R, G, and B and 32 bits per sample (for each sample, not all 3 samples). Now I want to create a BufferedImage from this byte array. This is what I have done: ColorModel cm = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_sRGB), new int[] {32, 32, 32}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_INT); Object tempArray = ArrayUtils.toNBits(bitsPerSample, pixels, samplesPerPixel*imageWidth, endian == IOUtils.BIG_ENDIAN); WritableRaster raster = cm.createCompatibleWritableRaster(imageWidth, imageHeight); raster.setDataElements(0, 0, imageWidth, imageHeight, tempArray); BufferedImage bi = new BufferedImage(cm, raster, false, null); The above code works with 24 bits per sample RGB image but not 32 bits per sample. The generated image is garbage which is shown on the right of the image. It is supposed to be like the left side of the image. Note: the only image reader on my machine which can read this image is ImageMagick. All the others show similar results as the garbage one to the right of the following image. The ArrayUtils.toNBits() just translates the byte array to int array with correct endianess. I'm sure this one is correct as I have cross checked with other methods to generate the same int array. I guess the problem might arise from the fact I am using all the 32 bits int to represent the color which would contain negative values. Looks like I need long data type, but there is no DataBuffer type for long. Instances of ComponentColorModel created with transfer types DataBuffer.TYPE_BYTE, DataBuffer.TYPE_USHORT, and DataBuffer.TYPE_INT have pixel sample values which are treated as unsigned integral values. The above quote is from Java document for ComponentColorModel. This means the 32 bit sample does get treated as unsigned integer value. Then the problem could be somewhere else. Has any body met similar problem a…
downvote count: 0
accepted answer: http://stackoverflow.com/a/26889653
favorite count: 0
has comment: http://stackoverflow.com/comment/42309028
has comment: http://stackoverflow.com/comment/42331095
has comment: http://stackoverflow.com/comment/42310852
upvote count: 3

http://stackoverflow.com/a/50160231
downvote count: 0
has comment: http://stackoverflow.com/comment/91304719
answers question: http://stackoverflow.com/q/26833517
has body: Answers above didn't help. Works fine after adding &lt;android.support.v7.widget.CardView ... xmlns:app="http://schemas.android.com/apk/res-auto" app:cardBackgroundColor="@android:color/transparent"&gt; Can't explain.
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/42280676
type: Comment
type: AnswerComment
has text: Non capturing group is used for grouping certain characters but not capturing it hence it is not available for back reference later.
comment on: http://stackoverflow.com/a/26859854
score: 0

http://stackoverflow.com/comment/122008633
comment on: http://stackoverflow.com/a/53583725
has text: All the dynamodb-local docker image does is run the same jar (https://hub.docker.com/layers/amazon/dynamodb-local/1.16.0/images/sha256-0c8f11e69ccf895c7ec97a7c9991d4654971f0e5e3ae42292de1c514f3e03cfa?context=explore). Docker isn't always the only or best approach. More like just the lowest common denominator.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/comment/42462958
type: QuestionComment
comment on: http://stackoverflow.com/q/26962388
has text: @tom I would to make calendar in IDE just for something i am working on .
score: 0
type: Comment

http://stackoverflow.com/comment/42401313
has text: If then I use this method in another calss by calling it. Then result is equal to null. Why is this? Why will it not stay as either Y or N.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26927495

http://stackoverflow.com/comment/42358753
has text: Use [regular expression](http://www.regular-expressions.info/)!
comment on: http://stackoverflow.com/q/26903655
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/26979182
has comment: http://stackoverflow.com/comment/42493033
has answer: http://stackoverflow.com/a/26980058
accepted answer: http://stackoverflow.com/a/26980058
type: Question
has comment: http://stackoverflow.com/comment/42494100
has title: Object is not an 'instanceof' it's own class
has comment: http://stackoverflow.com/comment/42492985
upvote count: 2
has comment: http://stackoverflow.com/comment/42493903
answer count: 1
favorite count: 0
tagged with: instanceof
tagged with: classloader
has comment: http://stackoverflow.com/comment/42492794
tagged with: spring
has comment: http://stackoverflow.com/comment/42493940
has body: I'm trying to hunt down some issues with spring not expending a factoryBean. I've plugged into a debugger and proven that the failure is in this line of AbstraceBeanFactory: if(!(beanInstance instanceof FactoryBean) || BeanFactoryUtils.isFactoryDereference(name)) { return beanInstance; } specifically the "beanInstance instanceof FactoryBean" part is returning false when it should be true, resulting in my returning a factorybean back rather then the bean that the factory is suppose to construct. My debugger clearly tells me that the the beanInstance is a org.springframework.beans.factory.config.PropertiesFactoryBean. When I tell eclipse to expand the class of bean I see it clearly implements FactoryBean For further testing I went to expressions. Supposedly the expression: beanInstance instanceof org.springframework.beans.factory.config.PropertiesFactoryBean returns false. However beanInstance.getClass() returns (org.springframework.beans.factory.config.PropertiesFactoryBean) (id=112) It seems my VM is very confused about this class. I'm trying to figure out what would cause this confusion, and how I can fix it? The most likely case seems to be confusion across multiple class loaders, but I haven't found any obvious examples. There should only be one implementation of PropertiesFactoryBean in my classpath. What would cause instanceof to fail in this manner? How can I hunt down my root cause? Incidentally, this is ultimately a tomcat instance I'm debugging, if it's relevant. Also, beanInstance is an instanceof Object, so intanceof does work properly sometimes. ps. I had to type this by hand rather then copy/paste. Please assume any obvious naming mistakes are typos on my part. edit: fixed the paren typo mentioned in comments. I figured I would do that. This code comes from Spring unmodified by me, so it's safe to assume the code itself is well written and functional, even if I did make a typo
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/47995883
has text: I'm having the same problem. The question has been wrote in the mailing list? In case can you please add a link here?
type: Comment
comment on: http://stackoverflow.com/a/26860807
score: 0
type: AnswerComment

http://stackoverflow.com/a/26974149
score: 1
answers question: http://stackoverflow.com/q/26973389
has body: Your code should find all TestNG test classes that are on the classpath (of whatever you are running). If the dependency TestNG classes are on the classpath, it will find them. However, if your dependency is a production library JAR that you fetched from Maven Central, etc, the chances are that the JAR won't include the library's unit tests. It is not normal practice to distribute unit tests in a production JAR. And it is not normal practice to run dependent unit tests ... if you are not building the dependents yourself. I'm not aware of any Maven plugin that can obtain JARs for dependent unit tests ... and I suspect that it is not technically possible. Your best bet would be to download the dependent source code by hand, build it, and then manually add the dependents unit tests classes (or JARs) to the classpath of whatever application it is that is doing the searching.
accepted answer of: http://stackoverflow.com/q/26973389
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42483983
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42484262

http://stackoverflow.com/comment/42419213
comment on: http://stackoverflow.com/q/26936988
score: 0
type: Comment
has text: @Eran thanks but that was not the issue, it's a mistake in the post
type: QuestionComment

http://stackoverflow.com/q/26966124
has answer: http://stackoverflow.com/a/26966175
score: 0
accepted answer: http://stackoverflow.com/a/26966175
answer count: 2
has body: I have table named 'Allocated_Stock', this table is as follows: Create Table Allocated_Stock (Store_Id string not null,Item_Id string not null, Vehicle_Id string not null, AllocatedDate date not null,Item_Qty decimal not null, PRIMARY KEY (Store_Id, Item_Id), FOREIGN KEY (Store_Id) REFERENCES Store (Store_Id), FOREIGN KEY (Item_Id) REFERENCES Item (Item_Id), FOREIGN KEY (Vehicle_Id) REFERENCES Vehicle (Vehicle_Id)); And when I update I use String where = "Store_Id='ST001' And Item_Id = 'IM001' And Vehicle_Id = 'V0001' And AllocatedDate = '2014-08-08'"; ContentValues newValues = new ContentValues(); newValues.put(Store_Id, "S001"); newValues.put(Item_Id, "I001"); newValues.put(Vehicle_Id, "V001"); newValues.put(AllocatedDate, "2014-08-08"); newValues.put(Item_Qty, 550); DBSchema.obj.updateRecord(newValues, TableName, where) the following is a different class private DatabaseHelper myDBHelper; //which extends SqlLiteHelper private SQLiteDatabase db; myDBHelper = new DatabaseHelper(context); db = myDBHelper.getWritableDatabase(); public boolean updateRecord(ContentValues Content, String TableName,String Where ) { // Insert it into the database. try { return db.update(TableName, Content, Where, null) != 0; } catch(Exception e){ System.out.println("GET SAMPLE VALUE"+e); return false; } } Whenever I try to update, I get an error, but firstly I couldn't catch the error. Second of all why is this happening?
tagged with: android-sqlite
tagged with: java
has title: Why my SQLLiteDatabase is not executing Update?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26966183
has answer: http://stackoverflow.com/a/26966183
type: Question
tagged with: sql-update
tagged with: android
tagged with: sqlite

http://stackoverflow.com/comment/42492031
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26978761
has text: I have actually never worked with breakpoints/logs. I will try to add some logs, and have it sorted out.

gwt
tags question: http://stackoverflow.com/q/26909464
tags question: http://stackoverflow.com/q/26928554
tag name: gwt
type: Tag
tags question: http://stackoverflow.com/q/26951401
tags question: http://stackoverflow.com/q/26874716
tags question: http://stackoverflow.com/q/26842081
tags question: http://stackoverflow.com/q/26970760
tags question: http://stackoverflow.com/q/26950197
tags question: http://stackoverflow.com/q/26851944
tags question: http://stackoverflow.com/q/26872550
tags question: http://stackoverflow.com/q/26929697
tags question: http://stackoverflow.com/q/26991163
tags question: http://stackoverflow.com/q/26895766
tags question: http://stackoverflow.com/q/26970041
tags question: http://stackoverflow.com/q/26864944
tags question: http://stackoverflow.com/q/26949239
tags question: http://stackoverflow.com/q/26899528
tags question: http://stackoverflow.com/q/26970016
tags question: http://stackoverflow.com/q/26985469
tags question: http://stackoverflow.com/q/26892558
tags question: http://stackoverflow.com/q/26865902
tags question: http://stackoverflow.com/q/26988727
tags question: http://stackoverflow.com/q/26881241
tags question: http://stackoverflow.com/q/26869742
tags question: http://stackoverflow.com/q/26954937
tags question: http://stackoverflow.com/q/26982531
tags question: http://stackoverflow.com/q/26866586

annotations
tags question: http://stackoverflow.com/q/26915636
tags question: http://stackoverflow.com/q/26977278
type: Tag
tags question: http://stackoverflow.com/q/26889970
tags question: http://stackoverflow.com/q/26957686
tags question: http://stackoverflow.com/q/26909157
tags question: http://stackoverflow.com/q/26865853
tags question: http://stackoverflow.com/q/26882965
tags question: http://stackoverflow.com/q/26945728
tags question: http://stackoverflow.com/q/26851469
tags question: http://stackoverflow.com/q/26841704
tags question: http://stackoverflow.com/q/26916598
tags question: http://stackoverflow.com/q/26929048
tags question: http://stackoverflow.com/q/26853644
tags question: http://stackoverflow.com/q/26860855
tags question: http://stackoverflow.com/q/26979216
tags question: http://stackoverflow.com/q/26893285
tags question: http://stackoverflow.com/q/26910620
tags question: http://stackoverflow.com/q/26933627
tag name: annotations
tags question: http://stackoverflow.com/q/26912744
tags question: http://stackoverflow.com/q/26948261
tags question: http://stackoverflow.com/q/26910008
tags question: http://stackoverflow.com/q/26988203

http://stackoverflow.com/comment/42496540
comment on: http://stackoverflow.com/a/26967856
score: 0
type: AnswerComment
has text: @ChristianBongiorno Blaise Doughan may know better.
type: Comment

http://stackoverflow.com/comment/42260661
type: Comment
comment on: http://stackoverflow.com/a/26848765
has text: Thanks for a great answer!! Do you know any tutorials I could take a look at or what I should search for?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42234124
has text: Please work on your class naming, I got scared for a second.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26833868
score: 0

http://stackoverflow.com/comment/42323160
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26883241
has text: I have several classes; not only MInventory, MSalary or MOrder; So instantiate all those classes are difficult. Another hope is that, all those Classes are implemented an interface DocAction.class
type: Comment

http://stackoverflow.com/q/26878070
tagged with: email
tagged with: regex
type: Question
accepted answer: http://stackoverflow.com/a/26878084
type: AnsweredQuestion
tagged with: java
answer count: 1
has body: I'm trying to pull an email address out of a string. Here's my SSCCE: class SSCCE{ public static void main(String[] args) throws Exception{ Pattern toEmailPattern = Pattern.compile("To: (\\S+)\\s"); Matcher toMatcher = toEmailPattern.matcher("Date: Wed, 12 Nov 2014 01:01:44 +0000 (UTC)\n" + "From: TestProjectDoNotChange Do Not Reply &lt;Intds@blah.com&gt;\n" + "To: david1@david1.com\n" + "Message-ID: &lt;1531281253.11415754104803.JavaMail.dallend@P94461&gt;\n" + "Subject: Invitation to DataSite TestProjectDoNotChange "); System.out.println(toMatcher.matches()); //false } } For some reason the matcher doesn't find the email address. I'm particularly confused because I've tested my regex out <a href="http://ocpsoft.org/tutorials/regular-expressions/java-visual-regex-tester/#!;t=Date%3A%20Wed%2C%2012%20Nov%202014%2001%3A01%3A44%20%2B0000%20(UTC)%0AFrom%3A%20TestProjectDoNotChange%20Do%20Not%20Reply%20%3CIntds%40blah.com%3E%0ATo%3A%20david1%40david1.com%0AMessage-ID%3A%20%3C1531281253.11415754104803.JavaMail.dallend%40P94461%3E%0ASubject%3A%20Invitation%20to%20DataSite%20TestProjectDoNotChange%20&amp;r=To%3A%20(%5CS%2B)%5Cs&amp;x=" rel="nofollow">here and that site sayse that it works. Whats going wrong here?
has title: Why won't this regex match the to: email address
score: 0
has answer: http://stackoverflow.com/a/26878084

http://stackoverflow.com/q/26965224
answer count: 1
has comment: http://stackoverflow.com/comment/42468011
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42468505
has answer: http://stackoverflow.com/a/26965296
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42469487
type: Question
has title: sax parser is skips charcters after printable ascii characters using java program
has body: I have response xml in string format. I have a xmlstring like this Eg : L’équipe dirigeante accueille Dieter Zetsche à l’usine de Maubeuge. after parsing using sax parser I have only l . The parser is skips all the characters after ’ this charcters. Can any one help how to retrieve entire text after parsing
has comment: http://stackoverflow.com/comment/42468037

http://stackoverflow.com/q/26924747
has answer: http://stackoverflow.com/a/26924786
tagged with: multithreading
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26924776
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26924911
has body: I'm new to multiple-thread in java.I write some class to test functions of synchronized.I have some method using synchronized: public class ShareUtil { private static Queue&lt;Integer&gt; queue = new LinkedList&lt;Integer&gt;(); public static synchronized void do1(){ System.out.println("do1"); sleep(); } public static synchronized void do2(){ System.out.println("do2"); sleep(); } private static void sleep(){ try { Thread.sleep(1000*50000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } You can see there are two method using synchronized,and I run two thread to use these two methods respectively. class Run1 implements Runnable{ @Override public void run() { // TODO Auto-generated method stub ShareUtil.do1(); } } class Run2 implements Runnable{ @Override public void run() { // TODO Auto-generated method stub ShareUtil.do2(); } } public class DoMain { public static void main(String[] args) { ExecutorService pools = Executors.newCachedThreadPool(); for(int i=0;i&lt;10;i++){ pools.execute(new Run1()); pools.execute(new Run2()); } pools.shutdown(); } } But,it just print "do1" not print "do2".I want to know why?the key of "synchronized" using method to make the method only one thread use at the same time,but why lock the others method?
type: Question
has answer: http://stackoverflow.com/a/26964411
has title: Why does the synchronized lock another method?
accepted answer: http://stackoverflow.com/a/26924776
possible better answer: http://stackoverflow.com/a/26924786
linked to: http://stackoverflow.com/q/1036754

http://stackoverflow.com/a/29896997
type: Answer
answers question: http://stackoverflow.com/q/26907707
has body: I tried so many ways, but still didn't solved my issue. Finally I removed spaces and wildcard characters from my path(including folder names), then its allowed me to execute Test Runner.
score: 0

http://stackoverflow.com/comment/42268175
has text: have u initialized your array
comment on: http://stackoverflow.com/q/26852746
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/26930034
has body: I am still confused what is the exact difference between this three methods For example: Double d = 19.23456; System.out.println(d.toString()); System.out.println(Double.toString(d)); System.out.println(String.valueOf(d)); All the above methods print the value, but I would like to know more of a logical meaning and differences between these methods. Which method is suitable for which scenarios? I have gone through the below link where the accepted answer states toString(parameter) and valueOf(parameter) are the same. Then what about toString? May be I am missing a significant point or something. If so please turn my attention towards it. Integer.toString(int i) vs String.valueOf(int i) I have read the documentation but I couldn't make out the differences after reading it. According to the official docs: toString Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression: getClass().getName() + '@' + Integer.toHexString(hashCode()) toString(parameter) Returns a string containing a concise, human-readable description of the specified double value valueOf(parameter) Converts the specified object to its string representation. If the object is null return the string "null", otherwise use toString() to get the string representation. Thank you in advance EDIT: Well I am satisfied by both the answers provided by Eran and zapl. Each of the answers clears the concepts of this method within a specific perspective. For the sake of accepting an answer I would be accepting one. Thank You for clearing my doubt.
has title: toString vs toString(parameter) vs valueOf(parameter) in java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/26930265
tagged with: tostring
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/26930253
tagged with: casting
has answer: http://stackoverflow.com/a/26930253
has answer: http://stackoverflow.com/a/26930265
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: string
linked to: http://stackoverflow.com/q/3335737
favorite count: 0

http://stackoverflow.com/comment/42379142
type: QuestionComment
comment on: http://stackoverflow.com/q/26914833
type: Comment
has text: @user1021323 yes. But in the servlet you can check the URL against a regex and delegate it to the correct servlet.
score: 0

http://stackoverflow.com/a/26869718
accepted answer of: http://stackoverflow.com/q/26869577
upvote count: 1
has comment: http://stackoverflow.com/comment/42298287
has comment: http://stackoverflow.com/comment/42298432
score: 1
answers question: http://stackoverflow.com/q/26869577
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42299075
has body: What about the next: public Map&lt;String, Object&gt; getEmpManagerDetails(int empId) { ... }
type: Answer
has comment: http://stackoverflow.com/comment/42299388

http://stackoverflow.com/comment/42379184
type: AnswerComment
comment on: http://stackoverflow.com/a/26895171
score: 0
type: Comment
has text: That makes sense and that was the direction I was going in as well. `application/blah+hal+json` didn't make sense to me. Also, yes in the API my entities have the possibility for HAL to be included.

http://stackoverflow.com/a/26949438
has comment: http://stackoverflow.com/comment/42453464
type: AcceptedAnswer
score: 0
type: Answer
has body: When you're reading in the file, the backslashes are being escaped with a preceding backslash. Getting around this is not as simple as it appears but is covered in this SO question: How to replace \\u by \u in Java String
answers question: http://stackoverflow.com/q/26948814
has comment: http://stackoverflow.com/comment/42442079
accepted answer of: http://stackoverflow.com/q/26948814

http://stackoverflow.com/comment/42423139
type: Comment
has text: BTW, to complete the Helper class I sketched, you would need to pass a `driver` to it, for instance when you initialize your test. I will add some code for it.
comment on: http://stackoverflow.com/a/26939108
type: AnswerComment
score: 0

http://stackoverflow.com/q/26978666
score: 0
answer count: 1
tagged with: email
tagged with: android
tagged with: php
tagged with: java
accepted answer: http://stackoverflow.com/a/27039715
type: Question
type: AnsweredQuestion
has body: I have a table in the server and I want to retrieve specific records based on email address sent from android java code. The email address is stored in global variable and I can get its value but I don't know how to send its value to the server and get the records. my code retrieves all the records from the table Please Help me to do it, I tried to do it for 3 days but with no solution this is my PHP code : &lt;?php $objConnect = mysql_connect("****","******","******"); $objDB = mysql_select_db("******"); $strSQL = "SELECT * FROM Appointment "; $objQuery = mysql_query($strSQL); $intNumField = mysql_num_fields($objQuery); $resultArray = array(); while($obResult = mysql_fetch_array($objQuery)) { $arrCol = array(); for($i=0;$i&lt;$intNumField;$i++) { $arrCol[mysql_field_name($objQuery,$i)] = $obResult[$i]; } array_push($resultArray,$arrCol); } mysql_close($objConnect); echo json_encode($resultArray); ?&gt; this is my java code : import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.StatusLine; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.os.Bundle; import android.os.StrictMode; import android.app.Activity; import android.app.AlertDialog; import android.content.ClipData; import android.content.ClipboardManager; import android.content.DialogInterface; import android.util.Log; import android.view.View; import android.view.Menu; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.Toast…
has answer: http://stackoverflow.com/a/27039715
has comment: http://stackoverflow.com/comment/42495066
has title: get list view with specific records from server based on email address sent from android

http://stackoverflow.com/comment/42381234
has text: the example shows how from a XSD schema. you can generate beans on the fly. Then you cab use some logic to set random values. Finally, you can output the results an XML.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26892149

http://stackoverflow.com/a/26903539
score: 4
type: Answer
accepted answer of: http://stackoverflow.com/q/26903492
has body: A servlet can work just fine. The benefit of using framework for web services is the same value as using a framework for websites. They do some of the mundane lifting. JAX-RS for example offers easier URL routing, and simple binding from/to XML/JSON and Java beans. You get that "for free", among other things. So, the frameworks simply can make development easier, but they're certainly not required.
upvote count: 4
answers question: http://stackoverflow.com/q/26903492
downvote count: 0
has comment: http://stackoverflow.com/comment/42360000
has comment: http://stackoverflow.com/comment/42358721
type: AcceptedAnswer

http://stackoverflow.com/a/26896461
answers question: http://stackoverflow.com/q/26886342
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42829846
has comment: http://stackoverflow.com/comment/42358604
type: Answer
has body: Your &lt;applet&gt; tag doesn't refer to the .jnlp file. You give access to COM ports in the jnlp file but it's not being used. You have to either use the jnlp file or set permissions in the &lt;applet&gt; tag. Your link to the jssc example is a page that shows how to use the jnlp file from the &lt;applet&gt; tag. I've done what you are trying to do with a Java Webstart app and the PureJavaComm library. I bet what you are doing will work once you get the permissions right, though. But if you want to have a look at how I set this up the jnlp file is here: https://bitminter.com/client/bitminter.jnlp (live app)
has comment: http://stackoverflow.com/comment/62596812
accepted answer of: http://stackoverflow.com/q/26886342

http://stackoverflow.com/comment/42307718
type: Comment
has text: @Saboteur Are you sure you're adding to the sum and not just setting sum equal to the value?
comment on: http://stackoverflow.com/a/26874805
score: 0
type: AnswerComment

http://stackoverflow.com/comment/62731443
type: Comment
score: 0
type: AnswerComment
has text: My ResteasyServletInitializer isn't doing anything either... I'm unclear what exactly you were missing in the question that made it work? Just the web.xml entries?
comment on: http://stackoverflow.com/a/26908046

http://stackoverflow.com/q/26911928
possible better answer: http://stackoverflow.com/a/26912874
has body: I have a string with following content: #parse ("module/asd") I need to replace the content between ... to with another string. The resut shoud be something like: ... Max Musterman ... I need help please
has answer: http://stackoverflow.com/a/26912874
has comment: http://stackoverflow.com/comment/42373559
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26912116
type: Question
answer count: 2
has title: Replace string from certain char to certain char
tagged with: replace
score: 0
accepted answer: http://stackoverflow.com/a/26912116
tagged with: string
has comment: http://stackoverflow.com/comment/42373332

http://stackoverflow.com/q/26971751
has answer: http://stackoverflow.com/a/26971854
type: Question
has answer: http://stackoverflow.com/a/26972286
linked to: http://stackoverflow.com/q/5819238
linked to: http://stackoverflow.com/q/24304225
has comment: http://stackoverflow.com/comment/42479398
has answer: http://stackoverflow.com/a/26972002
has body: I must pass an ArrayList from one Activity A to another Activity B. I did it using getSerializableExtra and putExtra methods. I already know the meaning of these methods, but I don't know if stuff that I passed using them is stored permanently in the new activity or if it is necessary to reload activity A in order to retrieve my data in B. So the question is: how can I load my data in a initial splash screen and then use it in all my others activity without reloading the splash screen?
accepted answer: http://stackoverflow.com/a/26972065
score: 0
has comment: http://stackoverflow.com/comment/42479168
has answer: http://stackoverflow.com/a/26972337
has comment: http://stackoverflow.com/comment/42479710
has title: Permanent Objects passed from one Activity to another
answer count: 5
tagged with: android
has answer: http://stackoverflow.com/a/26972065
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42479434
possible better answer: http://stackoverflow.com/a/26971854

http://stackoverflow.com/q/26910094
downvote count: 0
type: Question
has comment: http://stackoverflow.com/comment/42371296
tagged with: uniqueidentifier
tagged with: session
tagged with: java
has title: Is using System.identityHashCode(Obj) reliable to return unique Id
score: 4
has comment: http://stackoverflow.com/comment/42370701
accepted answer: http://stackoverflow.com/a/26910329
answer count: 2
has answer: http://stackoverflow.com/a/26911282
has comment: http://stackoverflow.com/comment/42370776
tagged with: websocket
favorite count: 0
has answer: http://stackoverflow.com/a/26910329
possible better answer: http://stackoverflow.com/a/26911282
has body: I have a implementation of websocket in dropwizard service and theirs a need to implement session management on server side. On connection we get session object which is the communication link between client and server. But their is not way to get Unique id for session like session.getId() and i need id for session management. So i have been thinking of using System.identityHashCode(Session) to get unique id and handle sessions using this ID. just for reference the websocket onConnect structure is @OnWebSocketConnect public void onOpen(Session session) throws IOException { // code to add the session in session management using unique id } So using System.identityHashCode(Session) will be good?
upvote count: 4
type: AnsweredQuestion

algorithm
tags question: http://stackoverflow.com/q/26986162
tags question: http://stackoverflow.com/q/26898148
tags question: http://stackoverflow.com/q/26920650
tags question: http://stackoverflow.com/q/26980486
tags question: http://stackoverflow.com/q/26980932
tag name: algorithm
tags question: http://stackoverflow.com/q/26991485
tags question: http://stackoverflow.com/q/26838245
tags question: http://stackoverflow.com/q/26939499
tags question: http://stackoverflow.com/q/26940469
tags question: http://stackoverflow.com/q/26932605
tags question: http://stackoverflow.com/q/26891113
tags question: http://stackoverflow.com/q/26958118
tags question: http://stackoverflow.com/q/26908588
tags question: http://stackoverflow.com/q/26876634
tags question: http://stackoverflow.com/q/26891747
tags question: http://stackoverflow.com/q/26896880
tags question: http://stackoverflow.com/q/26914796
tags question: http://stackoverflow.com/q/26876744
tags question: http://stackoverflow.com/q/26938198
tags question: http://stackoverflow.com/q/26899485
tags question: http://stackoverflow.com/q/26929861
tags question: http://stackoverflow.com/q/26896742
tags question: http://stackoverflow.com/q/26967465
tags question: http://stackoverflow.com/q/26970996
tags question: http://stackoverflow.com/q/26961387
tags question: http://stackoverflow.com/q/26870809
tags question: http://stackoverflow.com/q/26939820
type: Tag
tags question: http://stackoverflow.com/q/26975233
tags question: http://stackoverflow.com/q/26984433
tags question: http://stackoverflow.com/q/26959765
tags question: http://stackoverflow.com/q/26893748
tags question: http://stackoverflow.com/q/26872008
tags question: http://stackoverflow.com/q/26950004
tags question: http://stackoverflow.com/q/26945143
tags question: http://stackoverflow.com/q/26852939
tags question: http://stackoverflow.com/q/26838341
tags question: http://stackoverflow.com/q/26833662
tags question: http://stackoverflow.com/q/26884088
tags question: http://stackoverflow.com/q/26957113
tags question: http://stackoverflow.com/q/26943548
tags question: http://stackoverflow.com/q/26921737
tags question: http://stackoverflow.com/q/26979299
tags question: http://stackoverflow.com/q/26931552
tags question: http://stackoverflow.com/q/26987133
tags question: http://stackoverflow.com/q/26888335
tags question: http://stackoverflow.com/q/26915025
tags question: http://stackoverflow.com/q/26885198
tags question: http://stackoverflow.com/q/26941635
tags question: http://stackoverflow.com/q/26928529
tags question: http://stackoverflow.com/q/26892835

http://stackoverflow.com/q/26952301
type: UnansweredQuestion
tagged with: heritrix
score: 1
favorite count: 0
type: Question
has body: how to get more uri/sec per domain with Heritrix 3.2.0? i already set the parallels option to max number like maxToeThreads and it still stays on 5 active threads at a single domain crawl in general.
tagged with: spring
tagged with: java
upvote count: 1
has title: Heritrix: how to get more uri per sec on single domain?
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/42422217
type: Comment
score: 0
has text: See the two answers. Essentially, the while loop in your teacher results in the teacher only generating the values 3, 5, or 6. EDIT: I just saw your edit - in your example, the teacher generated the value 3. That should have been your giveaway that you created deadlock.
type: QuestionComment
comment on: http://stackoverflow.com/q/26938758

http://stackoverflow.com/comment/42471507
type: QuestionComment
has text: it throws exception on mentioned line of code
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26967189

http://stackoverflow.com/comment/42469161
type: Comment
comment on: http://stackoverflow.com/a/26893086
type: AnswerComment
score: 0
has text: At least, for the ConcurrentMap-based cache, you should get the result of the first execution (going by basic map rules, if there's a value for the supplied key, the previous value is returned) @UsamaTariq

http://stackoverflow.com/a/26835475
answers question: http://stackoverflow.com/q/26835454
type: Answer
has body: instead of replacing with c you can use c % 10
score: 0

http://stackoverflow.com/q/26948814
type: AnsweredQuestion
tagged with: java
has body: my problem is that if i use the String hardcode the answer is correct but if i use the inputed String not working . for example : String variable = " ﺳﻨﮓ ﺻﺒﻮر "; TextView show = (TextView) findViewById(R.id.preshow); show.settext(variable ); textview shows : صنگ صبور but: File filematn = new File(Environment.getExternalStorageDirectory()+File.separator+"SingingStudio/"+songname+"/"+songname+"file.txt"); //Read text from file StringBuilder text = new StringBuilder(); try { BufferedReader br = new BufferedReader(new FileReader(filematn)); String line; while ((line = br.readLine()) != null) { text.append(line); text.append(' '); } br.close(); } catch (IOException e) { //You'll need to add proper error handling here } String variable = text.toString(); TextView show = (TextView) findViewById(R.id.preshow); show.settext(variable ); textview shows : ﺳﻨﮓ ﺻﺒﻮر how can i fix it . thank you
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/10035891
has comment: http://stackoverflow.com/comment/42439299
upvote count: 0
accepted answer: http://stackoverflow.com/a/26949438
score: -1
answer count: 1
has title: java - String hard code working but inputted not working
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26949438

http://stackoverflow.com/comment/42335402
type: AnswerComment
score: 0
type: Comment
has text: I have edited my statement as below: {"statements": [ {"statement": "CREATE" (p:"POST" {"id":"532555943180263424","text":"mein text","subject":"mein subject","teaser":"mein teaser","lang":"de"})}]} but still the same result
comment on: http://stackoverflow.com/a/26875725

http://stackoverflow.com/comment/42327214
type: QuestionComment
score: 1
has text: Post your logcat errors.
comment on: http://stackoverflow.com/q/26886315
type: Comment

http://stackoverflow.com/q/26855216
tagged with: jaxb
has answer: http://stackoverflow.com/a/26859983
type: Question
has body: I am using JAXB Maven plugin in Intellij-IDEA (org.codehaus.mojo:jaxb2-maven-plugin:1.6) to generate a given xsd file to objects. The xsd is pretty large and contains many types, most of which are optional. Right now when I unmarshal an XML to objects, missing elements are represented as null objects. So for example, if I am trying to do rootObject.getAccount().getAccountName() but the Account element is missing altogether from the XML, I get a NullPointerException I would like to configure JAXB to unmarshal the full object tree to include those representing missing elements. Is this possible?
tagged with: intellij-idea
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/26859983
linked to: http://stackoverflow.com/q/10391406
favorite count: 0
has title: How to unmarshal missing elements into empty objects using JAXB
has comment: http://stackoverflow.com/comment/42307463
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42281225
upvote count: 3
tagged with: maven
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/comment/42435496
comment on: http://stackoverflow.com/a/26946210
has text: Thanks again for the answer. Just one more thing, and I will try to solve this in you way for n=3. 1.It will pass the if condition. 2.It calls itself with n - 1 (2) as an argument. This time it fails the condition and returns. n == 1 in our original method. printMany(1) is called.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42418102
type: AnswerComment
score: 5
type: Comment
has text: I think [`switchMap`](https://github.com/ReactiveX/RxJava/wiki/Transforming-Observables#switchmap) might be what you want.
comment on: http://stackoverflow.com/a/26936234

http://stackoverflow.com/q/26879520
has comment: http://stackoverflow.com/comment/42326392
has body: Is Spring 4.1.1 and google ehcache annotation 1.2.0 compatibile because I am getting following exception while deploying the war on Jboss: 2014-11-12 09:42:29,721 ERROR [org.springframework.web.context.ContextLoader] (ServerService Thread Pool -- 1071) Context initialization failed: java.lang.NoSuchMethodError: org.springframework.expression.spel.SpelParserConfiguration.(Lorg/springframework/expression/spel/SpelCompilerMode;Ljava/lang/ClassLoader;)V at org.springframework.context.expression.StandardBeanExpressionResolver.(StandardBeanExpressionResolver.java:98) [spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.prepareBeanFactory(AbstractApplicationContext.java:553) [spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:455) [spring-context-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) [spring-web-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) [spring-web-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) [spring-web-4.1.1.RELEASE.jar:4.1.1.RELEASE] at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3777) [jbossweb-7.2.0.Final-redhat-1.jar:7.2.0.Final-redhat-1] at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:156) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8] at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:60) [jboss-as-web-7.2.0.Final-redhat-8.jar:7.2.0.Final-redhat-8] at org.…
has comment: http://stackoverflow.com/comment/42322211
has comment: http://stackoverflow.com/comment/42321930
type: Question
score: 0
has title: Spring 4.1.1 and google ehcache annotation 1.2.0 compatibility
has comment: http://stackoverflow.com/comment/42318455
tagged with: ehcache
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: java

http://stackoverflow.com/comment/42294442
has text: @mstrap If you have the code, you can try to debug and find out what is happend.
score: 0
comment on: http://stackoverflow.com/q/26866759
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/79276098
comment on: http://stackoverflow.com/a/36919009
type: AnswerComment
type: Comment
score: 2
has text: This is not scalable solution and defeats purpose of recycler view

http://stackoverflow.com/comment/42461872
type: QuestionComment
has text: How can I set relation on both sides? When I checked item table and "board_id" column is always null.
comment on: http://stackoverflow.com/q/26876137
score: 0
type: Comment

http://stackoverflow.com/q/26856790
favorite count: 0
has answer: http://stackoverflow.com/a/26856850
answer count: 5
type: UnansweredQuestion
tagged with: io
score: 2
has title: How to reproduce error run out of disk?
upvote count: 2
tagged with: java
has body: I am reproducing some issues to test my code. It should tolerate some network issues like connection rest and IO issues like out of space. How can I reproduce the issue out of space? Update 1: I got the solution. I used a VirtualBox for this testing, just simply attach a small disk to vm, put some dummy data to eat up the space then test my code.
type: Question
tagged with: testing
has answer: http://stackoverflow.com/a/26856848
has answer: http://stackoverflow.com/a/26856807
downvote count: 0
has answer: http://stackoverflow.com/a/26856889
has answer: http://stackoverflow.com/a/26857002

http://stackoverflow.com/a/26967711
has body: Using only java.util.Date, you can use: Date oneYearBefore = new Date(currentDate.getTime() - (365L * 24L * 60L * 60L * 1000L)); But keep in mind, this doesn't account for potential leap years.
answers question: http://stackoverflow.com/q/26967476
score: 0
type: Answer

http://stackoverflow.com/comment/42243192
type: Comment
type: QuestionComment
has text: When `public static void main(String[])` is called, `String` (argument type) is already loaded, so any magic you plan with classloaders are deemed to fail.
comment on: http://stackoverflow.com/q/26839309
score: 0

http://stackoverflow.com/q/26869564
has comment: http://stackoverflow.com/comment/42326347
has comment: http://stackoverflow.com/comment/42332096
score: 0
has comment: http://stackoverflow.com/comment/42326447
answer count: 1
linked to: http://stackoverflow.com/q/20745964
has comment: http://stackoverflow.com/comment/42298259
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42326125
has comment: http://stackoverflow.com/comment/42298221
has comment: http://stackoverflow.com/comment/42324584
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42326556
has comment: http://stackoverflow.com/comment/42298147
has title: Why is my Java "if" statement only being triggered if I have a watch on it in Netbeans?
has comment: http://stackoverflow.com/comment/42300100
tagged with: java
has comment: http://stackoverflow.com/comment/42325886
has comment: http://stackoverflow.com/comment/42298444
has body: I am doing some work that ties in to Apache Batik ( don't think this is relevant but you never know ) and I am running into some weird behaviour that I can't figure out the reason for. The following bit of code is calculating the height of a line of text, so it can start the next line in the correct position: protected double paintTextRun(TextRun textRun, double x, double y, int lineCount, EMFGraphics2D g2d) throws IOException { AttributedCharacterIterator runaci = textRun.getACI(); char c = runaci.first(); TextPaintInfo tpi = (TextPaintInfo) runaci.getAttribute(PAINT_INFO); if ( tpi == null || !tpi.visible ) { return y; } setFont(runaci, g2d); g2d.setPaint(tpi.fillPaint); g2d.writeString(getTextFromACI(runaci, x, y); if ( runaci.getAttribute(TextAttribute.SIZE) != null ) { y+= (float)runaci.getAttribute(TextAttribute.SIZE); } else if ( textRun.getLayout().getBounds2D() != null ) { Double height = textRun.getLayout().getBounds2D().getHeight(); if ( height != null ) { y+=height/lineCount; } } return y; } The thing that is confusing me is that when I place a breakpoint on the y+= (float)runaci.getAttribute(TextAttribute.SIZE); line, it is never triggered, the condition always falls through to the else side of that statement. And yet if I watch the value of runaci.getAttribute(TextAttribute.SIZE) in Netbeans it never appears to be null. In fact placing a watch on the exact statement from the if condition consistently evaluates to true even when the code is falling through to else. It's quirky. However if I place a breakpoint on the if ( runaci.getAttribute(TextAttribute.SIZE) != null ) line, it evaluates to true and so I go into the first half of the if...else block. Take out the breakpoint and it goes back to the else side. Is this some kind of quirky bit of JVM optimisation or is there some kind of evaluation bypass bug that my limited recent Java experience has left me unprepared for? Edit to add: Comments suggested a problem with the currently running IDE/debugger,…
type: Question
tagged with: if-statement
has answer: http://stackoverflow.com/a/26889161

http://stackoverflow.com/q/26950771
tagged with: javac
has comment: http://stackoverflow.com/comment/42442801
favorite count: 0
has answer: http://stackoverflow.com/a/26980528
type: UnansweredQuestion
tagged with: makefile
upvote count: 1
score: 1
tagged with: java
tagged with: classpath
type: Question
has body: I'm trying to compile TuxGuitar (a guitar tablature editor) on OS X. I've checked out the code from the TuxGuitar repository: svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code Now, when I run make which in turn uses ant, it seems javac can't find Java packages within the project source tree. I've put the complete output of make at http://people.kth.se/~albertwi/tuxg-make-error; it's huge so I can't put all of it here in a code block. I'm assuming this is a semi-trivial class path issue but I can't tell how to modify the build configuration. On line 307 and onward in the make output there are errors/warnings on the form of "some_file.java added as some_file.class doesn't exist", I don't know what this entails: [javac] org/herac/tuxguitar/app/TGMain.java added as org/herac/tuxguitar/app/TGMain.class doesn't exist. [javac] org/herac/tuxguitar/app/TuxGuitar.java added as org/herac/tuxguitar/app/TuxGuitar.class doesn't exist. [javac] org/herac/tuxguitar/app/action/TGActionAccessInterceptor.java added as org/herac/tuxguitar/app/action/TGActionAccessInterceptor.class doesn't exist. ... On line 715 and onward some class paths are included, but it seems like not all the necessary folders are appended here (the TuxGuitar source tree contains folders on the form TuxGuitar-some program component/src/org/herac/tuxguitar, for example TuxGuitar-ascii/src/org and TuxGuitar-fluidsynth/src/org which I believe should be included here but they aren't): [javac] Compilation arguments: [javac] '-d' [javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build' [javac] '-classpath' [javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build:/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar:/opt/local/share/java/apache-ant/lib/ant-launcher.jar:/opt/local/share/java/apache-ant/lib/ant-antlr.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bcel.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bsf.jar:/opt/local/share/java/apache-ant/lib/ant-apache-lo…
has comment: http://stackoverflow.com/comment/42443017
has title: compiling TuxGuitar on on OS X, javac can't find packages
tagged with: ant
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42442928

escaping
tags question: http://stackoverflow.com/q/26959555
type: Tag
tag name: escaping
tags question: http://stackoverflow.com/q/26882245

http://stackoverflow.com/comment/42317829
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26844493
has text: I removed commons-dbcp.1.2 jar from workspace lib ,but without importing `org.apache.commons.dbcp.DelegatingConnection` class how can I use this `Connection oraconn = ((DelegatingConnection)conn).getInnermostDelegate(); `
type: Comment

bluej
tags question: http://stackoverflow.com/q/26895319
tag name: bluej
tags question: http://stackoverflow.com/q/26880927
tags question: http://stackoverflow.com/q/26874487
tags question: http://stackoverflow.com/q/26959069
tags question: http://stackoverflow.com/q/26944033
tags question: http://stackoverflow.com/q/26899568
tags question: http://stackoverflow.com/q/26856600
tags question: http://stackoverflow.com/q/26941438
tags question: http://stackoverflow.com/q/26896505
tags question: http://stackoverflow.com/q/26863244
tags question: http://stackoverflow.com/q/26878108
type: Tag

http://stackoverflow.com/comment/42288466
comment on: http://stackoverflow.com/q/26864092
type: Comment
type: QuestionComment
has text: ItemDecoration is hmm, a decoraton so why are you doing that: view.itemView.draw(c); ?
score: 0

http://stackoverflow.com/q/26917177
upvote count: 2
tagged with: xerces
tagged with: gradle
tagged with: classpath
type: Question
has answer: http://stackoverflow.com/a/26927151
tagged with: java
has body: I'm using two gradle plugins in a project : buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'pluginA:1' classpath 'pluginB:1' } } apply plugin: 'pluginA' apply plugin: 'pluginB' Both pluginA and pluginB relies on xerces but in uncompatible versions... The problem is that execution of pluginA fails because the wrong version of xerces is used. Is it possible to separate the classpath used for each plugin task execution (each plugin having only its own classpath during the execution of one of its task) ?
has title: Avoid dependency/classpath conflict between Gradle plugins
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/42497332
type: AnswerComment
has text: this gave this output : Not Found :Hello Not Found :World! Found :3 Not Found :+ Not Found :3.0 Not Found := Not Found :6.0 Not Found :true
type: Comment
comment on: http://stackoverflow.com/a/26981605
score: 0

http://stackoverflow.com/comment/42331044
score: 0
has text: Include the stacktrace please.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26888333

http://stackoverflow.com/comment/42363970
type: AnswerComment
comment on: http://stackoverflow.com/a/26906797
score: 0
type: Comment
has text: @KodingKid yes indeed. just wanted to show that this is possible. in that we you can even define an other default value if condition == true and one for condition == false; but anyway in this case your are right :)

http://stackoverflow.com/a/26975013
answers question: http://stackoverflow.com/q/26974916
has body: Well, purpose of class level member/static member is to have one copy per JVM. what you are suggesting in your question is defeating the above purpose. If that is the case, you should achieve it with instance level members. See this
upvote count: 1
score: 0
downvote count: 1
type: Answer

http://stackoverflow.com/comment/42446246
comment on: http://stackoverflow.com/q/26952746
score: 0
type: Comment
type: QuestionComment
has text: Looks like it might be telling you that your system does not support OpenGL 3.2. Are you sure that it does?

http://stackoverflow.com/a/26951069
accepted answer of: http://stackoverflow.com/q/26950920
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42443435
has comment: http://stackoverflow.com/comment/42443176
has comment: http://stackoverflow.com/comment/42443454
has comment: http://stackoverflow.com/comment/42443473
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: The infinite loop isn't in the first snippet, it's in the surrounding while - if the break never happens, stay will also be always 0, and unless one of the other operations throws an exception you'll be stuck there forever... int stay = 0; while(stay == 0){ int e; int f = 0; for(e = 1; e &lt;= posInt; e++){ if((q + 1) == Prime[f]){ stay++; break; } f++; System.out.println("Infinite"); } q++; }
has comment: http://stackoverflow.com/comment/42443303
has comment: http://stackoverflow.com/comment/42443407
answers question: http://stackoverflow.com/q/26950920
has comment: http://stackoverflow.com/comment/42443387
has comment: http://stackoverflow.com/comment/42443233
has comment: http://stackoverflow.com/comment/42443599

http://stackoverflow.com/a/26854724
answers question: http://stackoverflow.com/q/26854645
downvote count: 0
has body: That happens because the == operator compares memory addresses, not contents. Note that String is an object, not a primitive, that is probably why people get confused, you can compare primitives with == and it will be fine, but with objects you want to compare their contents.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/42323045
score: 0
type: Comment
type: AnswerComment
has text: Yes, it's for learning purposes...
comment on: http://stackoverflow.com/a/26883642

http://stackoverflow.com/q/26858335
accepted answer: http://stackoverflow.com/a/26859426
has answer: http://stackoverflow.com/a/26858673
has comment: http://stackoverflow.com/comment/42278418
upvote count: 3
tagged with: java
tagged with: date
has body: My code looks like Entity @Entity public class Transaction { @Id private String id; @Column(nullable = false) private String name; @Column(nullable = false, precision = 12, scale = 2) private BigDecimal amount; @Column(nullable = false) private boolean debit; @Column(nullable = false) private LocalDateTime date; @Column(name = "created_at") private LocalDateTime createdAt; @ManyToOne(cascade = {CascadeType.MERGE, CascadeType.REFRESH}) private Member member; Query @Nonnull public List&lt;Transaction&gt; getTransactionsForUserMonthAndYear(@Nonnull final Member existingMember, final int month, final int year) { final LocalDateTime startDate = LocalDateTime.of(year, month, 1, 0, 0, 0, 0); final LocalDateTime endDate = startDate.plusMonths(1); return crudService.query(transaction) .where(transaction.member.eq(existingMember)) .where(transaction.date.goe(startDate)) .where(transaction.date.lt(endDate)) .list(transaction); } and my test looks like @Test public void testGetTransactionsDifferentMonths() { final Member member = new Member("newUser@gmail.com", "userExternalId", "clientId", "clientSecret"); final Category category = new Category("Groceries", "Food &amp; Drink"); crudService.create(member); crudService.create(category); jpaRule.changeTransaction(); final LocalDateTime startOfMonth = LocalDateTime.of(2014, Month.JANUARY, 1, 0, 0, 0, 0); final LocalDateTime nextMonth = startOfMonth.plusMonths(1).plusMinutes(1); final Transaction sprouts = new Transaction("Sprouts", new BigDecimal("12345.346"), true, startOfMonth, member, category); final Transaction costco = new Transaction("Costco", new BigDecimal("100.295"), true, nextMonth, member, category); crudService.create(sprouts); crudService.create(costco); jpaRule.changeTransaction(); { final List&lt;Transaction&gt; transactions = new TransactionQueries(crudService).getTransactionsForUserMonthAndYear(member, 1, 2014); assertFalse(transactions.isEmpty()); assertEquals(1, transactions.size()); assertEquals(sprouts, trans…
has title: Query not returning any results for time difference of 1 minute?
has comment: http://stackoverflow.com/comment/42297925
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/42278260
has answer: http://stackoverflow.com/a/26859426
has comment: http://stackoverflow.com/comment/42278046
has comment: http://stackoverflow.com/comment/42278006
tagged with: querydsl
type: AnsweredQuestion
score: 3
favorite count: 0
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26858673
has comment: http://stackoverflow.com/comment/42278139

http://stackoverflow.com/q/26860759
has answer: http://stackoverflow.com/a/26860807
accepted answer: http://stackoverflow.com/a/26860807
upvote count: 5
downvote count: 0
tagged with: swagger
type: AnsweredQuestion
tagged with: jersey
has answer: http://stackoverflow.com/a/35513783
has body: What I want to do is to add Swagger to my REST Api based on Jersey 2.x. But it seems Swagger for Jersey is based on Jersey 1.x. When I added the Swagger dependencies in Maven I get the following exception: Exception in thread "main" java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:304) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:285) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.<init>(GrizzlyHttpContainer.java:331) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:119) I think this is because com.wordnik swagger-jersey-jaxrs_2.10 1.3.1 has dependency to com.sun.jersey jersey-client 1.13 And this is in conflict to the Jersey 2.x my application is using. Is there a Swagger integration for Jersey 2.x available? Any ideas how to solve my problem otherwise?
tagged with: java
has title: Does Swagger also work with Jersey 2.x?
type: Question
possible better answer: http://stackoverflow.com/a/35513783
answer count: 2
score: 5
tagged with: jersey-2.0
favorite count: 0
tagged with: rest

http://stackoverflow.com/comment/42509979
type: QuestionComment
comment on: http://stackoverflow.com/q/26981882
score: 0
has text: If you want to load classes from a new jar you will need to use `URLClassLoader` - for example see http://stackoverflow.com/q/9691855/2670892
type: Comment

http://stackoverflow.com/q/26920476
type: Question
has title: How can I know when someone's finished watching a video on an Android app?
score: -1
accepted answer: http://stackoverflow.com/a/26920496
has comment: http://stackoverflow.com/comment/42389212
answer count: 1
has body: This is my first question on Code Project. I'm making an Android app. In one of the activities I play videos. When one video ends, the second is supposed to start. At the moment this part of my Java file plays one video:@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_watch); VideoView vidView = (VideoView)findViewById(R.id.myVideo); String vidAddress = "https://archive.org/download/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4"; Uri vidUri = Uri.parse(vidAddress); vidView.setVideoURI(vidUri); vidView.start(); }&lt;/pre&gt; When this video ends I'm supposed to play the second one. I will probably number the videos so that I can sequence through them. But my question is: How can I know when someone's finished watching the first video? I don't allow controls (like forwarding) so that they don't skip any videos. But I don't want them to move on to the second video by closing the app halfway through the first video, for example. So, how can I know when they've finished the first video, and how can I dynamically change the video being played (e.g. video5.mp4)?
tagged with: android-activity
favorite count: 0
tagged with: android
tagged with: video
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26920496
tagged with: java
downvote count: 2
upvote count: 1

http://stackoverflow.com/comment/42478827
type: Comment
has text: I went through problem section. That gives class dependency validator message. How I solve it?
comment on: http://stackoverflow.com/a/26971408
type: AnswerComment
score: 0

http://stackoverflow.com/a/26947405
answers question: http://stackoverflow.com/q/26947394
type: Answer
downvote count: 0
score: 1
has body: You state: To me this screams performance issue because every time the paint method is called (i.e every frame) you are needlessly casting to a Graphics2D type every single time. There is minimal cost to this, and so I wouldn't worry about it. Instead profile your program and concentrate on the bottle necks that the profiler shows you matter. Is it not possible cast the graphics type to a graphics2d type outside of the paint function? No. Also, does Java do any optimization whenever the paint method is called and the same screen is being drawn again? For example if you are only moving one element on the screen then you will generally only need to update that element. It seems java redraws and re-processes the whole screen every time the paint method is called. To me this all seems unnecessarily processing intensive I don't think so. What I've done is to 1) create a BufferedImage to display my static images, and then draw directly my dynamic images, and 2) if need be, limit the area being drawn by using the repaint(...) method overload that accepts a Rectangle.
upvote count: 1

http://stackoverflow.com/comment/42442788
has text: You want to translate QML to JSON? Why? What would that achieve?
comment on: http://stackoverflow.com/q/26950605
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27038904
has body: Here is the Issue with client side multiple request. above code execute multiple request in ajax using JQuery. In contrast I have hit URL at server Side (Servlet). now code like $.ajax({ type : 'post', dataType: "json", contentType:"application/x-www-form-urlencoded; charset=utf-8", crossDomain:true, cache : true, data : { code : '&lt;%=auth_code%&gt;' }, url : '&lt;%=request.getContextPath()%&gt;/GetAccessTokenServlet', success : function(data){ alert(data); }, error: function(jqXHR, exception, errorstr) { console.log(jqXHR); alert(errorstr); } }); and servlet "GetAccessTokenServlet" like protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String code = request.getParameter("code"); String grant_type = "authorization_code"; String charset = "UTF-8"; String accessparameters = String.format("client_id=%s&amp;client_secret=%s&amp;redirect_uri=%s&amp;max_results=%s&amp;code=%s&amp;grant_type=%s", URLEncoder.encode(client_id, charset),URLEncoder.encode(client_secret, charset),URLEncoder.encode(redirect_uri, charset), URLEncoder.encode(max_results, charset),URLEncoder.encode(code, charset),URLEncoder.encode(grant_type, charset)); String resultStr = ""; try{ URL accesstoken_url = new URL("https://accounts.google.com/o/oauth2/token"); HttpURLConnection accesstokenConnection = (HttpURLConnection) accesstoken_url.openConnection(); // treeConnection.setRequestMethod("GET"); accesstokenConnection.setDoOutput(true); accesstokenConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=utf-8"); accesstokenConnection.setRequestProperty("Accept-Charset", charset); try { accesstokenConnection.getOutputStream().write(accessparameters.getBytes(charset)); } finally { accesstokenConnection.getOutputStream().close(); } BufferedReader accesstokenReader = new BufferedReader(new InputStreamReader(accesstokenConnection.getInputStream())); String line; while((line = accesstokenReader.readLine()) …
score: 0
answers question: http://stackoverflow.com/q/26910115
type: Answer

http://stackoverflow.com/a/49814869
has body: It comes when we add the elements to the list after declaring an iterator obejct. Once try to add all the elemnts to the list and after that declare the iterator object.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26955041
upvote count: 2

http://stackoverflow.com/a/26852346
has body: current = current.next.next changes nothing in your list. In order to remove an element, you need to write : current.next = current.next.next; This would remove the element that is next to the current element. It that's not the element you meant to remove, you should change the for loop so that it stops when current is the element before the one you want to remove. Make sure to test that current.next is not null, to avoid NullPointerException.
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/26852302
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26852302

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/26842454
type: Tag

http://stackoverflow.com/comment/101672385
score: 1
has text: @AmitPanasara: The XML declaration may only appear once and ***only at the very top*** of an XML document. Remove the comment that precedes the XML declaration to fix your problem.
type: AnswerComment
comment on: http://stackoverflow.com/a/26870941
type: Comment

http://stackoverflow.com/comment/42294880
type: QuestionComment
has text: @mstrap The spec (to my knowledge) doesn't say anything about hardware malfunctions at all. It also doesn't specifiy how the VM actually represents a NULL, although NULL == 0 is probably a common implementation choice. Why do you assume it should crash? When reading a value from memory there is no way to detect if the value is "correct" (ignoring ECC and other hardware mechanisms, and even those can't detect/correct everything), so if it "looks like a NULL" it *is* a NULL as far as the CPU is concerned. Study on error rates: http://www.cs.toronto.edu/~bianca/papers/sigmetrics09.pdf
score: 0
comment on: http://stackoverflow.com/q/26866759
type: Comment

http://stackoverflow.com/comment/42385244
type: Comment
comment on: http://stackoverflow.com/q/26918414
score: 2
has text: You skipped a line in the tutorial: `rootContext.register(AppConfig.class);`
type: QuestionComment

http://stackoverflow.com/a/27092826
has body: I recommend using JAXB or a similar binding framework that works with text based files. Since a JAXB implementation is part of the JRE, it's pretty easy to use. As Denis I advise against configuration keys. Here is a simple example for an easy to use and still pretty mighty way to configure you application with XML and JAXB. When you use a DI framework you can just add a similar config object to the DI context. @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class ApplicationConfig { private static final JAXBContext CONTEXT; public static final ApplicationConfig INSTANCE; // configuration properties with defaults private int number = 0; private String text = "default"; @XmlElementWrapper @XmlElement(name = "text") private List<String> texts = new ArrayList<>(Arrays.asList("default1", "default2")); ApplicationConfig() { } static { try { CONTEXT = JAXBContext.newInstance(ApplicationConfig.class); } catch (JAXBException ex) { throw new IllegalStateException("JAXB context for " + ApplicationConfig.class + " unavailable.", ex); } File applicationConfigFile = new File(System.getProperty("config", new File(System.getProperty("user.dir"), "config.xml").toString())); if (applicationConfigFile.exists()) { INSTANCE = loadConfig(applicationConfigFile); } else { INSTANCE = new ApplicationConfig(); } } public int getNumber() { return number; } public String getText() { return text; } public List<String> getTexts() { return Collections.unmodifiableList(texts); } public static ApplicationConfig loadConfig(File file) { try { return (ApplicationConfig) CONTEXT.createUnmarshaller().unmarshal(file); } catch (JAXBException ex) { throw new IllegalArgumentException("Could not load configuration from " + file + ".", ex); } } // usage public static void main(String[] args) { System.out.println(ApplicationConfig.INSTANCE.getNumber()); System.out.println(ApplicationConfig.INSTANCE.getText()); System.out.println(ApplicationConfig.INSTANCE.getTexts()); } } The configuration file lo…
downvote count: 1
answers question: http://stackoverflow.com/q/26908854
score: 0
upvote count: 1
type: Answer

http://stackoverflow.com/comment/42319198
comment on: http://stackoverflow.com/a/26881646
has text: String[] strArray = str.split(",", -1); for(int i =0 ;i<strArray.size() ;i++) if(strArray[i].equal("")) strArray[i]=null System.out.println(Arrays.toString(strArray));
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/28435010
upvote count: 1
has comment: http://stackoverflow.com/comment/45200185
has comment: http://stackoverflow.com/comment/46088916
downvote count: 0
has body: I had the same problem before. I put this at the beginning of my code // To keep this example simple, we allow network access // in the user interface thread StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder() .permitAll().build(); StrictMode.setThreadPolicy(policy); And It works.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26943279

http://stackoverflow.com/q/26853221
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42269515
tagged with: java
has comment: http://stackoverflow.com/comment/42269241
downvote count: 1
has body: I am asked to write a program based on java to convert colors from RGB to HSV , but I am not allowed to use java.awt.Color, so far my efforts got me to this level, I don't know how to make console to read the other methods it just reads the main method.. public class colorconversion { public static void main(String[] args) { System.out.println("nope"); } void RGBtoHSV( float r, float g, float b, float h, float s, float v ) { r=Input.readFloat(); float min, max, delta; min = MIN( r, g, b ); max = MAX( r, g, b ); v = max; // v delta = max - min; if( max != 0 ) s = delta / max; // s else { // r = g = b = 0 // s = 0, v is undefined s = 0; h = -1; return; } if( r == max ) h = ( g - b ) / delta; // between yellow &amp; magenta else if( g == max ) h = 2 + ( b - r ) / delta; // between cyan &amp; yellow else h = 4 + ( r - g ) / delta; // between magenta &amp; cyan h = 60; // degrees if( h &lt; 0 ) h += 360; } void HSVtoRGB( float r, float g, float b, float h, float s, float v ) { int i; float f, p, q, t; if( s == 0 ) { // achromatic (grey) r = g = b = v; return; } h /= 60; // sector 0 to 5 i = floor( h ); f = h - i; // factorial part of h p = v * ( 1 - s ); q = v * ( 1 - s * f ); t = v * ( 1 - s * ( 1 - f ) ); switch( i ) { case 0: r = v; g = t; b = p; break; case 1: r = q; g = v; b = p; break; case 2: r = p; g = v; b = t; break; case 3: r = p; g = q; b = v; break; case 4: r = t; g = p; b = v; break; default: // case 5: r = v; g = p; b = q; break; } } private static float MAX(float r, float g, float b) { // TODO Auto-generated method stub return 0; } private static float MIN(float r, float g, float b) { // TODO Auto-generated method stub return 0; } private static int floor(float h) { // TODO Auto-generated method stub return 0; } }
type: Question
has comment: http://stackoverflow.com/comment/42269509
has comment: http://stackoverflow.com/comment/42269104
score: -1
has comment: http://stackoverflow.com/comment/42270480
has title: Color Conversion RGB to HSV using formula
has comment: http://stackoverflow.com/comment/42270268
has answer: http://stackoverflow.com/a/26853452
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42270091
accepted answer: http://stackoverflow.com/a/26853452

http://stackoverflow.com/q/26925278
answer count: 2
possible better answer: http://stackoverflow.com/a/26928257
tagged with: drop-down-menu
score: 0
has title: How to display the selected value in dropdown from datastore using java GAE?
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/26928257
accepted answer: http://stackoverflow.com/a/26925372
tagged with: selectedvalue
tagged with: selected
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26925372
tagged with: java
has body: Am using the below code in jsp to retrieve the selected value from datastore. but the last option> value is displaying by default. whats wrong in this syntax? option> value="Monthly" selected="&lt;%=order.getPeriod()%> =='Monthly'? true:false">Monthly option> value="Quaterly" selected="&lt;%=order.getPeriod()%> =='Quaterly'?true:false">Quaterly Someone kindly help me to findout. thanks in advance.
has comment: http://stackoverflow.com/comment/42397101
type: Question

http://stackoverflow.com/q/26925356
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26925571
score: 0
answer count: 1
tagged with: combobox
has body: I have already defined the items in the combo box inside gui. What happens is that im trying to add an entry to the program text file and it says: incompatible types int cannot be converted to string. I am having problems with setLocation and setSkills. private void buttonAddActionPerformed(java.awt.event.ActionEvent evt) { Resort p = new Resort(); p.setName(nameTextField.getText().replaceAll("[^a-z.]", "")); p.setLocation(comboResortLocation.getSelectedIndex()); p.setSkillsByIndex(comboResortSkill.getSelectedIndex()); txtfile.addResort(p); AddedConfirm confirmed = new AddedConfirm(); confirmed.setVisible(true); this.setVisible(false); } And the part of the code from the other file. public void setSkillsByIndex (String skills) { this.skills = skills; }
tagged with: text-files
tagged with: netbeans
has title: How can i add items to java text file through GUI combo box(netbeans)
type: UnansweredQuestion

http://stackoverflow.com/q/26958303
tagged with: polymorphism
favorite count: 0
has comment: http://stackoverflow.com/comment/42455626
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26958599
tagged with: oop
score: 1
tagged with: java
upvote count: 1
has body: What I know is polymorphism is one name many form, which can be achieved using overloading and overriding where two or many methods has same name (forget about prototype for now). This is clear for me. 1-But having super class reference pointing to sub class object without any overridden method is also polymorphism? 2-Having Interface reference pointing to its implementation class object is also polymorphism? I read somewhere that this is object polymorphism. Is it true?
type: Question
has comment: http://stackoverflow.com/comment/42455618
has title: Do following conditions achieves Polymorphism?
possible better answer: http://stackoverflow.com/a/26958599
linked to: http://stackoverflow.com/q/13774403
answer count: 2
has answer: http://stackoverflow.com/a/26958383
accepted answer: http://stackoverflow.com/a/26958383
downvote count: 0

http://stackoverflow.com/a/26850135
downvote count: 0
has body: Since the Continue button is the part of the pop-up (which takes time to load), you need to give some time to webdriver to detect it. For that purpose, give a timeout using Implicit/Explicit waits. For above, you can use an Implicit timeout at the top like this; selenium.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); The above gives a 15 seconds time to the webdriver, each time it tries to locate an element. Also, in this code, if(conti.isDisplayed()) { conti.click(); } for some odd reasons, the Continue button wasn't getting clicked when inside the if ( conti.isDisplayed() ). So, lose that loop. Just use conti.click();. It worked when tried!
accepted answer of: http://stackoverflow.com/q/26848390
upvote count: 2
answers question: http://stackoverflow.com/q/26848390
type: Answer
score: 2
type: AcceptedAnswer

http://stackoverflow.com/q/26870577
has comment: http://stackoverflow.com/comment/42300103
type: AnsweredQuestion
score: 2
has title: How to create a clone of an array through generic wildcard capture in Java?
upvote count: 2
has comment: http://stackoverflow.com/comment/42300171
tagged with: java
has answer: http://stackoverflow.com/a/26870742
has comment: http://stackoverflow.com/comment/42300203
type: Question
has comment: http://stackoverflow.com/comment/42300155
tagged with: wildcard
has body: I am seeking to implement a generic class which has two fields: class A&lt;E&gt;{ private final E[] values; private final int size; //default constructor public A(){ values = (E[]) new Object[0]; size = 0; } } Now, I want to introduce a copy constructor which replicates an generic A object of an unknown type. Something like this: class A&lt;E&gt;{ private final E[] values; private final int size; //default constructor public A(){ values = (E[]) new Object[0]; size = 0; } //the copy constructor public A(A&lt;?&gt; a){ //Code here } } The basic idea is to use a wildcard capture helper function as private &lt;T&gt; T[] copyHelper(A&lt;T&gt; originalA){ T[] originalValue = originalA.value; T[] copy = Arrays.copyOf(originalValue, 0); return copy; } and then in the copy constructor do public A(A&lt;?&gt; a){ value = (A[]) copyHelper(a); size = a.size; } Does this serve the purpose? Isn't casting the return value from copyHelper() to E[] superfluous? How else can I achieve a copy of the passed A&lt;?&gt; object, whose type is unknown?
accepted answer: http://stackoverflow.com/a/26870742
has comment: http://stackoverflow.com/comment/42299948
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/42300082
has comment: http://stackoverflow.com/comment/42299845

http://stackoverflow.com/a/26897326
upvote count: 1
has comment: http://stackoverflow.com/comment/42348256
answers question: http://stackoverflow.com/q/26897223
has comment: http://stackoverflow.com/comment/42348189
has comment: http://stackoverflow.com/comment/42348008
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42347860
has body: have you tried clients.remove(i); Here's the implementation of ArrayList#remove. As you can see, it uses System.arraycopy to slide the tail of the list down so you have an uninterrupted list. /** * Removes the element at the specified position in this list. * Shifts any subsequent elements to the left (subtracts one from their * indices). * * @param index the index of the element to be removed * @return the element that was removed from the list * @throws IndexOutOfBoundsException {@inheritDoc} */ public E remove(int index) { rangeCheck(index); modCount++; E oldValue = elementData(index); int numMoved = size - index - 1; if (numMoved &gt; 0) System.arraycopy(elementData, index+1, elementData, index, numMoved); elementData[--size] = null; // clear to let GC do its work return oldValue; }
score: 1

http://stackoverflow.com/a/26860925
has comment: http://stackoverflow.com/comment/42282361
score: 4
answers question: http://stackoverflow.com/q/26860855
upvote count: 4
downvote count: 0
type: Answer
has body: You want your services to be @Transactional. If your DAOs are transactional, and you call different DAOs in each service, then you would have multiple tansaction, which is not what you want. Make the service calls @Transactional, and all DAO calls inside those methods will participate in the transaction for the method. Refer this link for more details

http://stackoverflow.com/q/26892009
type: Question
has body: i tried to to pick image from Gallery in my android application but after that an error message appears : Exception : java.lang.RuntimeException: Method called after release() Code : public class ProductAfter extends Fragment{ ...... Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, 1); ...... }
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/26893488
type: UnansweredQuestion
tagged with: android-intent
tagged with: java
has title: Pick image from Gallery in android app : "Method called after release() "

http://stackoverflow.com/q/26880491
accepted answer: http://stackoverflow.com/a/26917712
possible better answer: http://stackoverflow.com/a/26898334
tagged with: windows
has answer: http://stackoverflow.com/a/26917712
has answer: http://stackoverflow.com/a/26898334
has title: Accessing maven repo requiring windows creds with a mac
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42344531
tagged with: maven
has body: I'm trying to accessing a server with a maven repo. From my windows machine at work I can access it with my company login. With my mac I can access the server if I connect to it and enter in my windows credentials. Here is the part of my pom with the rep: repo.id file:////servername/MavenRepo true always here is the part of the settings.xml that I'm using to try to set credentials to access that maven repo. What am I doing wrong? repo.id domain\username password The error is: [ERROR] Failed to execute goal on project Company-Project: Could not resolve dependencies for project Company-Project:Company-Project:jar:DEVELOP-1.0-SNAPSHOT: Failed to collect dependencies at Company-ProjectName:Company-ProjectName:jar:1.0-SNAPSHOT: Failed to read artifact descriptor for Company-ProjectName:Company-ProjectName:jar:1.0-SNAPSHOT: Could not transfer artifact Company-ProjectName:Company-ProjectName:pom:1.0-SNAPSHOT from/to com.Company.maven (file:////Server.Company.corpnet.local/JenkinsMavenRepo): Repository path /Server.Company.corpnet.local/JenkinsMavenRepo does not exist, and cannot be created. -> [Help 1]
type: Question
tagged with: java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/42324917

http://stackoverflow.com/comment/42233052
comment on: http://stackoverflow.com/q/26833139
type: Comment
type: QuestionComment
score: 0
has text: JUnit will only show my tests failing/passing, but i want to track and log the code i write in order to make the tests pass.

http://stackoverflow.com/a/26855965
answers question: http://stackoverflow.com/q/26855660
type: Answer
accepted answer of: http://stackoverflow.com/q/26855660
score: 2
downvote count: 0
has body: Your dataSource.createCustomer(customer); is null, you have to initialize dataSource somewhere
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/42261738
type: QuestionComment
comment on: http://stackoverflow.com/q/26841894
has text: @Achuthan, this method I call within the class. It is contained within the same class. And contains the code from the first box in my previous post.
score: 0
type: Comment

http://stackoverflow.com/a/27021464
upvote count: 2
type: AcceptedAnswer
type: Answer
has body: JstMixedType seems to accumulate multiple types and concatenates their names. In your case it contains itself (or a proxy around itself, exactly spoken). This should not happen. This seems to be a bug in the VJET core and should be reported. Possibly you can work around the bug by adapting your configuration/code. Do you have any mixed types which contain themselves? Is this intended? (it probably is) If no, change them.
answers question: http://stackoverflow.com/q/26911263
accepted answer of: http://stackoverflow.com/q/26911263
score: 2
downvote count: 0

http://stackoverflow.com/a/26963815
score: 4
has comment: http://stackoverflow.com/comment/42465622
has comment: http://stackoverflow.com/comment/42465739
has comment: http://stackoverflow.com/comment/42465663
has comment: http://stackoverflow.com/comment/42465510
type: Answer
answers question: http://stackoverflow.com/q/26963757
has body: I would suggest using String.substring(int startIndex, int endIndex). For you, your program would look like this: String s = "Sugar"; for(int i = 0; i &lt; s.length() - 1; i++) { System.out.println(s.substring(0,i)); } Keep in mind that startIndex is inclusive, endIndex is exclusive. So "Sugar".substring(0,3) will give "Sug".
upvote count: 4
has comment: http://stackoverflow.com/comment/42465537
downvote count: 0
has comment: http://stackoverflow.com/comment/42465588
has comment: http://stackoverflow.com/comment/42465483

http://stackoverflow.com/comment/42302462
has text: Just tried debugging, with no luck. I've tried a whack of values. It'll ask me for a number, flicker one * on the screen then just keep running but printing nothing.
score: 0
comment on: http://stackoverflow.com/q/26872068
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42381136
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26895301
has text: @JohnVint uintx HeapSizePerGCThread = 87241520 {product} uintx InitialHeapSize := 130023424 {product} uintx LargePageHeapSizeThreshold = 134217728 {product} uintx MaxHeapSize := 2067791872 {product}
score: 0

http://stackoverflow.com/q/26947534
has body: I get a null pointer exception at this line : private ArrayList&lt;DrawableEntity&gt; entitiesToDraw = Loader.instance().getDrawableEntities(); There is apparently no problem with the constructor of Loader : public static Loader instance() { if (instance == null) { new Loader(); System.out.println("Loader ready"); } return instance; } Because I get the message "Loader ready". I don't understand, the problem seem to be before the call to getDrawableEntities() but I see nothing and it is not inside getDrawableEntities().
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26947552
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26947550
has comment: http://stackoverflow.com/comment/42437044
has answer: http://stackoverflow.com/a/26947550
type: Question
has title: Getting a weird null pointer exception
has answer: http://stackoverflow.com/a/26947552
has answer: http://stackoverflow.com/a/26947555
linked to: http://stackoverflow.com/q/70689
upvote count: 2
answer count: 3
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42437023
tagged with: nullpointerexception

http://stackoverflow.com/q/26941589
upvote count: 1
tagged with: permutation
favorite count: 0
possible better answer: http://stackoverflow.com/a/26941807
accepted answer: http://stackoverflow.com/a/26943313
tagged with: integer
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26943313
downvote count: 0
score: 1
tagged with: java
type: Question
has title: Permutation using ArrayList<Integer> to print by size of 10 in a console
has answer: http://stackoverflow.com/a/26941807
has body: I wrote simple code on random permutation between 1 to 10 using ArrayList. How can I make ArrayList in my file SmartPermutationGenerator to print the result by size of 10 in a console to get output as below: I don't want this output: Random arrays using Smart Force: 8 4 8 1 8 4 10 8 4 1 7 8 4 1 10 5 8 4 1 10 7 2 8 4 1 10 7 5 9 8 4 1 10 7 5 2 6 8 4 1 10 7 5 2 9 3 8 4 1 10 7 5 2 9 6 I want this output instead: Random arrays using Smart Force: 8 4 8 1 8 4 10 8 4 1 7 8 4 1 10 5 8 4 1 10 7 2 8 4 1 10 7 5 9 8 4 1 10 7 5 2 6 8 4 1 10 7 5 2 9 3 8 4 1 10 7 5 2 9 6 Should limit the solution using arraylist only, don't want to use recursion. This is my file SmartPermutationGenerator import java.util.ArrayList; import java.util.Random; public class SmartPermutationGenerator { private int size; private Random rand = new Random(); public SmartPermutationGenerator() { this.size = 10; } public ArrayList nextPermutation() { ArrayList&lt;Integer&gt; unused = new ArrayList&lt;Integer&gt;(); for (int i = 0; i &lt; size; i++) // loop for element in array { unused.add(i + 1); } ArrayList&lt;Integer&gt; perm = new ArrayList&lt;Integer&gt;(); for (int k = 0; k &lt; size; k++) //loop for random number between 1 to 10 { int pos = rand.nextInt(unused.size()); perm.add(unused.get(pos)); unused.remove(pos); System.out.print(perm.get(k) + " "); for (int j = 0; j &lt; k; j++) { System.out.print(perm.get(j) + " "); //loop for permutation 10 times //System.out.println(); } } return perm; } } This is my file BrutePermutationGenerator import java.util.Random; public class BrutePermutationGenerator { private int[] num = new int[10]; public int[] nextPermutation() { Random rand = new Random(); for (int j = 0; j &lt; 10; j++)//loop for permutation 10 times { for (int i = 0; i &lt; 10; i++)//loop for random number between 1 to 10 { int low = 1; int high = 10; int range = high - low + 1; int r = rand.nextInt(range); num[i] = num[r]; num[r] = i; } for (int i = 0; i &lt; 10; i++)// loop for element in array…
tagged with: arrays
tagged with: arraylist
answer count: 2

http://stackoverflow.com/comment/42233754
type: QuestionComment
type: Comment
has text: Yes, a user file system. @mico I don't understand your question.
comment on: http://stackoverflow.com/q/26832730
score: 0

http://stackoverflow.com/comment/42358269
type: Comment
has text: I don't follow the argument. Surely the fields are only accessed once?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26903402

http://stackoverflow.com/q/26977876
type: Question
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/29003411
answer count: 1
has title: Copying attributes from one XML element to another with Java
tagged with: http://stackoverflow.com/tag/xml
has body: I am writing a Java program that will create an XML file from various pieces of data. There are attribute strings containing URLs that are reused throughout the XML. I wanted to reuse these attributes (i.e., copy them from one element to another). I currently have something like this: public class copyAttributes { public static final String google_url = "http://www.google.com"; DocumentBuilderFactor docFac = DocumentBuilderFactory.newInstance(); DocumentBuilder build = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); public static Attr googleAttr = doc.createAttribute("ref:GoogleMainSite"); googleAttr.setValue(google_url); Element rootElement = doc.createElement("Root_Element"); rootElement.setAttributeNode(googleAttr); ...this is fine so far if I don't have any other elements. Now, I want to have multiple elements containing that same Google URL attribute node. I know that's redundant, but I'm following an XSD that specifically says attributes have to be reused. I know you can't just do this: Element childElement = doc.createElement("Child_Element"); childElement.setAttributeNode(googleAttr); rootElement.appendChild(childElement); ...because I know you will get an INUSE_ATTRIBUTE_ERR (I tried, that's how I know). But I want to reuse this attribute, as it will occur many times throughout the XML. I did find this: sample code for copying attributes from one element to another, but when I included that sample "Utils" class in my package and called it this way: Utils utils = new Utils(); utils.copyAttributes(rootElement, childElement); ...I receive a "NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces." There isn't much information out there about this "Namespace_err" message. The other solution I found is to simply clone an element. But this doesn't solve my problem either, since in some cases I won't want to reuse all of the attributes of another element, I will only want to u…
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/118272346
score: 1
tagged with: java

http://stackoverflow.com/a/26838386
has comment: http://stackoverflow.com/comment/42243174
score: 5
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26838341
has comment: http://stackoverflow.com/comment/42244381
has body: This is your most immediate problem: byte pass[] = md.digest(); System.out.println(pass.toString()); You're not returning the hash of the string. You're returning the result of calling toString() on a byte[]. Arrays in Java don't override toString(), so you get the default implementation, which has everything to do with the identity of the object and nothing to do with the data in the byte array: The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. (Arrays don't override hashCode() either, so that's obtained from the default implementation in Object too...) Basically, you need a different way of converting a byte[] to a String... or store the byte array directly in the database, of course. If you do want to convert to a string, I suggest you use either hex or base64. For base64, I'd suggest the iharder.net public domain library... or if you're using Java 8, you can use java.util.Base64. (It's astonishing that it took so long to get a base64 class into the standard libraries in a context other than XML etc, but there we go.) return Base64.getEncoder().encodeToString(md.digest()); Your code has an additional problem though: md.update(clearTextPassword.getBytes()); This uses the platform default encoding to convert the password into a byte array. That's not a good idea - it means you could end up getting different hashes based on what system your code is running on. It's better to specify the encoding explicitly: md.update(clearTextPassword.getBytes(StandardCharsets.UTF_8)); Additionally, catching an exception if SHA-256 is missing, logging and continuing with a blank string is almost certainly the wrong approach. Do you really want to populate your database with empty strings, allowing anyone to log in with any password? If your system is in that state, the best thing you can do is almost certai…
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26838341
downvote count: 1

http://stackoverflow.com/comment/77841394
type: QuestionComment
has text: My error displaying this seems to be eclipse is classloading JPA2.0 instead of 2.1 - worth checking
score: 0
comment on: http://stackoverflow.com/q/26927157
type: Comment

http://stackoverflow.com/comment/42333014
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26889274
has text: My application is working fine. But i need to check whether the internet is available or not and server is reachable or not.If it is not available then give proper message to user.
score: 0

http://stackoverflow.com/a/26969730
has body: I think you need to manually register plugins to be used with ImageIO in servicemix. But you have to make sure that plugins are available in class path for the servicemix bundle. ImageIO.scanForPlugins();
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26906728
upvote count: 2

http://stackoverflow.com/comment/42339099
score: 0
type: AnswerComment
has text: No i mean count of a specific types not whole the string
type: Comment
comment on: http://stackoverflow.com/a/26892077

http://stackoverflow.com/q/26989337
has comment: http://stackoverflow.com/comment/42544066
has answer: http://stackoverflow.com/a/27015037
has body: When i am trying to evaluate a new testing data on already trained classifier it brings me null point exception. Here is the code String[] optionsj = new String[2]; optionsj[0] = "-C"; optionsj[1] = "0.25"; // a decision tree //Training Classifier cls = new J48(); cls.setOptions(optionsj); Evaluation eval = new Evaluation(data); Random rand = new Random(1); // using seed = 1 int folds = 10; eval.crossValidateModel(cls, data, folds, rand); System.out.println(eval.toSummaryString()); System.out.println(eval.toClassDetailsString()); //Testing Evaluation evaltest = new Evaluation(data); evaltest.evaluateModel(cls, data2); // line 193 System.out.println(evaltest.toSummaryString()); //data and data2 are two instances of same dataset. Error i am getting is Exception in thread "main" java.lang.NullPointerExceptionat at weka.classifiers.trees.J48.distributionForInstance(Unknown Source) at weka.classifiers.Evaluation.evaluateModelOnceAndRecordPrediction(Unknown Source) at weka.classifiers.Evaluation.evaluateModel(Unknown Source) at dentis.Simplified.main(Simplified.java:193) I cant print the dataset out without a problem. What is this problem? why it occur and how to fix it?
type: AnsweredQuestion
has title: Error while evaluating new data on weka java API
tagged with: java
type: Question
tagged with: weka
has comment: http://stackoverflow.com/comment/42543884
accepted answer: http://stackoverflow.com/a/27015037
has comment: http://stackoverflow.com/comment/42544439
has comment: http://stackoverflow.com/comment/42540698
score: 0
tagged with: nullpointerexception
answer count: 1

http://stackoverflow.com/comment/42389842
score: 0
type: Comment
type: QuestionComment
has text: @Bruno What alternatives are there? What can I use instead. Thank you for your support. Could you please point me at some tutorials or something?
comment on: http://stackoverflow.com/q/26900560

http://stackoverflow.com/comment/42466606
type: Comment
has text: Doesn't `BigInteger.valueOf(i)` work?
comment on: http://stackoverflow.com/a/26964410
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42441234
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26949831
type: Comment
has text: Ok so if I do it as a parameter how would I set this up? I tried public GenericHeap(Comparator C) { heap = (E[]) new Object[capacity]; C compare=new C(); but it appears that this doesn't work?

http://stackoverflow.com/comment/42427988
comment on: http://stackoverflow.com/a/26942116
type: AnswerComment
score: 0
type: Comment
has text: u are right but u can still compare them without putting in main metod, my teacher showed us an example i can't remember

http://stackoverflow.com/comment/42322375
comment on: http://stackoverflow.com/q/26883454
type: Comment
type: QuestionComment
score: 1
has text: did you check if the milliseconds are the same?

http://stackoverflow.com/a/26852468
upvote count: 1
score: 1
has body: peeskillet that worked, thanks (great name by the way)! Specifically, in the projects tab I right-clicked "Source Packages" > "New" > "Java Package," called the new package "taggers," and moved the .tagger files into the "taggers" directory under the "src" directory under the project root directory.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26851372
answers question: http://stackoverflow.com/q/26851372
type: Answer
has comment: http://stackoverflow.com/comment/42340344

http://stackoverflow.com/q/26932596
answer count: 1
has comment: http://stackoverflow.com/comment/42410048
type: UnansweredQuestion
has body: I'm trying to read/write an object to a file, and came up with this code, which I have edited, but when I open the file it appears weird characters and signs, I guess thats the Serializable stuff in there. Is there any way to write it properly? That is my code so far. import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.FileInputStream; import java.io.ObjectInputStream; import java.io.Serializable; public class Controlador_Dades_Doctor { public void escriureFitxer(Doctor doctor){ ObjectOutputStream out; try { File file = new File("Doctors.ser"); out = new ObjectOutputStream(new FileOutputStream(file)); out.writeObject(doctor); out.flush(); out.close(); System.out.println("Object written to file"); } catch (FileNotFoundException ex) { System.out.println("Error with specified file") ; ex.printStackTrace(); } catch (IOException ex) { System.out.println("Error with I/O processes") ; ex.printStackTrace(); } } } Thats my output file, as you can see it has strange characters. ¬í sr DoctorÑmçUÝâ&amp; I idI num_guardiesD souL nomt Ljava/lang/String;xp @—p t rux Also, I've got another class which is a Map of this first class, I've got no clue how I could write them to a file aswell, so a file would contain my Doctor Map. Thanks in advance!
score: 0
tagged with: java
tagged with: filewriter
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/42410630
has answer: http://stackoverflow.com/a/26932651
tagged with: class
has title: Write/Read object to file
has comment: http://stackoverflow.com/comment/42411493

http://stackoverflow.com/q/26922606
has comment: http://stackoverflow.com/comment/42400401
has body: I have been using docker for a few weeks on my development environment, and it is quite nice, I do not have to worry about config neither I need to run a full virtual machine to just run an application server (JBoss in my case). However I seem to have gone back to the old days with compile, deploy, wait, test. Now question is, is there any way to use tools such as jrebel or dcevm in order to speed this up? Further more, does this question make sense at all?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26976222
tagged with: java
type: Question
score: 5
upvote count: 5
tagged with: docker
has title: Is it possible to use docker with jrebel or dcevm
has answer: http://stackoverflow.com/a/26976222
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42462998
favorite count: 0
tagged with: dcevm
tagged with: jrebel

http://stackoverflow.com/comment/42427478
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26941730
has text: @ProgLearner try to use the FlowLayout constructor with FlowLayout.CENTER argument (see my updated answer).

apache
tag name: apache
tags question: http://stackoverflow.com/q/26891032
tags question: http://stackoverflow.com/q/26880504
tags question: http://stackoverflow.com/q/26959357
tags question: http://stackoverflow.com/q/26974067
tags question: http://stackoverflow.com/q/26946101
tags question: http://stackoverflow.com/q/26910423
tags question: http://stackoverflow.com/q/26975394
tags question: http://stackoverflow.com/q/26909362
tags question: http://stackoverflow.com/q/26973954
tags question: http://stackoverflow.com/q/26833188
tags question: http://stackoverflow.com/q/26956642
tags question: http://stackoverflow.com/q/26919616
tags question: http://stackoverflow.com/q/26950197
tags question: http://stackoverflow.com/q/26963524
tags question: http://stackoverflow.com/q/26865775
tags question: http://stackoverflow.com/q/26886563
tags question: http://stackoverflow.com/q/26855566
tags question: http://stackoverflow.com/q/26955007
tags question: http://stackoverflow.com/q/26858399
tags question: http://stackoverflow.com/q/26841819
tags question: http://stackoverflow.com/q/26903958
tags question: http://stackoverflow.com/q/26902663
tags question: http://stackoverflow.com/q/26990859
tags question: http://stackoverflow.com/q/26954920
tags question: http://stackoverflow.com/q/26953634
tags question: http://stackoverflow.com/q/26899528
tags question: http://stackoverflow.com/q/26894248
tags question: http://stackoverflow.com/q/26964988
tags question: http://stackoverflow.com/q/26839603
tags question: http://stackoverflow.com/q/26904668
tags question: http://stackoverflow.com/q/26907333
type: Tag
tags question: http://stackoverflow.com/q/26973339
tags question: http://stackoverflow.com/q/26869187

http://stackoverflow.com/q/26873772
linked to: http://stackoverflow.com/q/14115950
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26873874
tagged with: graphics
accepted answer: http://stackoverflow.com/a/26873874
answer count: 2
has body: I'm writing java code for a game and when creating the health bars I saw an exception that confused me greatly. The code and stack is below: Code: package com.teamanubiz.pixelhero; import java.awt.Graphics; import java.awt.Image; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import com.teamanubiz.gameapi.gfx.Sprite; public class GUIRenderLayer { public void renderStatBar(GUIPosition pos, Graphics g, int health, int maxHealth, int mana, int maxMana) { Sprite healthBar = null; try { healthBar = new Sprite(ImageIO.read(new File("res\\gui\\bar.png"))); } catch (IOException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } healthBar.crop(0, 0, 128, 32); healthBar.scale(256, 32); Sprite manaBar = null; try { manaBar = new Sprite(ImageIO.read(new File("res\\gui\\bar.png"))); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } manaBar.crop(0, 32, 128, 32); manaBar.scale(265, 16); Sprite temp = null; try { temp = new Sprite(ImageIO.read(new File("res\\gui\\bar.png"))); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } temp.crop(0, 64, 128, 32); temp.scale(256, 32); Sprite emptyHealth = new Sprite(temp.getCurrent()); temp.scale(256, 16); Sprite emptyMana = new Sprite(temp.getCurrent()); if (pos == GUIPosition.BOTTOM) { double percent_h = health / maxHealth; double percent_m = mana / maxMana; healthBar.crop(0, 0, (int) ((int) 256 * percent_h), 32); manaBar.crop(0, 0, (int) ((int) 256 * percent_m), 16); g.drawImage(emptyMana.getCurrent(), 100, 464, null); g.drawImage(emptyHealth.getCurrent(), 100, 432, null); g.drawImage(healthBar.getCurrent(), 100, 432, null); g.drawImage(manaBar.getCurrent(), 100, 464, null); } } } This class is referencing a custom library containing the class Sprite. It for some reason says that I am trying to cast a ToolkitImage to a BufferedImage in the below method of Sprite…
score: 0
has title: Trying to cast an Image to a BufferedImage
tagged with: user-interface
possible better answer: http://stackoverflow.com/a/26873859
tagged with: exception
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26873859
linked to: http://stackoverflow.com/q/11959758

http://stackoverflow.com/comment/42331474
score: 0
type: Comment
has text: i don't think ebean converts class name to lowercase, can you tell me the source which supports what you said there?i tried the table name approach but this error doesn't disappear .
comment on: http://stackoverflow.com/a/26887956
type: AnswerComment

http://stackoverflow.com/a/26938896
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26938854
type: Answer
has body: You can use a couple of different methods. For this, I'd probably recommend using findElements: if(driver.findElements(By.xpath("/html/body/div[2]/div[1]/div[1]/ul/li[1]/a"))!= 0)
score: 1

http://stackoverflow.com/a/26999224
has comment: http://stackoverflow.com/comment/42552324
has body: it smells very much like this issue: https://github.com/hazelcast/hazelcast/issues/3922. Can you please try it with the latest Hazelcast 3.3.4-SNAPSHOT? It should be fixed there. EDIT: This workaround is not needed anymore; Latest releases of both 3.3 and 3.4 branches include this fix.
type: Answer
has comment: http://stackoverflow.com/comment/42551963
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26974963
upvote count: 1

http://stackoverflow.com/comment/42349822
type: Comment
comment on: http://stackoverflow.com/a/26890304
score: 0
has text: Thanks! I had also try this and I got right answer, once again thank you!:)
type: AnswerComment

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/26850419
tag name: restful-architecture

http://stackoverflow.com/comment/42386467
type: Comment
type: QuestionComment
has text: Have you installed the unlimited crypto policy files?
comment on: http://stackoverflow.com/q/26909877
score: 0

http://stackoverflow.com/comment/42529119
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26980794
has text: That should say it DOES exactly what I wanted! Much thanks!!
score: 0

http://stackoverflow.com/comment/42485526
type: QuestionComment
comment on: http://stackoverflow.com/q/26974617
has text: @Pier-AlexandreBouchard Check the Question edit history
score: 0
type: Comment

http://stackoverflow.com/comment/42377950
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26913280
has text: @James_D thanks for checking :-) Will wait a day or two to get more feedback, and then report a bug

http://stackoverflow.com/comment/42448305
type: AnswerComment
comment on: http://stackoverflow.com/a/26954076
type: Comment
has text: It worked! Thanks so much. I forgot about the main and that you have to create a watch object.
score: 1

http://stackoverflow.com/a/26985160
score: 0
type: Answer
has body: Write a script, replace all "\\" with a single forward slash, which Java will convert to the respected OS path.
answers question: http://stackoverflow.com/q/26984907

http://stackoverflow.com/comment/42296111
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26868303
score: 1
has text: Are you against any sort of collection? Can you use an ArrayList? or a List? If you can't use a collection, then you won't get much better than the above.

http://stackoverflow.com/comment/42247443
has text: I assume you have those properties to configure hibernate, currently they are doing nothing. You want to inject them into your `LocalSessionFactoryBuilder`. The `@EnableWebMvc` should go on the configuration class.
comment on: http://stackoverflow.com/q/26840399
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26835349
upvote count: 2
has body: Change your style of loop to use a do-while loop instead of while-loop. Basically, you want to enter the loop cycle at least once, for example... import java.util.Scanner; public class Test { @SuppressWarnings("resource") public static void main(String[] arg) { int count = 0; double sum = 0; double maxium = 0; double minium = 100; Scanner kb = new Scanner(System.in); double input = -1; // Main processing loop... do { // Validation loop... do { System.out.println("Please enter a value between 0 and 100, or -1 to quit: "); input = kb.nextDouble(); kb.nextLine(); } while (input &gt; 100); if (input &gt; -1) { count++; sum += input; if (maxium &lt; input) { maxium = input; } if (minium &gt; input) { minium = input; } } } while (input != -1); double average = (sum / count); System.out.println( "The average is: " + average); System.out.println( "The maxium is: " + maxium); System.out.println( "The minium is: " + minium); } } This does use two loops, you could reduce it to one and ignore any values which are out of range, for example... import java.util.Scanner; public class Test { @SuppressWarnings("resource") public static void main(String[] arg) { int count = 0; double sum = 0; double maxium = 0; double minium = 100; Scanner kb = new Scanner(System.in); double input = -1; do { System.out.println("Please enter a value between 0 and 100, or -1 to quit: "); input = kb.nextDouble(); kb.nextLine(); if (input &gt; -1 &amp;&amp; input &lt;= 100) { count++; sum += input; if (maxium &lt; input) { maxium = input; } if (minium &gt; input) { minium = input; } } } while (input != -1); double average = (sum / count); System.out.println( "The average is: " + average); System.out.println( "The maxium is: " + maxium); System.out.println( "The minium is: " + minium); } }
answers question: http://stackoverflow.com/q/26835282
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26851998
downvote count: 0
has answer: http://stackoverflow.com/a/26944512
score: 1
accepted answer: http://stackoverflow.com/a/26944512
tagged with: java
linked to: http://stackoverflow.com/q/13888784
type: Question
tagged with: corba
tagged with: glassfish
has comment: http://stackoverflow.com/comment/42280155
upvote count: 1
has body: I'm seeing an CORBA error in GIOP magic in my GlassFish 3.1.2 server log, which leads to severe errors later. As this isn't coming from my web app code, it must be from the environment(?). Can anyone help shed some light on what CORBA is, how this generic error gets generated, and how to troubleshoot? [#|2014-11-08T14:14:52.296-0800|WARNING|glassfish3.1.2|javax.enterprise.resource.corba.ORBUtil|_ThreadID=646;_ThreadName=Thread-2;|IOP00710020: Error in GIOP magic org.omg.CORBA.INTERNAL: WARNING: IOP00710020: Error in GIOP magic vmcid: OMG minor code: 20 completed: Maybe at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at ...
answer count: 1
has title: CORBA: what is it and why does it create "error in GIOP magic"?
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42294342

http://stackoverflow.com/comment/42431846
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26939489
has text: http://confluence.jetbrains.com/display/IntelliJIDEA/Compiler

http://stackoverflow.com/q/26872006
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26940066
tagged with: aem
score: 2
tagged with: sling
has comment: http://stackoverflow.com/comment/42361280
tagged with: java
type: Question
answer count: 2
has title: How to add import-packages from a specific bundle version in OSGi
downvote count: 0
tagged with: osgi
has answer: http://stackoverflow.com/a/27019464
favorite count: 0
has body: My project has two OSGi bundles (A and B) which need to use different versions of javax.activation — A requires version 1.1.0, while B requires 1.1.1. By default in AEM 5.6.1, there is a bundle already installed which exports version 1.1.1, which bundle A is using. In order to make it use 1.1.0 instaed, I used boot delegation to get the javax.activation from the JRE 7 for the system bundle which is 1.1.0. I am setting this using sling.properties file in AEM 5.6.1. If I give a version for javax.activation greater than 1.1.1 in this sling.properties file, both A and B are using the system version (even though version of import-packages is specified in the manifest.mf file); but if I give a version less than 1.1.1, both bundles use the version provided by AEM. How can I configure my bundles so as to use different versions of javax.activation for Bundle A from Bundle B?
upvote count: 2

http://stackoverflow.com/comment/42362363
comment on: http://stackoverflow.com/a/26905367
has text: 1st start activity and than finish current activity, this want show blank action bar. try it
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/26919337
has body: you may need to setup CLASSPATH variable so that jvm could load needed libraries. see this post https://docs.oracle.com/javase/tutorial/essential/environment/paths.html
type: Answer
accepted answer of: http://stackoverflow.com/q/26919270
has comment: http://stackoverflow.com/comment/42387533
upvote count: 1
answers question: http://stackoverflow.com/q/26919270
has comment: http://stackoverflow.com/comment/42387123
has comment: http://stackoverflow.com/comment/42387300
score: 1
has comment: http://stackoverflow.com/comment/42387478
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42383599
has text: Related (and informative): [Variable Scope Tutorial](http://www.java-made-easy.com/variable-scope.html) and [Official Generics Tutorial](https://docs.oracle.com/javase/tutorial/java/generics/). These are required reading before you proceed, otherwise you will not have the basics necessary to understand how these things are used (and what their limitations are) or to start to solve your stated problem (or to fully understand any correct answers to your question).
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26917458
type: Comment

http://stackoverflow.com/q/26946969
has title: PDFTable Itext arabic
answer count: 1
linked to: http://stackoverflow.com/q/6014211
score: 0
tagged with: java
tagged with: itext
has answer: http://stackoverflow.com/a/26947102
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23889488
type: Question
has body: I have coded java code and I wanted Arabic words to be displayed at PdfPTable which was asses to itext document to create PDF document as attached picture "???" is Arabic code ' PdfPTable header = new PdfPTable(6); PdfPTable tbame = new PdfPTable(1); tbame.addCell(" &gt;&gt;&gt;&gt;&gt;&gt; " + install.getCustId().getFullName() + " &lt;&lt;&lt;&lt;&lt;&lt;"); tbame.setHorizontalAlignment(PdfPTable.ALIGN_CENTER); tbame.setLockedWidth(false); tbame.setExtendLastRow(false); tbame.setWidthPercentage(100); header.addCell("End"); header.addCell("Start");

http://stackoverflow.com/a/26936278
type: Answer
has body: Maybe something like this instead. You are missing the input for the word as well. You need both the word and the action from the user. do { System.out.println("1 for new word, 2 for exit"); answer = input.nextInt(); input.nextLine(); System.out.println("input word"); String word = input.nextLine(); if (answer == 1){ for (int i = 0; i &lt; word.length(); i++) { firstLetter = word.charAt(0); word = word.substring(1, word.length()); System.out.println(firstLetter + word); word += firstLetter; } } } while(answer == 1); System.out.println("Have a nice day!");
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26936074
has comment: http://stackoverflow.com/comment/42421408
downvote count: 0

http://stackoverflow.com/q/26906745
tagged with: for-loop
has body: Hello everyone my name is Fyree, I have recently been finishing up a school assignment, and am in need of some assistance. First let me give you the second half of my code to which this question pertains: public class Rate_Graph_Graph extends Rate_Graph1{ double Aa, Bb, Cc, Dd, Ee, Ff; public void anotheractionPerformed(ActionEvent ae) { if (ae.getSource() == calc){ Aa = Double.parseDouble(bv1.getText()); Bb = Double.parseDouble(ev_1.getText()); Cc = Double.parseDouble(ev_2.getText()); Dd = Double.parseDouble(ev_3.getText()); Ee = Double.parseDouble(ev_4.getText()); Ff = Double.parseDouble(ev_5.getText()); } } JLabel graphLabel; double[] data = {Aa, Bb, Cc, Dd, Ee, Ff}; final int finalInt = 50; public void paintGraph(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; int w = getWidth(); int h = getHeight(); graphLabel = new JLabel (" Line Graph showing the Return Rate"); add(graphLabel); g2.draw(new Line2D.Double(finalInt, finalInt, finalInt, h-finalInt)); g2.draw(new Line2D.Double(finalInt, h-finalInt, w-finalInt, h-finalInt)); Font font1 = g2.getFont(); FontRenderContext fontRender = g2.getFontRenderContext(); LineMetrics lineMetrics = font1.getLineMetrics("0", fontRender); float ft = lineMetrics.getAscent()+lineMetrics.getDescent(); String str = ""; g.drawString("Aa", 5, 315); g.drawString("Bb", 5, 260); g.drawString("Cc",5,205); g.drawString("Dd",5,150); g.drawString("Ee",5,100); g.drawString("Ff",5,55); g.drawString("Beginning Value",50,335); g.drawString("Yeatr 1 Value",175,335); g.drawString("Year 2 Value",300,335); g.drawString("Year 3 Value",425,335); g.drawString("Year 4 Value",550,335); g.drawString("Year 5 Value",675,335); float ft2 = finalInt + ((h - 2*finalInt) - str.length()*ft)/2 + lineMetrics.getAscent(); for(int i = 0; i < str.length(); i++){ String strLetter = String.valueOf(str.charAt(i)); float ft3 = (float)font1.getStringBounds(strLetter, fontRender).getWidth(); float ft4 = (finalInt - ft3)/2; g2.drawString(strLetter, ft3, ft4…
accepted answer: http://stackoverflow.com/a/26906854
answer count: 1
tagged with: arrays
downvote count: 0
favorite count: 0
tagged with: type-conversion
has title: How to convert a double array into a int array
upvote count: 2
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/26906854
type: Question

http://stackoverflow.com/comment/42370221
type: Comment
comment on: http://stackoverflow.com/a/26909502
type: AnswerComment
score: 0
has text: If io try to use getCurrentSession instead of openSessione a get No CurrentSessionContext configured!

http://stackoverflow.com/a/63988058
answers question: http://stackoverflow.com/q/26893041
score: -1
downvote count: 1
type: Answer
has body: i had the same thinks , it was the encoder BOM UTF8 to UTF8
upvote count: 0

http://stackoverflow.com/q/26906442
answer count: 1
has answer: http://stackoverflow.com/a/26930437
tagged with: soap
has body: Assume I have an User object: public class User { private Long id; private String name; private String surname; // getters + setters } When creating a User through SOAP, I want the user to input only the name and surname but not the id. In this case, should I create something like UserDTO object? For example: public class UserDTO { private String name; private String surname; // getters + setters } In my service bean, I will have the following method: public void updateUser (Long id, UserDTO dto) { User user = new User(id, dto.getName(), dto.getSurname()); service.updateUser(user); } Will this be a correct approach to my question? Thank you
tagged with: cxf
has title: How to not request certain properties when creating an object through SOAP?
type: UnansweredQuestion
type: Question
tagged with: java
score: 0

http://stackoverflow.com/comment/42446048
has text: No, slightly different. I'm not using a `hash`. My understanding is a hash is the result of applying a function to an indexing value, which I haven't done.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26950460

http://stackoverflow.com/comment/109523263
score: 0
type: Comment
comment on: http://stackoverflow.com/a/28751028
type: AnswerComment
has text: The "this blog" link is no longer available. Can somebody expand? How do we get the other one?

http://stackoverflow.com/comment/42479713
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26972065
has text: Ok, that's the way I always use for passing data from one activity to another but I don't know if data passed from one activity A to another activity B is persistent in memory. I mean, if activity A compute data and then pass it to activity B, does activity B require to recompute all the second time I call it without passing through A?
type: AnswerComment

http://stackoverflow.com/comment/42273490
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26855482
has text: sometimes, it will be only content inside a pair of quotes like `'12,12,34,,,'` while sometimes, a certain field of value inside a pair of quotes could contain another pair of quotes, like `'12,12,encoding='utf-8',13'`,can your regular expression match both situation?
type: Comment

http://stackoverflow.com/comment/42243224
type: QuestionComment
has text: @chrylis Indeed, but it doesn't demonstrate any research or minimal efforts.
comment on: http://stackoverflow.com/q/26839309
score: 0
type: Comment

http://stackoverflow.com/a/26844686
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42253840
upvote count: 2
has comment: http://stackoverflow.com/comment/42255070
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/26844322
has comment: http://stackoverflow.com/comment/42253189
has body: 1 is fine, but when run separately 2, 3 and 4 error. From the code, we can note the following relationships, I have used -&gt; to mean extends or implements (that is, they are castable in the direction of the arrow) C -&gt; B -&gt; A -&gt; I variable a is of type A variable b is of type B Explicit casting using brackets is a runtime check. Implicit casting, as happens when the left and right hand sides of the assignment do not match is checked at compile time. Using the information above we can look at each of the statements and make the following conclusions: 1. a = (B)(I)b; // OK The target assignment is of type A. b is runtime castable to I, I is runtime castable to B and B is compile time castable to A. 2. b = (B)(I) a; // RUNTIME ERROR The target assignment is of type B. a is runtime castable to I, but A is not runtime castable to B. 3. a = (I) b; // COMPILE ERROR The target assignment is of type A. b is runtime castable to I but I cannot be cast at compile time to A. 4. I i = (C) a; // RUNTIME ERROR The target assignment is of type I. a is not runtime castable to C but C is compile time castable to I.
accepted answer of: http://stackoverflow.com/q/26844322

http://stackoverflow.com/comment/42383410
has text: If they are serializable, you can use an ObjectInput/output stream system to create a deep copy.
type: Comment
comment on: http://stackoverflow.com/q/26917405
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42307398
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26874794
has text: Does it have to be recursive?

http://stackoverflow.com/a/26989559
has comment: http://stackoverflow.com/comment/42513733
answers question: http://stackoverflow.com/q/26988763
accepted answer of: http://stackoverflow.com/q/26988763
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42519436
type: Answer
has body: You have two major problems with your code: You are using an implementation of Queue that's not synchronized in a multithread environment. This leads to a Race Condition when multiple threads insert/remove from the queue. Please consider using something like: workerQueue = new ConcurrentLinkedQueue() You run some very tight loops, one in your Worker.run() method where you're not checking for NPE and not allowing for some "cooldown", and another one in shutdown(): while (isrunning) { ... Runnable r = workerQueue.poll(); r.run(); ... } This, coupled with 1, leads to the Queue being emptied without properly updating the size info: ie. isEmpty() returns false but poll() returns null. Your program will become stuck in a loop. This doesn't happen when you add System.out.print() due to different timing specific to your configuration (it can continue to fail in other environments - especially where there are more than 6 cpu cores available).
has comment: http://stackoverflow.com/comment/42513944
has comment: http://stackoverflow.com/comment/42518003
score: 0

http://stackoverflow.com/q/26840737
has comment: http://stackoverflow.com/comment/42252972
favorite count: 0
has comment: http://stackoverflow.com/comment/42248252
has answer: http://stackoverflow.com/a/26842268
tagged with: jna
has comment: http://stackoverflow.com/comment/42246327
has comment: http://stackoverflow.com/comment/42253332
has title: JNA does not support C++11?
has comment: http://stackoverflow.com/comment/42246202
tagged with: c++
has comment: http://stackoverflow.com/comment/42254446
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42248069
tagged with: java
tagged with: c++11
type: Question
has comment: http://stackoverflow.com/comment/42245999
has comment: http://stackoverflow.com/comment/42246388
has comment: http://stackoverflow.com/comment/42254326
has comment: http://stackoverflow.com/comment/42254195
upvote count: 2
accepted answer: http://stackoverflow.com/a/26842268
has comment: http://stackoverflow.com/comment/42252792
downvote count: 0
answer count: 1
has body: The following code will terminate during calling c_func() on Java. It does not occur if tuple is not used. I guess JNA does not support C++11 because tuple type is introduced on it. Is my guess correct? C++ code #include &lt;tuple&gt; #include &lt;map&gt; int c_func(){ static std::map&lt; std::tuple&lt;float, float, float&gt;, float&gt; mapOfTuple; return 1; } Java code ... public interface CLibrary extends Library { public static final String JNA_LIBRARY_NAME = "test"; ... } public static void main(String[] args) { c_func(); }

http://stackoverflow.com/a/26873267
has comment: http://stackoverflow.com/comment/42305107
has comment: http://stackoverflow.com/comment/42305148
score: 0
has comment: http://stackoverflow.com/comment/42304813
has body: Have a look at this link. This page explains how you can create persistence.xml for an Oracle database. https://docs.oracle.com/cd/E16439_01/doc.1013/e13981/cfgdepds005.htm Here is an example for toplink.jdbc.user property: (It is in TopLink of course!) &lt;properties&gt; &lt;property name="toplink.logging.level" value="INFO"/&gt; &lt;property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/&gt; &lt;property name="toplink.jdbc.url" value="jdbc:oracle:thin:@myhost:l521:MYSID"/&gt; &lt;property name="toplink.jdbc.password" value="tiger"/&gt; &lt;property name="toplink.jdbc.user" value="scott"/&gt; &lt;/properties&gt; Here, scott is the schema used for connecting to database.
has comment: http://stackoverflow.com/comment/42305077
type: Answer
has comment: http://stackoverflow.com/comment/42305200
answers question: http://stackoverflow.com/q/26873107

http://stackoverflow.com/comment/42354126
type: AnswerComment
comment on: http://stackoverflow.com/a/26900873
score: 0
type: Comment
has text: Uhh, what do you mean? Register what?

http://stackoverflow.com/comment/42315693
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26878590
score: 0
has text: EJP, I've been trying hard to implement a code base and I can't seem to get it working...any suggestions or a place that has up to date information like a tutorial perhaps. I've even looked at suns however the information seems a bit convoluted. I keep getting a security manager exception after I instantiate one on the client, and I'm confused about the whole permissions aspect etc.

http://stackoverflow.com/comment/42433085
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26945247
has text: Also, if I cancel listview.setAdapter(new ListAdapter(getActivity())); this from onCreate to test the DB insertion, it threw me an error message of my button could not find the onclick method. But it was there :(
score: 0

http://stackoverflow.com/a/26976586
has body: Looks like you put size and count in the opposite order (http://en.cppreference.com/w/c/io/fread) size_t fread(void *ptr, size_t size, size_t count, FILE *stream) If a partial element is read, its value is indeterminate
has comment: http://stackoverflow.com/comment/42501715
has comment: http://stackoverflow.com/comment/42489254
has comment: http://stackoverflow.com/comment/42488220
has comment: http://stackoverflow.com/comment/42490764
answers question: http://stackoverflow.com/q/26976337
type: Answer
has comment: http://stackoverflow.com/comment/42488499
has comment: http://stackoverflow.com/comment/42498923
has comment: http://stackoverflow.com/comment/42488631
score: 0

http://stackoverflow.com/comment/42353932
comment on: http://stackoverflow.com/q/26900724
has text: Take a look at the [tutorial on JButtons](https://docs.oracle.com/javase/tutorial/uiswing/components/button.html), you need to use an ActionListener, not a MouseListener. (or at least it's a lot simpler if you do.)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26911071
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42371818
type: Answer
has body: Spring Security offers annotations for controller authorization. Here is an exampl: http://www.mkyong.com/spring-security/spring-security-hello-world-annotation-example/ Also, I strongly recommend you using Shiro instead of Spring Security. In practice, I realized configuring Spring Security has been far more complex than its value. Please refer to http://shiro.apache.org
downvote count: 0
answers question: http://stackoverflow.com/q/26910930

http://stackoverflow.com/comment/42425232
comment on: http://stackoverflow.com/a/26940519
type: Comment
has text: I still get the same exception calling setDoOutput(true) first.
type: AnswerComment
score: 0

http://stackoverflow.com/a/26858718
has body: Try dateFormat.format(curDate).
type: Answer
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/26858679
upvote count: 3

http://stackoverflow.com/comment/42326303
type: Comment
score: 1
has text: Not quite sure, but maybe a [Loader](http://developer.android.com/guide/components/loaders.html) is what you need?
type: QuestionComment
comment on: http://stackoverflow.com/q/26885693

http://stackoverflow.com/a/26996935
has body: In OnActivityResult(): if(data!=null) { Bitmap thePic = (Bitmap) data.getExtras().get("data"); img.setImageBitmap(thePic); } else { // In createNewFile, make sure you already saved the filename (prefix+System.currentTimeMillis()+".jpg"), for example, to sharedpreferences then get the filename and apply in path SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity().getBaseContext()); String filename = preferences.getString("file_name", ""); // value to retrieve String path = Environment.getExternalStorageDirectory()+"/test1/" + filename; BitmapFactory.Options bfo = new BitmapFactory.Options(); bfo.inSampleSize = 1; Bitmap bmp = BitmapFactory.decodeFile(path, bfo); img.setImageBitmap(bmp); } In createNewFile private File createNewFile(String prefix){ if(prefix==null || "".equalsIgnoreCase(prefix)){ prefix="IMG_"; } File newDirectory = new File(Environment.getExternalStorageDirectory()+"/test1/"); if(!newDirectory.exists()){ if(newDirectory.mkdir()){ Log.d(this.getClass().getName(), newDirectory.getAbsolutePath()+" directory created"); } } // modifications applied here long mDate = System.currentTimeMillis(); File file = new File(newDirectory,(prefix+mDate+".jpg")); String filename = prefix+mDate+".jpg"; SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getActivity().getBaseContext()); SharedPreferences.Editor editor = preferences.edit(); editor.putString("file_name", filename); // value to store editor.commit(); if(file.exists()){ //this wont be executed file.delete(); try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } return file; }
has comment: http://stackoverflow.com/comment/42526275
has comment: http://stackoverflow.com/comment/42527397
has comment: http://stackoverflow.com/comment/42525348
type: Answer
has comment: http://stackoverflow.com/comment/42527539
score: 1
has comment: http://stackoverflow.com/comment/42527292
has comment: http://stackoverflow.com/comment/42526657
has comment: http://stackoverflow.com/comment/42525119
has comment: http://stackoverflow.com/comment/42525551
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/26945429
has comment: http://stackoverflow.com/comment/42524799

http://stackoverflow.com/q/26875555
answer count: 1
tagged with: db2
score: 0
has title: How to use distinct on only two columns
has answer: http://stackoverflow.com/a/26876736
type: UnansweredQuestion
tagged with: java
type: Question
has body: I have this data on the table: CARID MAKECODE MODELCODE YEAR COSTCODE VIN CURRVALUE 123456 NISS MAX 2013 1 AAMBF45V5A5619007 30000.00 123457 NISS MAX 2013 1 ABMBF4DV423459007 30000.00 123458 NISS MAX 2013 1 ACMBF4D15A5319007 30000.00 123459 FORD FOC 2013 2 BAB7DF5665A1SD465 30000.00 123460 FORD FOC 2013 2 BBF7DF563453SDF65 30000.00 123461 FORD FOC 2013 2 BCF7DF5624A1SDF65 30000.00 123462 CHEV MAL 2013 3 CAMB456V223456454 30000.00 123463 CHEV MAL 2013 3 CBMB456V223456454 30000.00 123464 CHEV MAL 2013 3 CCMB456V223456454 30000.00 123465 DODG GRA 2013 4 DADF895OIU2452D25 30000.00 123466 DODG GRA 2013 4 DBDF895OIU2452D25 30000.00 123467 DODG GRA 2013 4 DCDF895OIU2452D25 30000.00 123468 TOYO COR 2013 5 EA765SADF985SAD6D 30000.00 123469 TOYO COR 2013 5 EB765SADF985SAD6D 30000.00 123470 TOYO COR 2013 5 EC765SADF985SAD6D 30000.00 123471 TOYO RAV 2013 6 FA45H45K3HJ4K5H4K 30000.00 123472 TOYO RAV 2013 6 FB45H45K3HJ4K5H4K 30000.00 123473 TOYO RAV 2013 6 FC45H45K3HJ4K5H4K 30000.00 123474 CHEV EQU 2013 7 GA8754DF876SAD876 30000.00 123475 CHEV EQU 2013 7 GB8754DF876SAD876 30000.00 123476 CHEV EQU 2013 7 GC8754DF876SAD876 30000.00 What I would like returned is: CARID MAKECODE MODELCODE YEAR COSTCODE VIN CURRVALUE 123456 NISS MAX 2013 1 AAMBF45V5A5619007 30000.00 123459 FORD FOC 2013 2 BAB7DF5665A1SD465 30000.00 123462 CHEV MAL 2013 3 CAMB456V223456454 30000.00 123465 DODG GRA 2013 4 DADF895OIU2452D25 30000.00 123468 TOYO COR 2013 5 EA765SADF985SAD6D 30000.00 123471 TOYO RAV 2013 6 FA45H45K3HJ4K5H4K 30000.00 123474 CHEV EQU 2013 7 GA8754DF876SAD876 30000.00 I am accessing the DB2 database from a java application and excluding the cars that are unavailable for dates entered using this query: SELECT A.CARID, B.CATEGORY, C.MAKEDESC, D.MODELDESC, A.YEAR, B.PERDAY, A.CURRVALUE FROM SCM.CAR_INV A INNER JOIN SCM.CAR_COST B ON A.COSTCODE = B.COSTCODE INNER JOIN SCM.CAR_MAKE C ON A.MAKECODE = C.MAKECODE INNER JOIN SCM.CAR_MODEL D ON A.MODELCODE = D.MODELCODE WHERE NOT CARID IN (SELECT CARID…
has comment: http://stackoverflow.com/comment/42396024

http://stackoverflow.com/q/26872454
has answer: http://stackoverflow.com/a/26872860
type: Question
has answer: http://stackoverflow.com/a/26872750
has comment: http://stackoverflow.com/comment/42303152
has comment: http://stackoverflow.com/comment/42303267
tagged with: arraylist
score: 0
has comment: http://stackoverflow.com/comment/42305321
answer count: 3
linked to: http://stackoverflow.com/q/26783000
has comment: http://stackoverflow.com/comment/42305484
has title: I'm not that experienced with ArrayLists, I need some basic functions for it
has comment: http://stackoverflow.com/comment/42305417
has comment: http://stackoverflow.com/comment/42305696
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42303189
has answer: http://stackoverflow.com/a/26872553
has comment: http://stackoverflow.com/comment/42303167
tagged with: java
has body: I have a 2D ArrayList List&lt;List&lt;String&gt;&gt; transitionTable = new ArrayList&lt;List&lt;String&gt;&gt;() If I'm correct, adding "rows" to this would be (correct me if I'm wrong) transitionTable.add(new ArrayList&lt;String&gt;()) How would I go about adding the equivalent of a column? Use a for loop something like this?: for (int i = 0; i &lt; transitionTable.get(0).size(); i++) { transitionTable.get(i).add("something"); } edit: Now having trouble figuring out why it stops adding after a certain point, it's always at index i = anything (depending on how many times I've iterated the loop" j = 1 (always) I forgot to mention I'm aiming for a nxn 2d arraylist (a square basically) This is my code so far: transitionTable.add(new ArrayList&lt;String&gt;()); //Adds a new row if (transitionTable.size() == 1) { transitionTable.get(0).add("NULL"); //Adds a new column. } else { for (int i = 0; i &lt; transitionTable.get(0).size(); i++) { transitionTable.get(i).add("NULL"); //Adds a new column (needs to iterate for each row to create something like a column) } }
has comment: http://stackoverflow.com/comment/42303083
has comment: http://stackoverflow.com/comment/42303101

http://stackoverflow.com/comment/42262110
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/64647/discussion-between-user3844782-and-bohuslav-burghardt).
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26849319

http://stackoverflow.com/q/26907701
tagged with: nullpointerexception
answer count: 3
has comment: http://stackoverflow.com/comment/42366024
has body: I get nullpointer exception when getting the size of an array. I only get nullpointer exception on some device. I have a class called ExerciseStartActivity. Here I call the randomize method. public class ExerciseStartActivity extends Activity{ private Exercise currentExercise; private FitnessExercise myExercises; private int exerciseNbr; private int maxExercises; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //.. .... .... // initExercise(); } private void initExercise() { exerciseNbr = 0; Exercise[] exercises = loadExercises(SavingData.getDifficulty()); myExercises = new FitnessExercise(exercises); myExercises.randomize(); maxExercises = myExercises.nbrOfExercises(); nextExercise(); } private Exercise[] loadExercises(int difficulty) { Exercise[] exercise = null; switch(difficulty){ case R.id.radio_easy: exercise = difficultyEasy(); break; case R.id.radio_medium: exercise = difficultyMedium(); break; case R.id.radio_hard: exercise = difficultyHard(); break; } return exercise; } private Exercise[] difficultyHard() { Exercise[] exercises = {new Exercise("Push-ups", "pushup", 40), new Exercise("Leg-up Crunches", "crunch_leg_up", 90), new Exercise("Crunches", "crunch", 90), new Exercise("Bicycle Crunches", "crunch_cycle", 100), new Exercise("Jumping Jacks", "jumpingjack", 100), new Exercise("Squats", "squats", 30), new Exercise("High Knees", "highknees", 120), new Exercise("Lunges", "lunge", 30), new Exercise("Bench Dips", "bench_dips", 40), new Exercise("Knee Push-ups", "kneepushups", 80) }; return exercises; } } I have a FitnessExercise class with the randomize class: In this class I get null pointer exception when randomize() method is called. public class FitnessExercise { private Exercise[] exercises; // Array with all the questions private int index = -1; // Index of the question private Random random = new Random(); public FitnessExercise(Exercise[] exercises){ this.exercises = exercises; } public void randomiz…
has answer: http://stackoverflow.com/a/26907793
tagged with: android
has title: NullPointer Exception when getting array size on some devices
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26907842
has comment: http://stackoverflow.com/comment/42365590
type: Question
has answer: http://stackoverflow.com/a/26907832
possible better answer: http://stackoverflow.com/a/26907793
tagged with: arrays
has answer: http://stackoverflow.com/a/26907842
score: 0

http://stackoverflow.com/comment/44666275
type: Comment
has text: Are you having the same issue as described [here](https://github.com/clojure-emacs/cider/issues/715)?
comment on: http://stackoverflow.com/q/26921923
score: 0
type: QuestionComment

http://stackoverflow.com/q/26958499
has title: Factory method to create object
tagged with: java
has body: I have two other class's one called product and another called promotion product, promotion product is an extension of product.class and in addition to the features of the product it can also have a prize inside. the object created in the promotion product class has a protected boolean prizeWinning that can be set to true or false. Now the product factory class describes an object which has a method makeProduct that can be called to return a new PromotionProduct object. The ProductFactory class should be set up so that a proportion of cans that are produced are prize-winning products, the proportion should be an argument to the ProductFactory constructor. Also i used Random class to make a random decision on whether a new PromotionProduct obj returned is a prize winning product. I want to give ProductFactory a method which represents a switch – when you turn it one way, makeProduct returns ordinary product objects, when you turn it the other way, makeProduct returns PromotionProduct objects. I am unsure of how to do this in this instance, could i use a switch method? import java.util.ArrayList; import java.util.Random; class ProductFactory { private ArrayList&lt;PromotionProduct&gt; prizeWinning, noPrize; Random generator = new Random(); protected boolean randomGen = generator.nextBoolean(); public ProductFactory(int p, int a, String cont) { int proportion = p; int amount = a; prizeWinning = new ArrayList&lt;PromotionProduct&gt;(); noPrize = new ArrayList&lt;PromotionProduct&gt;(); prizeWinning.add(proportion, makesProduct(cont)); for (int i = 0; i &lt; proportion; i++) { prizeWinning.get(i).prizeWinning = true; } int left = amount - proportion; prizeWinning.add(left, makesProduct(cont)); for (int i = 0; i &lt; left; i++) { noPrize.get(i).prizeWinning = false; } } public PromotionProduct makesProduct(String cont) { return new PromotionProduct(cont); }
score: 0
answer count: 1
tagged with: inheritance
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26958805
type: Question

http://stackoverflow.com/comment/44672622
type: Comment
comment on: http://stackoverflow.com/a/26905442
has text: Your approach to RecyclerView ViewHolder is wrong. By setting the onClickListener in onBindViewHolder, you're commanding something like "every time this view is rendered, tell to the imageview that, when it is clicked, it should load the image". That is the reason why the above solution was not working for you, and the way you said you "made it work" is not correct either, even if it looks like. [Here you are an example of proper RecyclerView ViewHolder pattern](https://github.com/Stoyicker/LoLin1/blob/master/app/src/main/java/org/jorge/cmp/ui/adapter/FeedAdapter.java).
type: AnswerComment
score: 0

http://stackoverflow.com/a/26876397
has comment: http://stackoverflow.com/comment/42310569
has comment: http://stackoverflow.com/comment/42310739
answers question: http://stackoverflow.com/q/26876347
upvote count: 2
has comment: http://stackoverflow.com/comment/42310622
has body: The wait() is invoked on the Thread objects but the notify() is invoked on the Downloader objects. The background threads should therefore run without a problem (although completely unsynchronized), and the main thread should always block to infinity in the first synchronized block because there's no-one to wake it up. Where this case is special is that you invoked wait() on the Thread objects themselves, which is discouraged (and by this I really mean: forbidden). When a thread terminates, it invokes notifyAll() on itself, so when workerA finishes, you get out of the first synchronized block. But by the time the second synchronized block is reached, workerB is already finished, so the second wait() will never end. Whether there is a conceptual error depends on what you were trying to achieve. From the code it looks very much like what you tried to do is join() the background threads.
score: 2
has comment: http://stackoverflow.com/comment/42310337
accepted answer of: http://stackoverflow.com/q/26876347
has comment: http://stackoverflow.com/comment/42310601
has comment: http://stackoverflow.com/comment/42310468
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42310402
type: Answer

http://stackoverflow.com/comment/42419832
has text: added the code. I just have one class.
score: 0
comment on: http://stackoverflow.com/q/26937744
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/86566392
type: Comment
has text: Haha.. yes I installed.. let's try
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/38281210

http://stackoverflow.com/comment/42311514
has text: "remove" was a nice call! This works great! Now two problems remain: 1. Unless I set setPreferredSize on both panels, pack() ignores them. 2. I have no margin around the panels so it feels very clustered. Adding an emptyBorder doesn't seem to help. Is it because I use a BorderLayout?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26876827
score: 0

http://stackoverflow.com/comment/42586899
type: Comment
comment on: http://stackoverflow.com/a/27008114
score: 0
type: AnswerComment
has text: I am still confused to be honest. I do not understand why my code would only paint one shape at a time. What exactly is stopping it from paining two at a time?

http://stackoverflow.com/a/26986595
has comment: http://stackoverflow.com/comment/42506336
upvote count: 2
has comment: http://stackoverflow.com/comment/42506475
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42506577
has comment: http://stackoverflow.com/comment/42506502
has body: a) Those Java8 Streams in the linked answer have nothing to do with Input/Outputstreams b) it's probably not that inefficient as you need the whole bitmap for the image to display it, so starting while it is half-downloaded is not that useful c) You can write to two different places at once with a TeeOutputStream.
type: Answer
accepted answer of: http://stackoverflow.com/q/26986523
score: 2
answers question: http://stackoverflow.com/q/26986523
downvote count: 0
has comment: http://stackoverflow.com/comment/42506266

http://stackoverflow.com/q/26991764
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/2506488
has answer: http://stackoverflow.com/a/26991911
has body: My finalizer guardian failed to run by the time my program exited. Here he is: public class SomeClass implements SomeInterface { ... setup the PrintWriter os somewhere here /** oh, i guess i wanted to try out finalizer guardians here. */ @SuppressWarnings("unused") private final Object finalizerGuardian = new Object(){ protected void finalize(){ try { //actually, i cannot know if it was closed or not. System.out.println("connection wasn't closed - it needs to be!"); os.flush(); os.close(); } catch (Exception se){ System.out.println("some sort of exception occurred? Weird"); } } }; ... } What did i do wrong? I thought finalizerGuardians were guaranteed to run? Or is that not the case? The PrintWriter os is definitely not flushed or closed otherwise by the time this program terminates.
has comment: http://stackoverflow.com/comment/42514935
score: 0
answer count: 2
has title: finalizer guardian didn't run
has comment: http://stackoverflow.com/comment/42514858
has answer: http://stackoverflow.com/a/29861700
tagged with: finalizer
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42515198
linked to: http://stackoverflow.com/q/6872857
has comment: http://stackoverflow.com/comment/42514813

http://stackoverflow.com/q/26857527
has title: composition relationship in class diagram can have cycles?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26858218
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/79528535
has comment: http://stackoverflow.com/comment/42276700
has body: I want to implement a model checker for Java class diagrams. There are many constraints that I've been considered for a while. Hope anyone can help me figure it out. All the cycles here I mean are pure cycles with only one type of relationship. Q1: Suppose class A is composed of class B, is it possible that class B is also composed of class A, given that class A and class B are different classes? Moreover, is it possible for composition relationship to have cycles? Q2: What about other relationship in the class diagram, like aggregation, dependence and association? What's the meaning of cycles in these relationships? Can anyone give some examples? Thanks for reading my question and hope someone can help me out.
possible better answer: http://stackoverflow.com/a/79528535
answer count: 2
has answer: http://stackoverflow.com/a/26858218
downvote count: 0
score: 1
favorite count: 0
tagged with: class-diagram

http://stackoverflow.com/a/27278431
answers question: http://stackoverflow.com/q/26909736
has body: Short Answer: You're okay. The amd64 directory stores 64-bit x86 code. Since youre running Solaris on a 64-bit x86 CPU, amd64 is fine. Longer Answer: The amd64 directory contains the 64-bit x86 binaries for Java. The /bin/java/ directory may be (or contain) a symbolic link to the directory (or binaries) in the amd64 directory. Depending on who provided that build of Java, /usr/bin/java may actually be a script that does an environment set-up &amp; calls what it thinks are the correct binaries.
score: 0
type: Answer

http://stackoverflow.com/q/26932332
linked to: http://stackoverflow.com/q/15010210
tagged with: java
tagged with: date
has body: Hello guys I have recently been assigned the task to gather some data from excel sheets and put them in a data base the main requirement here is that the data must be robust.The difficult part here is that many fields are dates and they don't have standard format so I can parse them with a normal date parser. For example There are dates that look like this "4-Mar 02:35" like this "5-Mar" like this "2.2.13 6:30 " like this "23/2/13 17:45" and like this "2.2.13 6.30" is there any way to parse them in a manner that no additional information that does not exist is added to the end date ?
has title: parse dates in java that does not adjust to a format
type: Question
upvote count: 0
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/42409712
linked to: http://stackoverflow.com/q/4216191
has answer: http://stackoverflow.com/a/26933135
tagged with: parsing
favorite count: 0
duplicate of: http://stackoverflow.com/q/4216191
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/42409735

http://stackoverflow.com/a/26965196
has comment: http://stackoverflow.com/comment/42469618
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42470043
accepted answer of: http://stackoverflow.com/q/26955310
type: Answer
answers question: http://stackoverflow.com/q/26955310
has body: It is not completely clear what you want to achieve, but note that when drawing the polygon, you are drawing the latest fixed polygon-point on exactly the same place as when drawing the point. To see this, increase the size of the point with g.fillOval(x.intValue(), y.intValue(), 10, 10); and draw the polygon with a different color in the draw method: g.setColor(Color.BLUE);

http://stackoverflow.com/comment/85970035
has text: @qbert Call `close()` on a connection how? There is no `HttpURLConnection.close()` method. You have to close the input stream, but that may or may not close the underlying connection.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26983305
type: Comment

http://stackoverflow.com/q/26869320
has comment: http://stackoverflow.com/comment/42302065
has comment: http://stackoverflow.com/comment/42327895
has title: How-to create 1 million actors in parallel?
possible better answer: http://stackoverflow.com/a/26881968
answer count: 2
has answer: http://stackoverflow.com/a/26881968
has comment: http://stackoverflow.com/comment/42327102
has comment: http://stackoverflow.com/comment/42319712
tagged with: akka
has comment: http://stackoverflow.com/comment/42303156
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42297597
has comment: http://stackoverflow.com/comment/42433144
has answer: http://stackoverflow.com/a/26895873
has body: This is just an learning example. I have an actor which holds an list of 1 million ids (This is just an stripped down example. In real life these actors could represent bank accounts and I would send them "tell" or "broadcast" messages. So I want to keep them all at the same time in memory) I want this actor to create 1 million child actors (one for each id) Is there a more parallel way than this code? receive (Msg,..) { ids.stream().forEach( id -&gt; { context().actorOf(MyActor.props(id)); } ); }
score: 1
tagged with: scala
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/26895873
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/26886118
score: 0
answers question: http://stackoverflow.com/q/26885834
has body: Have you tried using JXLS ? Using xls templates you can read and write data from Excel. Its very simple to use.
type: Answer

http://stackoverflow.com/comment/42325634
comment on: http://stackoverflow.com/a/26868329
score: 0
type: Comment
type: AnswerComment
has text: Thanks for both of you John Whish and Leigh

http://stackoverflow.com/comment/42412331
has text: @M.Page appears to have it, with some ugly assumptions.
comment on: http://stackoverflow.com/q/26933474
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42353352
comment on: http://stackoverflow.com/a/26896142
type: Comment
has text: Hi, Thank you for taking a look at this. I'm trying to make it such that Bell stops all the other objects from running - I'm not sure a queue is what I want? In any case, the two other approaches that have been advised are within the scope of the course I am taking - so I think I'll scratch away along those lines. Thanks again for taking the time to look.
type: AnswerComment
score: 0

http://stackoverflow.com/q/26832936
favorite count: 0
has answer: http://stackoverflow.com/a/26866613
has body: i have a XML-Schema which contains base64 binary data. The problem is, if the binary is big enough I unsurprisingly get an OutOfMemoryError. I managed to generate the affected java class to use the DataHanlder instead of a byte[] but still JAXb seams to do the marshaling in RAM. The used schema cannot be changed and is very complex so building the XML by handy is not a solution. The only idea i have on this is adding a placeholder instead of the big binary and replacing it afterwards. But I believe there is a better solution!? Thanks for your hints Sample Schema: &lt;schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://example.com/" xmlns:xmime="http://www.w3.org/2005/05/xmlmime" xmlns:tns="http://example.com/" elementFormDefault="qualified"&gt; &lt;element name="Document"&gt; &lt;complexType&gt; &lt;sequence&gt; &lt;element name="text" type="base64Binary" xmime:expectedContentTypes="anything/else" /&gt; &lt;/sequence&gt; &lt;/complexType&gt; &lt;/element&gt; &lt;/schema&gt; Generated Java Class: package com.example.gen; import javax.activation.DataHandler; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlMimeType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "text" }) @XmlRootElement(name = "Document") public class Document { @XmlElement(required = true) @XmlMimeType("anything/else") protected DataHandler text; public DataHandler getText() { return text; } public void setText(DataHandler value) { this.text = value; } } Sample Code: File bigFile = new File("./temp/bigFile.bin"); File outFile = new File("./temp/bigXML.xml"); Document document = new Document(); DataHandler bigDocDH = new DataHandler(new FileDataSource(bigFile)); document.setText(bigDocDH); JAXBContext jaxbContext = JAXBContext.newInstance(…
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42255189
has comment: http://stackoverflow.com/comment/42251612
upvote count: 3
downvote count: 1
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26866613
has comment: http://stackoverflow.com/comment/42246492
has title: Marshalling XML with large base64 content
tagged with: java
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/42254102
answer count: 1

http://stackoverflow.com/a/26961440
downvote count: 0
has comment: http://stackoverflow.com/comment/42488030
answers question: http://stackoverflow.com/q/26960795
type: Answer
has body: your query should be String hql = "SELECT count(e.id) FROM Employee e"; assuming Employee is your entity class where id is the variable with @Id annotations which is primary key in your table. Whenever you are using Hibernate query language, the queries should be written in context of your entity class and variable names in the class instead of table and column names
score: 1
upvote count: 1

http://stackoverflow.com/q/26859992
upvote count: 2
type: UnansweredQuestion
has body: I had read many websites and they says that using transaction is optional as hibernate application manages transaction in their own application code. But when I check code it always uses transaction? What is the correct methodology? Configuration c = new Configuration(); c.configure("hibernate.cfg.xml"); SessionFactory sf = c.buildSessionFactory(); Session s = sf.openSession(); Transaction t = s.beginTransaction(); //some code t.commit();
score: 2
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question
answer count: 2
downvote count: 0
has title: Do we have to use transaction every time while using with hibernate?
has answer: http://stackoverflow.com/a/26860098
favorite count: 0
has answer: http://stackoverflow.com/a/26861093

http://stackoverflow.com/comment/42506517
comment on: http://stackoverflow.com/q/26986784
score: 0
type: Comment
type: QuestionComment
has text: Okay, I'm lost (not that hard). What's a "fixed time step"? Do you want to maintain a constant fps by generating a variable sleep period after each update cycle??

http://stackoverflow.com/q/26875386
has comment: http://stackoverflow.com/comment/42496391
downvote count: 0
tagged with: neo4j
favorite count: 0
has title: java neo4j creating node with cypher: java.lang.String cannot be cast to java.util.Map
accepted answer: http://stackoverflow.com/a/26875725
has comment: http://stackoverflow.com/comment/42351663
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42385318
type: Question
tagged with: jersey
answer count: 1
has body: Hi Graphista and other Java gurus, I have changed my code according to answer given and after inspecting the example provided by neo4j, but still to no avail. So please, could anyone help me with this??? I have a java program which connects to a Neo4J REST API endpoint via jersey client (version 2.11 from org.glassfish.jersey.core). this is what I do: logger.trace("sending cypher {} to endpoint {}", cypherString, nodePointUrl); WebResource resource2 = Client.create().resource( nodePointUrl ); ClientResponse response2 = resource2 .accept( "application/json" ) .type( "application/json" ) .entity( cypherString ) .post( ClientResponse.class ); logger.debug("POST to {} returned status code {}, returned data: {}", nodePointUrl, response2.getStatus(), response2.getEntity(String.class)); HttpStatusCodes httpStatusCodes = HttpStatusCodes.getHttpStatusCode(response2.getStatus()); The json in the cypherstring I send to the rest api looks like this: {"CREATE": [{"POST": {"id":"532552232906940416","text":"Warburg Research...","subject":"Warburg Research ...","teaser":"Warburg Research...","lang":"de"}}]} The error message I receive on this is: java.lang.String cannot be cast to java.util.Map As you can see, my code is rather simple. I have taken it straight from neo4j website (http://neo4j.com/docs/stable/server-java-rest-client-example.html) - but it always bails out (see log below). Please see the error log and give me a hint on what I did wrong. Thanks in advance, Christian "message" : "java.lang.String cannot be cast to java.util.Map", "exception" : "BadInputException", "fullname" : "org.neo4j.server.rest.repr.BadInputException", "stacktrace" : [ "org.neo4j.server.rest.repr.formats.JsonFormat.readMap(JsonFormat.java:92)", "org.neo4j.server.rest.web.RestfulGraphDatabase.createNode(RestfulGraphDatabase.java:238)", "java.lang.reflect.Method.invoke(Method.java:606)", "org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:…
tagged with: rest
has answer: http://stackoverflow.com/a/26875725

http://stackoverflow.com/a/40099025
upvote count: 1
answers question: http://stackoverflow.com/q/26959488
downvote count: 0
has body: I had this same issue with Eclipse kepler when launching the Web Services Explorer-- I had jdk1.8 installed. Tried changing the JAVA_HOME (path points to %JAVA_HOME%) to point to jdk1.7 and still got the same issue. After some research I decided to go with uninstalling jdk1.8 and this worked (somehow). Totally a work around and not a solution; This got the Web Services Explorer to work for me.
type: Answer
score: 1

http://stackoverflow.com/q/26910470
has title: e4 RCP: Manipulating Menu when switching between perspectives
has answer: http://stackoverflow.com/a/26910814
type: Question
tagged with: rcp
has body: I am looking for a way how to manipulate the main menu of an e4 RCP application. The menu should have different items enabled, depending on the current Perspective. So far, I came up with the solution to use the @CanExecute annotation for each menu handler to check for the active perspective like so: @CanExecute public boolean canExecute(MPerspective activePerspective) { return (activePerspective.getElementId().equals("somePerspectiveName")); } Is there any better way how to do this?
score: 0
answer count: 1
tagged with: perspective
tagged with: e4
accepted answer: http://stackoverflow.com/a/26910814
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/42500983
type: Comment
type: QuestionComment
has text: It would be nice to know what that error is.
score: 1
comment on: http://stackoverflow.com/q/26983457

http://stackoverflow.com/a/26936782
answers question: http://stackoverflow.com/q/26936567
type: Answer
has comment: http://stackoverflow.com/comment/42418019
has body: The reason you are not getting an error is because you're not doing anything wrong. However, you think you are doing something wrong so let me explain: The protected keyword allows for a variable to be viewed in any classes in the same package. Since your prob3 class and your Coordinates2D class are in the same package, protected variables can be accessed in both. If you want to limit the availability of the x and y variables, you should set their access modifier to private: private int x, y; Try it, and leave the rest of your code the same. You will get the compiler error you expect.
score: 0
has comment: http://stackoverflow.com/comment/42418086
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26936567

http://stackoverflow.com/a/26966470
has comment: http://stackoverflow.com/comment/42470031
type: Answer
has body: File inf = FileUtil.openInputFile(fn); tells the compiler that openInputFile(fn) is static method of class FileUtil because you are trying to make a call to the method from the class name itself. This is why compiler said FileUtil.java:33: error: non-static method openInputFile(String) cannot be referenced from a static context So, all you need to do it is, make an object of file util and call the method from that object.
has comment: http://stackoverflow.com/comment/42470104
answers question: http://stackoverflow.com/q/26966430
score: 0

tfs
tags question: http://stackoverflow.com/q/26973871
tag name: tfs
type: Tag

installation
tags question: http://stackoverflow.com/q/26987676
tag name: installation
tags question: http://stackoverflow.com/q/26976310
type: Tag
tags question: http://stackoverflow.com/q/26929712
tags question: http://stackoverflow.com/q/26883002

http://stackoverflow.com/q/26836638
linked to: http://stackoverflow.com/q/20176087
has body: I am comparing two arraylist (Contacts .java is an pojo class). First Arraylist contains some Items and second arraylist contains some Items. By comparing two list, if both list contains same element it should not be added and else added to first list. But I cannot do it. Below is my code. Help will be appreciated. public void insertmanualandxmldata() { mContacts = storage.getarraylist(); // Arraylist if(mContacts != null) { for(int i=0; i&lt;mContacts.size(); i++) { ContactVO mShareddata = mContacts.get(i); //mParsedDataSetList arraylist for(int j=0; j&lt;mParsedDataSetList.size(); j++) { ContactVO mXmldata = mParsedDataSetList.get(j); if(mShareddata.getNumber().contains(mXmldata.getNumber())) { mContacts.add(mXmldata); } } } storage.savearraylist(mContacts); } else { storage.savearraylist(mParsedDataSetList); } }
possible better answer: http://stackoverflow.com/a/26836751
has comment: http://stackoverflow.com/comment/42239041
has answer: http://stackoverflow.com/a/26836751
favorite count: 0
tagged with: arraylist
answer count: 5
has answer: http://stackoverflow.com/a/26836942
upvote count: 2
has answer: http://stackoverflow.com/a/26836988
has answer: http://stackoverflow.com/a/26836841
has comment: http://stackoverflow.com/comment/42239092
has comment: http://stackoverflow.com/comment/42238963
has comment: http://stackoverflow.com/comment/42238889
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26837473
has title: how to compare two arraylist<Contacts> in java
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26836942

http://stackoverflow.com/a/26976190
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42488229
has body: Try this instead: <ImageView android:id="@+id/myImageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/myImageSouce" /> <TextView android:id="@+id/myImageViewText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:layout_margin="1dp" android:gravity="center" android:text="Hello" android:textColor="#000000" />
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/26976135
answers question: http://stackoverflow.com/q/26976135
downvote count: 1
has comment: http://stackoverflow.com/comment/42495006
score: 5

http://stackoverflow.com/comment/42314779
type: Comment
has text: Appreciate for checking. while((s2 = scan.hasNextLine()) != null){ s2 = scan.nextLine(); }; Is this correct?
type: AnswerComment
comment on: http://stackoverflow.com/a/26857307
score: 0

http://stackoverflow.com/q/26841285
has comment: http://stackoverflow.com/comment/42322678
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42252500
has comment: http://stackoverflow.com/comment/42318024
has body: I am trying to customize right mouse click in my RCP E4 browser, I created the popup menu in application.e4xmi, and here is my code for triggering the right click event. for creating the part inside a part stack: public void showBrowser(Composite parent, EModelService service, MApplication application, EPartService partservice) { MPartStack mpartstack = (MPartStack) service.find( "com.example.e4.rcp.wizard.partstack.confps", application); MPart navigationpart = partservice .createPart("com.example.e4.rcp.wizard.partdescriptor.navigate_pd"); navigationpart.setLabel("Visual Navigator"); // for adding the menucontext // mpartstack.getChildren().add(navigationpart); MPartStack metadata_ps = (MPartStack) service.find( "com.example.e4.rcp.wizard.partstack.metadataPS", application); metadata_ps.setVisible(true); MPart metadatapart = partservice .createPart("com.example.e4.rcp.wizard.partdescriptor.metadatadesc"); metadatapart.setLabel("Metadata"); metadata_ps.getChildren().add(metadatapart); } Inside the part descriptor: " com.example.e4.rcp.wizard.partdescriptor.navigate_pd " @Inject IEclipseContext context; EMenuService menuservice; @PostConstruct public void createControll(Composite parent, EModelService service, MApplication application) { // some other stuffs menuservice.registerContextMenu(browser, "com.example.e4.rcp.wizard.popupmenu"); } its showing NullPointerException at runtime, i tried to inject EMenuService in postconstruct method also, but in that case as expected the result is worse (you know why). I am pretty new in RCP E4, so advanced sorry if I am making any basic mistake.
has comment: http://stackoverflow.com/comment/42317498
has comment: http://stackoverflow.com/comment/42280355
has comment: http://stackoverflow.com/comment/42248849
tagged with: e4
has comment: http://stackoverflow.com/comment/42249256
has answer: http://stackoverflow.com/a/26841567
has comment: http://stackoverflow.com/comment/42247466
type: Question
tagged with: java
score: 0
has title: EMenuService throwing nullpointerException in @postConstruct
answer count: 1
tagged with: eclipse-rcp
has comment: http://stackoverflow.com/comment/42250740
has comment: http://stackoverflow.com/comment/42298843

http://stackoverflow.com/q/26950813
answer count: 1
has title: Creating a random number by using SecureRandom and BigInteger
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42442891
has comment: http://stackoverflow.com/comment/42442783
has body: Basically I have generated a random 1024 bits number by using randNo = BigInteger.probablePrime(1024, r). However, now I want to use the BitInteger randNo to create another random number which will have randNo has the maximum value and 2 as my minimum value i.e random number from 2 to randNo. Any ideas on how to achieve this? Not sure if some sort of conversion to bytes is required to pass to securerandom. Any help will be highly appreciated. Thanks, Sam
type: Question
tagged with: range
tagged with: biginteger
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26951319
has comment: http://stackoverflow.com/comment/42442937

http://stackoverflow.com/q/26974744
has comment: http://stackoverflow.com/comment/42493307
score: 0
has comment: http://stackoverflow.com/comment/42486160
has comment: http://stackoverflow.com/comment/42486206
answer count: 0
type: UnansweredQuestion
tagged with: spring
has title: H2 doesn't update row if there is no transaction
tagged with: java
tagged with: h2
has body: I start H2 in server mode and run very simple Spock test which: Starts Spring application context Updates field A Checks field A value I found that H2 doesn't update field values if transaction is not opened. Is it correct behavior?
type: Question
has comment: http://stackoverflow.com/comment/42488785
tagged with: testing

http://stackoverflow.com/q/26916999
possible better answer: http://stackoverflow.com/a/26917106
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/26917180
tagged with: count
has body: I'm trying to use simply a while loop and the String method indexOf() to count how many times a certain word appears in a String given by the user. The method I created seems to count how many times a certain letter appears, but not how many times a word appears. I think this is because the indexOf can't differentiate between a set of letters and spaces. So would I have to create another loop for the computer to understand what I consider words? This is what I have so far: public static void countWord(String sentenceEntered, String badWord){ int number = sentenceEntered.toUpperCase().indexOf(badWord, 0); while (number &gt;= 0){ System.out.print(number); number = sentenceEntered.indexOf(badWord, number + 1); } }//end of countWord But when I run my program, nothing gets printed.
answer count: 4
has comment: http://stackoverflow.com/comment/42382608
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26917126
has title: Java Count Words IndexOf
tagged with: loops
upvote count: 1
has answer: http://stackoverflow.com/a/26917153
type: Question
has comment: http://stackoverflow.com/comment/42382662
tagged with: indexof
has answer: http://stackoverflow.com/a/26917106
has answer: http://stackoverflow.com/a/26917180
has comment: http://stackoverflow.com/comment/42382550
tagged with: while-loop

http://stackoverflow.com/a/30601282
score: 5
upvote count: 5
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26838517
has body: I had the same problem. In my case (not yours exactly), the problem was the jvm.dll path, because the variable %JAVA_HOME% has spaces. So to solve this, I modify the assignment set CG_PATH_TO_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll to set CG_PATH_TO_JVM="%JAVA_HOME%\jre\bin\server\jvm.dll" and that's all. Also, you could check the variables assignment with this command: prunmgr//ES//yourservicename_as_in_windows

http://stackoverflow.com/a/26910050
downvote count: 0
answers question: http://stackoverflow.com/q/26907707
type: Answer
has body: Solved! The problem was caused by my .story file not being copied over to the target test-classes folder as it wasn't in the resources folder. As JBehave couldn't find the story file the storyDurations.props wasn't created as no stories were run. Once I moved the .story file into resources everything ran fine.
score: 2
upvote count: 2

http://stackoverflow.com/comment/42299748
type: QuestionComment
score: 1
has text: The code of the controller is also invalid. Why don't you post the real code?
comment on: http://stackoverflow.com/q/26870177
type: Comment

nullpointerexception
tags question: http://stackoverflow.com/q/26901278
tags question: http://stackoverflow.com/q/26943085
tags question: http://stackoverflow.com/q/26945247
tags question: http://stackoverflow.com/q/26907701
tags question: http://stackoverflow.com/q/26866759
tags question: http://stackoverflow.com/q/26879814
tags question: http://stackoverflow.com/q/26990472
tags question: http://stackoverflow.com/q/26912896
tags question: http://stackoverflow.com/q/26930625
tags question: http://stackoverflow.com/q/26839139
tags question: http://stackoverflow.com/q/26871417
type: Tag
tags question: http://stackoverflow.com/q/26941438
tags question: http://stackoverflow.com/q/26977548
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/26899479
tags question: http://stackoverflow.com/q/26944317
tags question: http://stackoverflow.com/q/26852746
tags question: http://stackoverflow.com/q/26912813
tags question: http://stackoverflow.com/q/26922640
tags question: http://stackoverflow.com/q/26975119
tags question: http://stackoverflow.com/q/26945491
tags question: http://stackoverflow.com/q/26874173
tags question: http://stackoverflow.com/q/26959446
tags question: http://stackoverflow.com/q/26890151
tags question: http://stackoverflow.com/q/26947534
tags question: http://stackoverflow.com/q/26841806
tags question: http://stackoverflow.com/q/26960027
tags question: http://stackoverflow.com/q/26965661
tags question: http://stackoverflow.com/q/26885693
tags question: http://stackoverflow.com/q/26878701
tags question: http://stackoverflow.com/q/26988809
tags question: http://stackoverflow.com/q/26960429
tags question: http://stackoverflow.com/q/26971805
tags question: http://stackoverflow.com/q/26989337
tags question: http://stackoverflow.com/q/26964857
tags question: http://stackoverflow.com/q/26963920
tags question: http://stackoverflow.com/q/26840640
tags question: http://stackoverflow.com/q/26841758

size
type: Tag
tags question: http://stackoverflow.com/q/26990024
tag name: size
tags question: http://stackoverflow.com/q/26850828

http://stackoverflow.com/comment/42395146
comment on: http://stackoverflow.com/a/26922281
type: AnswerComment
score: 0
type: Comment
has text: @marcoquezada - Read the javadoc, read the javadoc. https://docs.oracle.com/javase/8/docs/api/java/math/BigInteger.html#ONE

spring-security
tags question: http://stackoverflow.com/q/26990120
tags question: http://stackoverflow.com/q/26951513
tags question: http://stackoverflow.com/q/26939101
tags question: http://stackoverflow.com/q/26840016
tags question: http://stackoverflow.com/q/26903472
tags question: http://stackoverflow.com/q/26933520
tags question: http://stackoverflow.com/q/26850685
tags question: http://stackoverflow.com/q/26843383
tags question: http://stackoverflow.com/q/26921093
type: Tag
tags question: http://stackoverflow.com/q/26944600
tags question: http://stackoverflow.com/q/26975740
tags question: http://stackoverflow.com/q/26839849
tags question: http://stackoverflow.com/q/26938642
tags question: http://stackoverflow.com/q/26906949
tags question: http://stackoverflow.com/q/26929717
tags question: http://stackoverflow.com/q/26887934
tags question: http://stackoverflow.com/q/26861848
tags question: http://stackoverflow.com/q/26886558
tags question: http://stackoverflow.com/q/26859227
tags question: http://stackoverflow.com/q/26910930
tags question: http://stackoverflow.com/q/26886121
tags question: http://stackoverflow.com/q/26928957
tags question: http://stackoverflow.com/q/26883281
tags question: http://stackoverflow.com/q/26902584
tags question: http://stackoverflow.com/q/26972988
tags question: http://stackoverflow.com/q/26859669
tags question: http://stackoverflow.com/q/26906293
tags question: http://stackoverflow.com/q/26883338
tags question: http://stackoverflow.com/q/26941676
tags question: http://stackoverflow.com/q/26976401
tags question: http://stackoverflow.com/q/26895439
tag name: spring-security
tags question: http://stackoverflow.com/q/26866529

http://stackoverflow.com/a/26879121
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26879050
type: Answer
has body: That's the way how it behave. You created a list of ArrayList&lt;MotorVehicle&gt;. Car is a subclass of MotorVehicle therefore when you add a Car object into a MotorVehicle list is totally okay. For example, you can do the following final Car my car = new Car(); if (car instanceof MotorVehicle) { System.out.println("I am a motor vehicle"); } if (car instanceof Car) { System.out.println("I am a car"); } A car is a Car and also a MotorVehicle.
downvote count: 0

http://stackoverflow.com/a/26899099
type: AcceptedAnswer
upvote count: 3
type: Answer
has body: nb: I don't like null layouts, I don't condone null layouts, I would prefer to have used custom painting, but that's a lot of work not related to the question. This example is intended to focus on the implementation of a Timeline and KeyFrame animation Because you have to move the object through both the x/y positions, but in different directions over the same time period, this becomes a very complex problem... You could try and set up four, chained Timers, which trigger the next Timer when they complete, and which all do a different part of the animation...but frankly, that becomes a mess real quick... A better idea is to use a concept of a time line and key frames. The idea is, that over the time line (0-1), certain events occur at prescribed times (key frames). The time line will then blend between these key frames... import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.TreeMap; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.Timer; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class MoveLabel { public static void main(String[] args) { new MoveLabel(); } public MoveLabel() { EventQueue.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } JFrame frame = new JFrame("Testing"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); TestPane testPane = new TestPane(); testPane.setBackground(Color.WHITE); frame.getContentPane().add(testPane); frame.pack(); frame.setLocationRelative…
accepted answer of: http://stackoverflow.com/q/26898536
answers question: http://stackoverflow.com/q/26898536
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42467629

http://stackoverflow.com/a/26898570
type: Answer
accepted answer of: http://stackoverflow.com/q/26892906
has comment: http://stackoverflow.com/comment/42363337
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42358298
has comment: http://stackoverflow.com/comment/42364255
has body: EDIT You have defined twice the SUCCESS result for your action.
has comment: http://stackoverflow.com/comment/42358121
has comment: http://stackoverflow.com/comment/42362189
has comment: http://stackoverflow.com/comment/42363499
upvote count: 1
has comment: http://stackoverflow.com/comment/42362581
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42355167
has comment: http://stackoverflow.com/comment/42362673
answers question: http://stackoverflow.com/q/26892906

http://stackoverflow.com/a/26934483
score: 1
has comment: http://stackoverflow.com/comment/42418811
has comment: http://stackoverflow.com/comment/42414830
has body: Start by changing the data structure: rather than using a list of two-element String[] arrays, define a class for your key-value pairs: class KeyValuePair { private final String key; private final String value; public KeyValuePair(String k, String v) { key = k; value = v; } public String getKey() { return key; } public String getValue() { return value; } } Note that the class is immutable. Now make an object with three lists of KeyValuePair objects: class ParseResult { private final List&lt;KeyValuePair&gt; sanitized = new ArrayList&lt;KeyValuePair&gt;(); private final List&lt;KeyValuePair&gt; badKey = new ArrayList&lt;KeyValuePair&gt;(); private final List&lt;KeyValuePair&gt; badValue = new ArrayList&lt;KeyValuePair&gt;(); public ParseResult(List&lt;KeyValuePair&gt; s, List&lt;KeyValuePair&gt; bk, List&lt;KeyValuePair&gt; bv) { sanitized = s; badKey = bk; badValue = bv; } public List&lt;KeyValuePair&gt; getSanitized() { return sanitized; } public List&lt;KeyValuePair&gt; getBadKey() { return badKey; } public List&lt;KeyValuePair&gt; getBadValue() { return badValue; } } Finally, populate these three lists in a single loop that reads from the file: public static ParseResult parseFile(File csvFile) { Scanner scan = null; try { scan = new Scanner(csvFile); } catch (FileNotFoundException e) { ??? // Do something about this exception. // Consider not catching it here, letting the caller deal with it. } final List&lt;KeyValuePair&gt; sanitized = new ArrayList&lt;KeyValuePair&gt;(); final List&lt;KeyValuePair&gt; badKey = new ArrayList&lt;KeyValuePair&gt;(); final List&lt;KeyValuePair&gt; badValue = new ArrayList&lt;KeyValuePair&gt;(); while (scan.hasNext()) { String[] tokens = scan.nextLine().trim().split(","); if (tokens.length != 2) { ??? // Do something about this - either throw an exception, // or log a message and continue. } KeyValuePair kvp = new KeyValuePair(tokens[0], tokens[1]); // Do the validation on the spot if (!validateRecordKey(kvp.getKey())) { badKey.add(…
accepted answer of: http://stackoverflow.com/q/26934189
answers question: http://stackoverflow.com/q/26934189
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42414754
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/42418661

http://stackoverflow.com/a/26840865
type: Answer
has body: Swing UI Are you using the swing client? Do you want to change the logo "Eclipse Scout" provided by default: Read this: How to brand the swing client. Image field If you want to display an image somewhere in a form, consider using an Image Field. You will get something like what you see in this Preview form: Check the example in this Form: ImageFieldForm (Scout demo: widgets application).
answers question: http://stackoverflow.com/q/26838119
score: 0

http://stackoverflow.com/comment/42232744
has text: It sounds like you need to ask your professor what he/she expects you to hand in. It may be that all that is required is a JUnit test suite along with your program.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26833139
score: 1

http://stackoverflow.com/comment/42233293
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26833139
type: Comment
has text: Have a look at http://stackoverflow.com/q/13199559 - I'm not sure whether it's what you want or not.

http://stackoverflow.com/a/51104930
upvote count: 4
has comment: http://stackoverflow.com/comment/89456078
downvote count: 0
has comment: http://stackoverflow.com/comment/89333323
score: 4
has body: I had similar issue in Spring Boot application. The application utilizes Feign (HTTP client synthetizing requests from annotated interfaces). Having interface SomeClient annotated with @FeignClient, Feign generates runtime proxy class implementing this interface. When some Spring component tries to autowire bean of type SomeClient, Idea complains no bean of type SomeClient found since no real class actually exists in project and Idea is not taught to understand @FeignClient annotation in any way. Solution: annotate interface SomeClient with @Component. (In our case, we don't use @FeignClient annotation on SomeClient directly, we rather use metaannotation @OurProjectFeignClient which is annotated @FeignClient and adding @Component annotation to it works as well.)
has comment: http://stackoverflow.com/comment/90884454
answers question: http://stackoverflow.com/q/26889970
type: Answer

http://stackoverflow.com/comment/42344271
score: 0
has text: For at least one of the plugins, the `AuthenticationProvider` has to call a login function on the database server with information from the authentication that was passed in. The login returns a session token for the user, which is then used for future database access. As such, we can't really get any user details until after the login is called.
comment on: http://stackoverflow.com/q/26859227
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26911639
tagged with: android
has answer: http://stackoverflow.com/a/26912228
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26912228
has title: Adding a click listener to the Drag-Sort-Listview library
type: Question
tagged with: android-listfragment
tagged with: listview
score: 0
answer count: 1
has body: I've implemented this library based off a listfragment, and its implementation is very similar to this code sample on the library's github repo: https://github.com/bauerca/drag-sort-listview/blob/master/demo/src/com/mobeta/android/demodslv/DSLVFragment.java My question is, how do I implement a click listener? This is my xml file: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;com.mobeta.android.dslv.DragSortListView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:dslv="http://schemas.android.com/apk/lib/com.mobeta.android.dslv" android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="3dp" dslv:drag_handle_id="@drawable/bg_handle" android:layout_margin="3dp" android:dividerHeight="2dp" dslv:drag_enabled="true" dslv:collapsed_height="2dp" dslv:drag_scroll_start="0.33" dslv:max_drag_scroll_speed="0.5" dslv:float_alpha="0.6" dslv:slide_shuffle_speed="0.3" dslv:track_drag_sort="false" dslv:float_background_color="@color/blue" android:focusable="false" android:focusableInTouchMode="false" dslv:use_default_controller="false" /&gt; And this is how I've tried to create a click listener, but it doesn't respond: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDslv = (DragSortListView) inflater.inflate(getLayout(), container, false); mController = buildController(mDslv); mDslv.setFloatViewManager(mController); mDslv.setOnTouchListener(mController); mDslv.setDragEnabled(dragEnabled); SimpleFloatViewManager simpleFloatViewManager = new SimpleFloatViewManager(mDslv); simpleFloatViewManager.setBackgroundColor(Color.TRANSPARENT); mDslv.setFloatViewManager(simpleFloatViewManager); mDslv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { System.out.println("Clicked!"); } }); return mDslv; }

http://stackoverflow.com/a/26967826
upvote count: 4
downvote count: 0
has comment: http://stackoverflow.com/comment/42502931
answers question: http://stackoverflow.com/q/26964672
has body: The logging entry above doesn't look like Log4J. I think thats ACL or JUL. When you are using Slf4j to Log4J, you also need to redirect these frameworks to Slf4j. Add these dependencies to your project as well: org.slf4j jcl-over-slf4j 1.7.5 org.slf4j jul-to-slf4j 1.7.5 Read this doc page about redirecting Jul to Slf4J, too. Be sure to exclude any existing commons-logging.jar files from your project, through Maven. (From the Slf4J documentation page) And if all else fails, try the following code: //see if we can find the offending logger through slf4j's LoggerFactory org.slf4j.Logger logger = LoggerFactory.getLogger(Class.forName("org.quartz.core.QuartzSchedulerThread")); if (logger != null && logger instanceof ch.qos.logback.classic.Logger) { //the slf4j Logger interface doesn't expose any configuration API's, but //we can cast to a class that does; so cast it and disable the logger ((ch.qos.logback.classic.Logger)logger).setLevel( ch.qos.logback.classic.Level.OFF); }
accepted answer of: http://stackoverflow.com/q/26964672
score: 4
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/42424293
type: QuestionComment
has text: I want to leave a specific mark where some strings exist so that i can find them easily after matching
comment on: http://stackoverflow.com/q/26939954
score: 0
type: Comment

http://stackoverflow.com/q/26944097
has answer: http://stackoverflow.com/a/26944142
tagged with: libgdx
tagged with: java
has title: Libgdx How to set alarm?
type: Question
answer count: 1
score: 0
tagged with: android
has body: I want to set alarm ya how to use broadcast receiver in libgdx programing. I don't know how to set Alarm in Libgdx. please suggest any idea ya any link how to implement. alarmManager is not working in Libgdx. How to use broadcast receiver in libgdx program.
type: UnansweredQuestion

http://stackoverflow.com/comment/42422423
comment on: http://stackoverflow.com/q/26939111
score: 0
type: Comment
type: QuestionComment
has text: Where did the error occur? What was the input data?

http://stackoverflow.com/q/26951327
has answer: http://stackoverflow.com/a/26952054
has title: What is GlobalPlatform and JavaCard relationship?
has answer: http://stackoverflow.com/a/26963134
answer count: 3
has body: I'm getting started with GlobalPlatfrom Card spec and I cannot figure out how GLobalPlatform functinalify comes to JavaCard. Is there any applet that should be installed into a card to make this card GP-compatible? Or is the GP-functionality provided into a card during manufacturing as JRE extension? Or even is it possible to make non GP-compatible card to be GP-compatible?
accepted answer: http://stackoverflow.com/a/26963134
has comment: http://stackoverflow.com/comment/42464231
score: 8
favorite count: 0
possible better answer: http://stackoverflow.com/a/26952054
has answer: http://stackoverflow.com/a/30502972
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: simulator
upvote count: 8
type: Question
tagged with: javacard
tagged with: globalplatform

http://stackoverflow.com/a/27122214
has body: Use the following code snippet to get Map of all the files modified under particular directory path you provide: private static HashMap lastModifiedFileList(FileSystem fs, Path rootDir) { // TODO Auto-generated method stub HashMap modifiedList = new HashMap(); try { FileStatus[] status = fs.listStatus(rootDir); for (FileStatus file : status) { modifiedList.put(file.getPath(), file.getModificationTime()); } } catch (IOException e) { e.printStackTrace(); } return modifiedList; }
score: 1
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26936932

http://stackoverflow.com/a/26967198
has body: No versions available for org.springframework:spring-aop:jar:[2.5.2,3) Meaning jersey-spring needs spring-aop 2.5&lt;= version &lt; 3 So jersey-spring 1.8 and spring 3.0.5 are incompatible I would try the following: Look for newer version of jersey-spring that works with spring 3.0.5. Maybe jersey-spring3 as suggested by peeskillet above. Try my luck with spring 3.0.5 by adding exclusions to jersey-spring dependency. Consult the pom here and including them with version 3.0.5 if needed.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26966862

http://stackoverflow.com/a/26879339
has body: Instead of using DataFlavor.stringFlavor you should be using DataFlavor.javaFileListFlavor This will return java.util.List, containing the list of files that you've selected. Make sure to cast it properly: List fileList = (List)c.getData(DataFlavor.javaFileListFlavor)
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26879284
answers question: http://stackoverflow.com/q/26879284
score: 6
type: Answer
upvote count: 6

http://stackoverflow.com/q/26956009
downvote count: 0
has body: I've tried out Otto in my latest Android project, and it really does simplify communication between Objects a ton. However, I'm not certain if there can be any hidden problems from communicating between Threads with it. This is what I did, created a SingletonBus using an enum so that the Bus is accessible anywhere: public enum SingletonBus { INSTANCE; private static String TAG = SingletonBus.class.getSimpleName(); private Bus bus; private boolean paused; private final Vector&lt;Object&gt; eventQueueBuffer = new Vector&lt;&gt;(); private Handler handler = new Handler(Looper.getMainLooper()); private SingletonBus() { this.bus = new Bus(ThreadEnforcer.ANY); } public &lt;T&gt; void postToSameThread(final T event) { bus.post(event); } public &lt;T&gt; void postToMainThread(final T event) { try { if(paused) { eventQueueBuffer.add(event); } else { handler.post(new Runnable() { @Override public void run() { try { bus.post(event); } catch(Exception e) { Log.e(TAG, "POST TO MAIN THREAD: BUS LEVEL"); throw e; } } }); } } catch(Exception e) { Log.e(TAG, "POST TO MAIN THREAD: HANDLER LEVEL"); throw e; } } public &lt;T&gt; void register(T subscriber) { bus.register(subscriber); } public &lt;T&gt; void unregister(T subscriber) { bus.unregister(subscriber); } public boolean isPaused() { return paused; } public void setPaused(boolean paused) { this.paused = paused; if(!paused) { Iterator&lt;Object&gt; eventIterator = eventQueueBuffer.iterator(); while(eventIterator.hasNext()) { Object event = eventIterator.next(); postToMainThread(event); eventIterator.remove(); } } } } Then I created an Event which can contain the result of an operation (I'm not subclassing anything yet but creating an Event for each operation, but I'll try refactoring it when it'll get messy if it'll be necessary): public class KeyPairCreatedEvent { private KeyPair keyPair; public KeyPairCreatedEvent(KeyPair keyPair) { this.keyPair = keyPair; } public KeyPair getKeyPair() { return keyPair; } } And then I created a…
favorite count: 0
has answer: http://stackoverflow.com/a/27070780
tagged with: multithreading
tagged with: android
possible better answer: http://stackoverflow.com/a/26987729
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26987729
score: 1
tagged with: java
tagged with: otto
upvote count: 1
accepted answer: http://stackoverflow.com/a/27070780
type: Question
has title: Using Otto for communication between threads: Can it cause any problems?
answer count: 2

http://stackoverflow.com/comment/42315704
type: Comment
comment on: http://stackoverflow.com/q/26879475
has text: We won't do your homework for you; post what you've tried or researched already.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42458038
comment on: http://stackoverflow.com/a/26959678
score: 0
type: AnswerComment
has text: I need this program to run all day. Would it be a possibility to just have a while loop outside all of the program that would make it run to infinity until someone terminates it?
type: Comment

http://stackoverflow.com/comment/42238492
type: AnswerComment
score: 0
type: Comment
has text: you are welcome, you can click the tick below the upvote to accept the answer if you think it helps to solve your problem
comment on: http://stackoverflow.com/a/26836380

http://stackoverflow.com/q/26857822
has comment: http://stackoverflow.com/comment/42660621
linked to: http://stackoverflow.com/q/26813725
has comment: http://stackoverflow.com/comment/42281337
has answer: http://stackoverflow.com/a/26857980
accepted answer: http://stackoverflow.com/a/26857980
type: AnsweredQuestion
has title: Why won't IntelliJ IDEA create a JAR artifact without a class with Main() method?
downvote count: 0
score: 1
tagged with: java
type: Question
has body: Based on the answer to this question: How to organize a large java project in Intellij Idea I am attempting to make a Jar file out of a middle-ware Java component I've authoried with IDEA. I intend to import this Jar in several related projects all of which leverage the middleware component. In order to mak ea jar file, I'm instructed to create an "Artifact" using the project structure dialog. When I do so, the dialog box asks to identify the class with the "Main" method. But my jar is meant to basically be a library class, and none of the classes have (or need) a main method. Of course I could create a dummy main method, but the requirement troubles me. Why would I need a class with a main method if I am creating a Jar meant to contain middle ware objects/
upvote count: 1
tagged with: intellij-idea
answer count: 1
has comment: http://stackoverflow.com/comment/42277272
favorite count: 0

http://stackoverflow.com/comment/42391554
type: Comment
comment on: http://stackoverflow.com/a/26921345
type: AnswerComment
has text: at the way i cloned my LinkedList is that right. When it compiled it worked
score: 0

http://stackoverflow.com/comment/42261320
type: Comment
comment on: http://stackoverflow.com/q/26849245
type: QuestionComment
has text: Don't describe your code. Post it. If it's too large, then provide a minimal example showing the problem: it doesn't have to crawl anything as that is irrelevant to your question.
score: 0

http://stackoverflow.com/comment/42282673
type: Comment
has text: Yes. It inherent in the entire concept of a "Service". A Service call is a complete, logical unit in the business sense, with nothing missing, nothing added. A DAO method is merely the vehicle for achieving this, and it is a mechanical consideration. In theory, a DAO could easily be swapped for something accesses a file system, or multiple DAOs which access one or more databases.
comment on: http://stackoverflow.com/a/26860882
score: 1
type: AnswerComment

http://stackoverflow.com/a/26987603
has comment: http://stackoverflow.com/comment/42546037
has comment: http://stackoverflow.com/comment/42550228
answers question: http://stackoverflow.com/q/26987396
score: 0
has body: I don't exactly know what you're trying to archieve, but it seems you're just trying to fill a char array randomly with X and O and a chance factor, in this case there's a much more simple solution public static void assignCellTypes(char[][] tissue, int percentO, int percentX) { double chanceO = percentO / (double) ( percentO + percentX ); Random r = new Random(); //java.util.Random for(int i=0; i &lt; tissue.length; i++) for(int j=0; j &lt; tissue[i].length; j++) if( r.nextDouble() &lt;= chanceO ) tissue[i][j] = 'O'; else tissue[i][j] = 'X'; } EDIT @comment, I think this is what you want to achieve: public static void assignCellTypes(char[][] tissue, int percentO, int percentX) { if(percentO + percentX &gt; 100) throw new Exception("You can't have more than 100%!"); double chanceO = percentO/100d; double chanceX = percentX/100d; Random r = new Random(); //java.util.Random for(int i=0; i &lt; tissue.length; i++) for(int j=0; j &lt; tissue[i].length; j++) { double random = r.nextDouble(); if( random &lt;= chanceO ) tissue[i][j] = 'O'; else if( random &lt;= chanceO + chanceX ) tissue[i][j] = 'X'; } }
has comment: http://stackoverflow.com/comment/42536065
type: Answer
has comment: http://stackoverflow.com/comment/42526678

http://stackoverflow.com/q/26984954
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/40154080
tagged with: webclient
score: 2
has answer: http://stackoverflow.com/a/33128237
tagged with: java
has body: I have created a client to connect to external webservice. This was done by using wsimport to generate the artifacts and then copied the java classes in my existing web application. I have tomcat on my workstation and this projects deploys and functions perfectly in this environment. But as soon as I deploy the same to weblogic servers I get the below error. Can you please help me understand the problem and its potential solution. java.util.ServiceConfigurationError: javax.xml.ws.spi.Provider: Provider weblogic.wsee.jaxws.spi.WLSProvider could not be instantiated: java.lang.ClassCastException at java.util.ServiceLoader.fail(ServiceLoader.java:207) at java.util.ServiceLoader.access$100(ServiceLoader.java:164) at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:353) at java.util.ServiceLoader$1.next(ServiceLoader.java:421) at javax.xml.ws.spi.Provider.getProviderUsingServiceLoader(Provider.java:180) at javax.xml.ws.spi.Provider.provider(Provider.java:140) at javax.xml.ws.Service.&lt;init&gt;(Service.java:92) Thanks in advance!
tagged with: wsimport
tagged with: jax-ws
has comment: http://stackoverflow.com/comment/42529628
type: Question
tagged with: weblogic
has title: JAXWS Client ServiceConfigurationError on weblogic
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43926851
favorite count: 0

http://stackoverflow.com/q/26939050
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42426718
tagged with: spring-mvc
tagged with: stored-procedures
tagged with: java
has comment: http://stackoverflow.com/comment/42422416
has comment: http://stackoverflow.com/comment/42422757
linked to: http://stackoverflow.com/q/1233910
type: Question
has body: hi is it posible to create a stored procedure that have a subquery and a union statement i have a query like this that i want to convert it in a stored procedure so i can get the values that return the query in a arraylist in spring mvc i 'm talking about a query like this: select a,b,c,d from table1, table2 where a=b ... and not exists ( select null from .. where ..... ) union SELECT .... from .... where ...
has title: doing a oracle stored procedure for a query that have subquerys
score: 0
tagged with: oracle-database
tagged with: sql
linked to: http://stackoverflow.com/q/3400058
has comment: http://stackoverflow.com/comment/42423872

http://stackoverflow.com/comment/42377771
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26914365
has text: Use a `TreeMap` and provide your own `Comparator` that orders by integer value.
type: Comment

http://stackoverflow.com/comment/42508836
comment on: http://stackoverflow.com/q/26988287
score: 0
has text: Good question @fge, that's an oversight on my part
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42321450
score: 0
type: AnswerComment
has text: yes you can & that will get same effect & your code will be more reliable. Actually use of "synchronized" is like best practice & it will guarantee 100% that you will never get more that one instance.
type: Comment
comment on: http://stackoverflow.com/a/26882718

http://stackoverflow.com/q/26914737
tagged with: java
tagged with: selenium
has title: How to Make Firefox Driver Same as if Firefox Manually Opened
has body: I've noticed that opening Firefox with a profile using Selenium Webdriver has many differences from opening Firefox manually with the same exact profile. The home page does not load in the Selenium Webdriver driver, non-boolean settings in about:config can't be modified ... to name a couple differences. Is there a way to get Selenium Webdriver to open Firefox drivers to be exactly the same as if you opened Firefox manually? EDIT: Here is my current code for sanity check purposes ... File profileDirectory = new File("C:\\Users\\[UserName]\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\cox74xm7.default"); FirefoxProfile ffprofile = new FirefoxProfile(profileDirectory); WebDriver ffdriver = new FirefoxDriver(ffprofile);
type: Question
has answer: http://stackoverflow.com/a/26918473
answer count: 2
tagged with: firefox
downvote count: 0
has answer: http://stackoverflow.com/a/26914807
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: selenium-webdriver
score: 2
linked to: http://stackoverflow.com/q/26913518

http://stackoverflow.com/q/26919156
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/26919397
answer count: 1
downvote count: 0
tagged with: jersey-2.0
tagged with: jax-rs
favorite count: 0
tagged with: rest
type: AnsweredQuestion
has body: I'm in a current situations in which I have a REST endpoint that accepts POST of incoming JSON messages. The thing is that I don't think I can specify the POJO object so Jackson can marshall the JSON into the POJO object. Reason for this is that I don't have control of what comes to that endpoint, and number of fields and type can change over time, thus, defining a POJO before hand seems not an option. So I guess the question is....can I simply tell Jackson to don't do any marshalling and give the String of the response? I can deal with that later with JSONObject-JSONArray or Gson maybe. Say I'd have a method like this: @POST @Path("/callback") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response facebookUpdate(String json) { //Do something with the json response... } If this is not feasible with Jersey-JAX...any other alternatives? Thanks! Alejandro
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/42396641
type: Question
accepted answer: http://stackoverflow.com/a/26919397
has title: Using JERSEY and JACKSON to parse a POST request with unknown structure
has comment: http://stackoverflow.com/comment/42387225

http://stackoverflow.com/comment/42319493
score: 0
type: Comment
has text: The `ReflectionToStringBuilder` class only allows you to exclude fields, not change the way they are printed. You could instead use the `ToStringBuilder` class to define how to print a `Person` from within the `toString()` method.
type: QuestionComment
comment on: http://stackoverflow.com/q/26842222

http://stackoverflow.com/a/26936234
score: 45
has comment: http://stackoverflow.com/comment/78253816
type: Answer
accepted answer of: http://stackoverflow.com/q/26935821
has comment: http://stackoverflow.com/comment/42418937
has comment: http://stackoverflow.com/comment/42417012
has comment: http://stackoverflow.com/comment/42418102
has body: Sure, RxJava supports .map which does this. From the RxJava Wiki: Basically, it'd be: loginObservable() .switchMap( someData -&gt; fetchUserDataObservable(someData) ) .map( userData -&gt; cacheUserData(userData) ) .subscribe(new Subscriber&lt;YourResult&gt;() { @Override public void onCompleted() { // observable stream has ended - no more logins possible } @Override public void onError(Throwable e) { // do something } @Override public void onNext(YourType yourType) { displayUserData(); } });
answers question: http://stackoverflow.com/q/26935821
has comment: http://stackoverflow.com/comment/42419260
type: AcceptedAnswer
downvote count: 0
upvote count: 45
has comment: http://stackoverflow.com/comment/42421752
has comment: http://stackoverflow.com/comment/89761421

http://stackoverflow.com/a/26942308
score: 0
answers question: http://stackoverflow.com/q/26942178
type: Answer
has body: Why not used java.util.LinkedList? It has an iterator method that returns an iterator. import java.util.Iterator; import java.util.LinkedList; public class SListIterator{ public static void main(String[] args){ LinkedList&lt;Integer&gt; list = new LinkedList&lt;Integer&gt;(); list.add(0); list.add(1); list.add(2); list.add(3); Iterator&lt;Integer&gt; iter = list.iterator(); while(iter.hasNext()){ System.out.println(iter.next()); } } }

http://stackoverflow.com/comment/42413531
type: Comment
type: QuestionComment
score: 0
has text: Perhaps try one of these? http://stackoverflow.com/questions/15047744/gae-cloud-endpoints-api-not-updating-after-deploy http://stackoverflow.com/questions/17706437/cannot-access-api-explorer-on-localhost
comment on: http://stackoverflow.com/q/26910933

http://stackoverflow.com/q/26879840
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42316457
type: Question
tagged with: jstl
has comment: http://stackoverflow.com/comment/42316445
has body: In my contoller i have a map object like below. Map&lt;String, Object&gt; model = new HashMap&lt;String, Object&gt;(); Map&lt;TblProjectPhase, List&lt;TblProjectResource&gt;&gt; result=new HashMap&lt;TblProjectPhase,List&lt;TblProjectResource&gt;&gt;(); model.put("userList", result); i am going to check the List TblProjectResource value is empty like below. &lt;c:when test="${model.userList.size()&gt;0}"&gt; &lt;c:forEach var="user" items="${model.userList}"&gt; &lt;c:if test="${not empty user.value}"&gt; hello &lt;/c:if&gt; &lt;/c:when&gt; The problem of the above approach is hello prints more than one.How to i check List this list size is greater than zero without using foreach. Any Ideas will be greatly appreciated!!!!
score: 0
has comment: http://stackoverflow.com/comment/42316433
has title: How to check the hashmap value is present or not in jstl
has comment: http://stackoverflow.com/comment/42316561
answer count: 0
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/42316625
has comment: http://stackoverflow.com/comment/42316384
has comment: http://stackoverflow.com/comment/42316341

http://stackoverflow.com/q/26964746
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42467390
has comment: http://stackoverflow.com/comment/42467217
has answer: http://stackoverflow.com/a/26968105
tagged with: java
has title: Java Runtime.getRuntime().exec() with Linux not working
type: Question
answer count: 2
has body: So, I've been developing an application in Java, for Windows, Linux and Mac. It uses commandline applications to compress/decompress some data, and as I try to make it work with wine, I cant seem to have any luck, neither have I found any questions solving the issues I have. This is how I call the commandline: Runtime.getRuntime().exec(command).waitFor(); command is the string that is the completed command. Here is few things I've tried: wine "/path/to/executable" "/path/to/argument" /bin/bash -c wine "/path/to/executable" "/path/to/argument" /bin/bash -c "wine "/path/to/executable" "/path/to/argument"" startx wine "/path/to/executable" "/path/to/argument" startx /bin/bash -c wine "/path/to/executable" "/path/to/argument" xterm -e wine "/path/to/executable" "/path/to/argument" xterm -e /bin/bash -c wine "/path/to/executable" "/path/to/argument" All of the above (aside from startx) do work on the Terminal of Linux, and none do with Java. At this point, I am pretty clueless as to what to do. I cant figure this out at all, and am just confused. I am not very familiar with Linux either, so it just adds more confusion. Just for reference, here is example of what I'd use to try to run first example command: Runtime.getRuntime().exec("wine \"/path/to/executable\" \"/path/to/argument\"").waitFor(); EDIT: I found out my issue is using quotation marks, removing them allowed me to use most above commands, however I also need to ensure that paths with spaces are supported. Any ideas? I also switched to using ProcessBuilder, and made a custom parser to fit my needs.
tagged with: terminal
score: 0
tagged with: linux
has comment: http://stackoverflow.com/comment/42467285
has answer: http://stackoverflow.com/a/26965116

http://stackoverflow.com/comment/42268706
has text: As far as i understood (if i have many jar @ one directory and i need to add all of them) it should be like this: `code` FRAMEWORK_LIB */ `code`
type: Comment
comment on: http://stackoverflow.com/a/26853008
score: 0
type: AnswerComment

swagger-ui
tag name: swagger-ui
tags question: http://stackoverflow.com/q/26932187
type: Tag
tags question: http://stackoverflow.com/q/26988363

http://stackoverflow.com/comment/42475744
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26963738
has text: I haven't tried this yet but two things spring out at me just looking at the code (and I am no means an experts so please correct me if I'm wrong). Firstly - it appears to require root access which I don;t have and don't want to gain. Secondly it still appears to be calling the ICMP requests sequentially in a for loop rather than calling multiple requests at the same time but I may be misunderstanding the code. Have I interpreted this correctly or am I off base here?
type: AnswerComment

http://stackoverflow.com/q/26961685
has comment: http://stackoverflow.com/comment/42472764
tagged with: 32-bit
has comment: http://stackoverflow.com/comment/42462326
upvote count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
tagged with: audio
has title: Is there any way to play back a 24-/32-bit audio stream using Java on Windows?
tagged with: windows-7
answer count: 0
has comment: http://stackoverflow.com/comment/42464213
tagged with: java
type: Question
has body: Like the title says, this seems to be a problem. Basically I'm writing a small application for comparing audio with different bit quantizations; I realize there is little actual "need" to go beyond 16 bits because it should be perceived as near perfect with regards to dynamic range anyway, but the point of my application is to present its user with a first hand experience demonstrating this amongst other things (yes it is part of a paper I'm writing at my university). Anyway, it appears that audio formats with any variation of 24- or 32-bits are considered not supported by the JAPI on Windows 7 (and, I presume from reading other posts about this, on other Windows versions as well). My main reason for choosing Java for this project was its potential for platform independent deployment. I could understand if this was a problem with Windows or the target computer's installed hardware itself, but it isn't - my sound card is well capable of working with these bit depths; to further move away from the "it's a Windows problem" approach, a small test project written in C# did at least not have any problems playing back signed / unsigned 24-bit integer audio streams, though 32-bits wouldn't work. Thus it would seem that the problem may be the actual implementation of the Java Sound API on Windows; is there any alternative sound API that may be used (and that preferably is cross-platform as well) should this be the case? Or may it be that I'm missing something else? Thankful for any replies, Husbjörn

http://stackoverflow.com/comment/42385182
comment on: http://stackoverflow.com/a/26918307
type: AnswerComment
type: Comment
has text: @lenhuy2106 you are wrong they are both O(1) operations!
score: 2

http://stackoverflow.com/comment/130330052
type: AnswerComment
score: 0
type: Comment
has text: I doubt this compiles. Once corrected, how is it better than [nem035's 2014 answer](https://stackoverflow.com/a/26876861/3789665)?
comment on: http://stackoverflow.com/a/34811107

http://stackoverflow.com/comment/42280560
comment on: http://stackoverflow.com/q/26851812
score: 0
type: Comment
type: QuestionComment
has text: It does run on Android, but you obviously added the wrong Smack artifacts to your Android project. Please read the 4.1 Readme

http://stackoverflow.com/comment/42450858
score: 0
comment on: http://stackoverflow.com/a/26952122
type: Comment
has text: Thanks for your input. I've choosen a somewhat different path. By implementing a custom UserDetailsService class you can get rid of the sql in your security conf.
type: AnswerComment

http://stackoverflow.com/comment/42701804
type: Comment
comment on: http://stackoverflow.com/a/26858629
type: AnswerComment
score: 0
has text: Hey guys, I used your advice and made a lot of progress with the rest of my work! I posted a new question on a part which I'm having difficulty with. I would appreciate it if you can check it out and let me know what you think on how I can go about it. Thanks and thanks for the help on this one as well!

http://stackoverflow.com/a/26956255
has body: sum+=no; will accumulate the sum of all the numbers ever entered. You should store the last two numbers entered in two variables, and only sum those two. int last = 0; int beforeLast = 0; do { menu(); option=input.nextInt(); switch (option) { case 1: System.out.print("Please enter a number between 0 and 20 : " ); no=input.nextInt(); beforeLast = last; last = no; break; case 2: System.out.println("The Sum of the Numbers is : " + (last+beforeLast)); default : System.out.print("Invalid option"); } } while (option !=5);
accepted answer of: http://stackoverflow.com/q/26956242
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42452875
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26956242
has comment: http://stackoverflow.com/comment/42452834

http://stackoverflow.com/comment/42470905
has text: What kind of exception? Do you have a stacktrace?
comment on: http://stackoverflow.com/q/26966972
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42307331
type: QuestionComment
has text: `y.length%2` - tell me what this is.
comment on: http://stackoverflow.com/q/26874754
score: 0
type: Comment

http://stackoverflow.com/a/26840645
type: AcceptedAnswer
has body: Strings are ordered alphabetically by default. You need to implement your own Comparator&lt;String&gt;. Try below comparator public class CustomComparator implements Comparator&lt;String&gt; { @Override public int compare(String str1, String str2) { int num1 = Integer.parseInt(str1.substring(1,str1.length())); int num2 = Integer.parseInt(str2.substring(1, str2.length())); return num1 - num2; } } Run with your input public static void main(String[] args) { String[] a = {"A11","A10", "A1" ,"A2", "A3", "A4"}; Arrays.sort(a,new CustomComparator()); System.out.println(Arrays.asList(a).toString()); } Output [A1, A2, A3, A4, A10, A11]
type: Answer
has comment: http://stackoverflow.com/comment/42245890
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26840220
score: 1
answers question: http://stackoverflow.com/q/26840220
upvote count: 1

http://stackoverflow.com/q/26861296
score: 0
has comment: http://stackoverflow.com/comment/42282967
answer count: 1
tagged with: selenium-webdriver
has title: JAVA: How can we print the parameter value in console?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42283012
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/26863062
has comment: http://stackoverflow.com/comment/42285977
has body: Class1:has a reusable function like this- public class Class1 { WebDriverWait wdw = new WebDriverWait(driver, 10); public WebElement getElement(WebElement element) { wdw.until(ExpectedConditions.elementToBeClickable(element)); } } Class2: public class Class2 { public static void main(String[] args) { ge.getElement(login_button).click(); } } Now how can I get "login_button" print in console (with some more message)if this element not present on page or timed out etc I have tried: Class1: public class GetElement { WebDriverWait wdw = new WebDriverWait(driver, 10); public WebElement getElement(WebElement element) { try { return wdw.until(ExpectedConditions.elementToBeClickable(element)); } catch (Exception e) { System.err.println(element); } return null; } } But printing this element gives this in console: Proxy element for: org.openqa.selenium.support.pagefactory.DefaultElementLocator@57250572 instead of login_button

http://stackoverflow.com/a/26880744
score: 0
answers question: http://stackoverflow.com/q/26879529
has body: &lt;script type="text/javascript" &gt; function doClick(){ alert("Hai"); } &lt;/script&gt; &lt;script type="text/javascript" src="js/jquery-1.4.2.min.js"/&gt; &lt;script type="text/javascript"&gt; function doClicks(){ alert("Hai"); } &lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="css/style.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="../css/style.css" /&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;%@taglib prefix="s" uri="/struts-tags"%&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;title&gt;Home page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;center&gt; &lt;input type="button" onclick="doClick()" value="Click sp"/&gt; &lt;input type="button" onclick="doClicks()" value="Click js"/&gt; &lt;table width="921" height="529" border="0"&gt; &lt;tr&gt; &lt;td height="143" colspan="2" id="header"&gt;&amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="37" colspan="2" id="link"&gt; &lt;center&gt; &lt;div&gt; &lt;a href="admin"&gt;Home&lt;/a&gt; &lt;/div&gt; &lt;div&gt; &lt;a href="admin_page1"&gt;Service1&lt;/a&gt; &lt;/div&gt; &lt;div&gt; &lt;a href="admin_page2"&gt;Service2&lt;/a&gt; &lt;/div&gt; &lt;div&gt; &lt;a href="out"&gt;Logout&lt;/a&gt; &lt;/div&gt; &lt;/center&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="313" height="298" class="body"&gt;&lt;/td&gt; &lt;td width="693" class="body"&gt;Service1&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="33" colspan="2"&gt;&lt;div align="center"&gt;copyright@2013&lt;/div&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/center&gt; &lt;/body&gt; &lt;/html&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;%@taglib prefix="s" uri="/struts-tags"%&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;…
type: Answer

http://stackoverflow.com/comment/42338584
type: QuestionComment
type: Comment
has text: If you're simply trying to reverse you'll do fine without the inner loop.
comment on: http://stackoverflow.com/q/26892229
score: 0

http://stackoverflow.com/a/26909230
score: 1
has body: You need to define a List&lt;BankAccount&gt; to your Person2 entity: public class Person2 { private String pnr; private String name; // list of bank accounts (from 0 to n) the Person can have. private List&lt;BankAccount&gt; accounts; //Koppla konto till pnr public void addAccount(BankAccount a){ if (accounts = null) accounts = new ArrayList&lt;BankAccount&gt;(); accounts.add(a); } //Skapa Pnr och Namn public void setPnr(String newPnr) { pnr = newPnr; } public void setName(String newName){ name = newName; } // Hämta Pnr och Namn public String getPnr(){ return pnr; } public String getName(){ return name; } // include getters setters } EDIT1: as suggested by @NathanCastlehow if you want double relationship, BankAccount.java must have a Person2 attibute public class BankAccount { private String bnr; private double balance; // one bank account can only be owned by a single Person private Person2 person; public void credit() { } public void withdraw(){ } public String getBnr(){ return bnr; } public void setBnr(String newAccount){ bnr = newAccount; } // generate getters setters public Person2 getPerson(){ ...... } }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26909112
downvote count: 0

http://stackoverflow.com/q/26900345
has comment: http://stackoverflow.com/comment/42353387
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26900433
score: 0
tagged with: nested
has title: Java Programming nested loops
has body: So I have most of my code written, but there's one part of the assignment that I don't understand. Write a program that will accept a number (n) from the user to represent the size of a board (nxn). If the user does not enter a number greater than 1, prompt the user over and over until he/she gives valid input. Once valid input is obtained, print a board with every other column filled with 1s along with the last row filled with 1s. Zeros everywhere else. Your board will have an equal number of rows and columns based on the users input. I have it to do the pattern with the 0's and 1's but I don't understand how I can get the last row to have all 1's. Here is my code posted below import java.util.Scanner; public class question1 { public static void main(String[]args) { Scanner input = new Scanner(System.in); int n; System.out.println("Please input a value for the board greater than 1."); n= input.nextInt(); while(n&lt;1) { System.out.println("Error, please enter a value greater than 1"); n=input.nextInt(); } for(int i=0; i&lt;n; i++) { for(int j=0; j&lt;n; j++) { if(j%2==0) { System.out.print(0); } else { System.out.print(1); } if(i==n) { System.out.print(1); } } System.out.println(' '); } } }
has answer: http://stackoverflow.com/a/26900457
accepted answer: http://stackoverflow.com/a/26900457
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26900433
tagged with: java
tagged with: loops

http://stackoverflow.com/comment/42234193
comment on: http://stackoverflow.com/a/26833714
has text: I understand why that would work extremely well for 3, however, how would it work for a larger number, such as 6 or 7? I have not learned recursion yet, so I apologize if my question seems stupid.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42326812
comment on: http://stackoverflow.com/q/26885853
score: 0
type: Comment
type: QuestionComment
has text: `System.out.println(fileID);` This will only ouput some cryptic objectID of the Array ...

http://stackoverflow.com/comment/42458424
comment on: http://stackoverflow.com/q/26953789
has text: I changed it to filename instead of absolutepath...
score: 0
type: Comment
type: QuestionComment

geotools
type: Tag
tags question: http://stackoverflow.com/q/26935862
tags question: http://stackoverflow.com/q/26882297
tag name: geotools

http://stackoverflow.com/q/26921971
type: Question
has answer: http://stackoverflow.com/a/26922042
has comment: http://stackoverflow.com/comment/42391745
answer count: 1
downvote count: 0
favorite count: 0
tagged with: path
accepted answer: http://stackoverflow.com/a/26922042
linked to: http://stackoverflow.com/q/3224606
tagged with: environment
tagged with: opencv
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42399102
has title: why do we add bin directory to the path inside Environment Variables?
score: 1
tagged with: bin
tagged with: java
has body: Often times I found myself editing Path in Environment Variables for the purpose of installation some new library files into the Operating System for e.g adding Java jdk bin or OpenCv Bin into the Path inside Environment Variables. My question is what benefit does this bring to the operating system and how does it help ; other than the fact that I am able to compile the java files through command prompt after this?
upvote count: 1

http://stackoverflow.com/q/26968625
possible better answer: http://stackoverflow.com/a/26968722
upvote count: 2
has answer: http://stackoverflow.com/a/26968722
has answer: http://stackoverflow.com/a/26968731
favorite count: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/26968725
has title: Shared data between threads not right
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
has answer: http://stackoverflow.com/a/26968725
type: Question
has body: I have a problem with a program of mine. The sum data is shared between multiple Threads. Its supposed to give the sum after each Thread adds onto that. public class ThreadPractise implements Runnable { Integer num; String name; volatile Integer commonSum; Object lock; public ThreadPractise(Integer i,String threadName ,Integer sum, Object sharedLock) { num = i; name = threadName; commonSum =sum; lock = sharedLock; } @Override public void run() { Integer cube = calculate(num); update(cube); System.out.println(Thread.currentThread().getName()+" has commonSum after update as "+commonSum); } public void update(Integer cube) { synchronized (lock) { this.commonSum = this.commonSum + cube; System.out.println(Thread.currentThread().getName()+" has commonSum as "+commonSum); } } public int calculate(Integer num2) { return (num2*num2*num2); } public static void main(String[] args) { Integer sum = new Integer(0); Object lock = new Object(); for(int i=1;i&lt;=3;i++) { Thread t = new Thread(new ThreadPractise(i, "Thread"+i, sum,lock)); t.start(); try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } } System.out.println("Sum of 1^3+2^3+3^3 = "+sum); } } However the sum is always 0. When i am changing to AtomicInteger its working but i need the problem with this implementation. Also please tell me if the Thread locking i am doing is right.
tagged with: java

http://stackoverflow.com/q/26984591
answer count: 2
has comment: http://stackoverflow.com/comment/42504477
tagged with: android
has comment: http://stackoverflow.com/comment/42503220
has answer: http://stackoverflow.com/a/26984782
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42503182
type: Question
has title: Android app not recognizing auto completed words on device
has body: I recently created an app that took user input from an Edittext field and compares it to a predefined string. in the emulator it works perfect but when I put it on my android device and test it there, it seems to not recognize words that were auto-completed by the device (i.e. when i type in part of the word suggestions are filled in and selected by me). It compares false when it should be true. Why is this happening? is there an xml tag i can integrate that takes away the auto-suggest feature for the edit text field? here is what my edit text xml looks like: &lt;EditText android:id="@+id/st5ans" android:layout_width="@dimen/form_width" android:layout_height="@dimen/input_height" android:textSize="@dimen/statenamesize" android:layout_marginTop="@dimen/maingamespaceing" android:layout_toRightOf="@id/state5" android:autoText="false" android:gravity="center" android:layout_below="@id/st4ans" android:background="@android:color/white" /&gt; I compare them like this: EditText ans1 = (EditText)findViewById(R.id.st1ans); EditText ans2 = (EditText)findViewById(R.id.st2ans); EditText ans3 = (EditText)findViewById(R.id.st3ans); EditText ans4 = (EditText)findViewById(R.id.st4ans); EditText ans5 = (EditText)findViewById(R.id.st5ans); EditText[] ans={ans1, ans2, ans3, ans4, ans5}; int count=0; int number=0; String feed=""; //this loop tallys up all of our correct answers and then builds // feedback for wrong answers to give to //the user, using our data hashmap for (EditText y : ans) { String temp=y.getText().toString(); if(temp.equalsIgnoreCase(data.get(stats[number%stats.length].getText().toString()))) { count += 1; } else { if (firstpass) { feed += " The capitol of " + drawlist.get(drawn.get(number)) + " is " + data.get(drawlist.get(drawn.get(number))) + " " + "\n"; } else { feed += " "+drawlist.get(drawn.get(number))+ " is the capitol of "+ data.get(drawlist.get(drawn.get(number))) + " " + "\n"; } } number += 1; } temp being the Edittext value to string (String temp=y.getText…
has answer: http://stackoverflow.com/a/26984811
accepted answer: http://stackoverflow.com/a/26984811
tagged with: java
possible better answer: http://stackoverflow.com/a/26984782
score: 0

http://stackoverflow.com/comment/42239972
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26837178
has text: If in understand you well, you want to instantiate `Object Two` in the view? If so, why this?

http://stackoverflow.com/a/26951948
has body: Will Deployment Rule Sets Allow JNLP To Run Without Signing Jars? I've never heard of 'Deployment Rule Sets' but if anything allowed an unsigned Jar to run (short of the user manually adjusting the security level in the console), it would be a security bug.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/51087173
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26940080

http://stackoverflow.com/q/26959855
upvote count: 1
has answer: http://stackoverflow.com/a/26961580
accepted answer: http://stackoverflow.com/a/26961580
favorite count: 0
tagged with: postgresql
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42458242
has title: Hibernate creating wrong create table statement?
downvote count: 0
has comment: http://stackoverflow.com/comment/42458372
has answer: http://stackoverflow.com/a/26961785
type: Question
has comment: http://stackoverflow.com/comment/42458328
score: 1
tagged with: java
tagged with: hibernate
has body: It's my first time configuring hibernate. I've read many tutorials but not sure why this is creating the wrong create table sql statement. I am using PostgreSQL as my database. hibernate.cfg.xml <?xml version="1.0" encoding="utf-8"?> <hibernate-configuration> org.hibernate.dialect.PostgreSQL9Dialect org.postgresql.Driver jdbc:postgresql://DBIP:5432/MYDB MYDB MYPASS true create true <mapping class="MYPROJ.model.User"/> </hibernate-configuration> User.java package MYPROJ.model; import javax.persistence.*; @Entity public class User { @Id @GeneratedValue @Column(name = "id") private int id; @Column(name = "username") private String username; @Column(name = "age") private int age; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } } Main.java public class Main { public static void main(String[] args) { User user = new User(); user.setId(1); user.setAge(20); user.setUsername("david"); SessionFactory sessionFactory; ServiceRegistry serviceRegistry; Configuration configuration = new Configuration(); configuration.configure(); serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build(); sessionFactory = configuration.buildSessionFactory(serviceRegistry); Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(user); session.getTransaction().commit(); System.out.println("Done!"); } } When I run the program it shows the following SQL statement for creating the table which does not work when I run the program or when I copy pasted it manually create table User (id int4 not null, age int4, username varchar(255), primary key (id)) What am I doing wrong here?
possible better answer: http://stackoverflow.com/a/26961785
answer count: 2

http://stackoverflow.com/a/26911516
has comment: http://stackoverflow.com/comment/42372793
upvote count: 5
score: 4
answers question: http://stackoverflow.com/q/26911328
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42373436
accepted answer of: http://stackoverflow.com/q/26911328
type: Answer
has comment: http://stackoverflow.com/comment/42373157
has comment: http://stackoverflow.com/comment/42373115
has body: public static void Print(int n) { for (int i = n; i &gt; 0; i--) { System.out.print(i); if (i == 1) { System.out.print("="); continue; } System.out.print("x"); } } And the output: Enter an integer: 4 4! is equal to 4x3x2x1=24.0
downvote count: 1

http://stackoverflow.com/comment/42248616
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26841894
has text: from where you are calling place(); method

http://stackoverflow.com/comment/42474799
comment on: http://stackoverflow.com/a/26969280
type: Comment
score: 1
type: AnswerComment
has text: or just `return name.equals(otherMyClass.name);`

http://stackoverflow.com/comment/42258481
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26844944
type: Comment
has text: The second error resolved using a boolean flag `clearOnKeyPress`.

remote-debugging
tag name: remote-debugging
type: Tag
tags question: http://stackoverflow.com/q/26836461

http://stackoverflow.com/comment/42258725
has text: Why do you declare all those variables in `payment`? It's not necesary! With an efective interest rate `r` and a number of periods `n` you have all you need: `return (1 - Math.pow(1+r, -n)) / r;`!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26847896

http://stackoverflow.com/comment/42477539
comment on: http://stackoverflow.com/q/26970501
score: 0
type: Comment
type: QuestionComment
has text: This is how it is. (Name & Emp No\r\n Jack Doe 1234\r\n John 12345\r\n Dob : 28/12/1987\r\n)

http://stackoverflow.com/comment/42641319
type: Comment
has text: No it actually returns the Bean that was selected in your case Ananlyte. Please do a POC, if you want, I will share mine :) The itemID is nothing but the Bean in case of BeanItemContainer.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/26987358

http://stackoverflow.com/comment/42441924
score: 0
has text: Yeah, I considered Netty and Apache Mina and the former was too complicated and too full of features I didn't need. The latter didn't give much control.
type: AnswerComment
comment on: http://stackoverflow.com/a/26950332
type: Comment

http://stackoverflow.com/comment/42471069
type: Comment
type: QuestionComment
has text: Your question sounds like it may in fact be an [XY Problem](http://mywiki.wooledge.org/XyProblem) where you ask "how do I fix this code" when the real solution is to use a different approach entirely. Better perhaps would be that you tell us the overall problem that you're trying to solve rather than how you're currently trying to solve it.
comment on: http://stackoverflow.com/q/26967020
score: 2

http://stackoverflow.com/a/26879470
has body: (\d\d:\d\d:\d\d(?:(?!\d\d:\d\d:\d\d).)+) Try this.See demo. http://regex101.com/r/tF5fT5/42
score: 1
accepted answer of: http://stackoverflow.com/q/26879447
has comment: http://stackoverflow.com/comment/42315935
answers question: http://stackoverflow.com/q/26879447
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42315699
has comment: http://stackoverflow.com/comment/42315851
type: Answer
has comment: http://stackoverflow.com/comment/42315890
upvote count: 1
has comment: http://stackoverflow.com/comment/42315942
has comment: http://stackoverflow.com/comment/42315841

http://stackoverflow.com/a/26846759
upvote count: 2
has comment: http://stackoverflow.com/comment/42727197
has body: Below is an example of what Luca is describing: <batch:split id="stepA" task-executor="taskExecutor"> </batch:split> <batch:split id="stepB" task-executor="taskExecutor"> </batch:split> <batch:split id="stepC" task-executor="taskExecutor"> </batch:split>
answers question: http://stackoverflow.com/q/26838555
downvote count: 0
type: Answer
score: 2

http://stackoverflow.com/q/26870988
type: Question
score: 0
has answer: http://stackoverflow.com/a/26871324
answer count: 1
has title: How to correctly call method from jsf to ManagedBean
type: AnsweredQuestion
has body: well I'm learning jsf/hibernate and I'm having trouble understanding how to correctly call methods to my ManagedBean its a simple CRUD so I need to pass vía the jsf form a Ciclista object, but since the inputs are Ciclista attributes how do I pass the Object ? (how to create instance of it) here's the code: @Override public String create(Ciclista c) { Session s = sFac.openSession(); s.beginTransaction(); s.save(c); s.getTransaction().commit(); s.close(); return "Administrador?faces-redirect=true"; } and jsf form: &lt;h:form class="form"&gt; &lt;div id="input-wrapper"&gt; &lt;h:inputText class="inputs" value="#{ciclistaBeanDB.nombre}" /&gt; &lt;h:inputText class="inputs" value="#{ciclistaBeanDB.nacionalidad}" /&gt; &lt;h:inputText class="inputs" value="#{ciclistaBeanDB.equipo}" /&gt; &lt;/div&gt; &lt;h:commandButton class="btn" action="#{ciclistaBeanDB.create()}" value="Create" /&gt; &lt;/h:form&gt; I get error: method not found because i don't pass the Ciclista c object in crear(//here) since i don't have the object per se, just its attributes how do I proceed ??
tagged with: jsf
accepted answer: http://stackoverflow.com/a/26871324
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/26867742
tagged with: abstract-class
type: UnansweredQuestion
has body: There is a provision in Java to achieve abstract class. Then how do I achieve in Ruby? Abstract Class /* File name : Employee.java */ public abstract class Employee { private String name; private String address; private int number; public Employee(String name, String address, int number) { System.out.println("Constructing an Employee"); this.name = name; this.address = address; this.number = number; } public double computePay() { System.out.println("Inside Employee computePay"); return 0.0; } public void mailCheck() { System.out.println("Mailing a check to " + this.name + " " + this.address); } public String toString() { return name + " " + address + " " + number; } public String getName() { return name; } public String getAddress() { return address; } public void setAddress(String newAddress) { address = newAddress; } public int getNumber() { return number; } } Extending Abstract Class: /* File name : Salary.java */ public class Salary extends Employee { private double salary; //Annual salary public Salary(String name, String address, int number, double salary) { super(name, address, number); setSalary(salary); } public void mailCheck() { System.out.println("Within mailCheck of Salary class "); System.out.println("Mailing check to " + getName() + " with salary " + salary); } public double getSalary() { return salary; } public void setSalary(double newSalary) { if(newSalary &gt;= 0.0) { salary = newSalary; } } public double computePay() { System.out.println("Computing salary pay for " + getName()); return salary/52; } }
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/512466
type: Question
tagged with: inheritance
score: 0
duplicate of: http://stackoverflow.com/q/512466
has comment: http://stackoverflow.com/comment/42299237
has title: how to achieve abstract class functionality in ruby
has comment: http://stackoverflow.com/comment/42295063
tagged with: ruby

http://stackoverflow.com/comment/42410738
comment on: http://stackoverflow.com/a/26919959
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the link, I wasn't familiar with the "static utility class" lingo. Useful idea, I'll implement it that way since I have no reason to instantiate.

http://stackoverflow.com/q/26923716
has body: I am working on Hadoop. My output is coming twice than expected. I unable to understand why this is happening. Please help me Below is the mapper class : import java.io.File; import java.io.IOException; import java.util.Scanner; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*; public class StringMapper extends MapReduceBase implements Mapper&lt;LongWritable, Text, Text, IntWritable&gt; { //hadoop supported data types private static IntWritable send; private Text word; //map method that performs the tokenizer job and framing the initial key value pairs public void map(LongWritable key, Text value, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException { String line = value.toString(); String out=""; int count=0; out+=Integer.toString(count); send = new IntWritable(1); word = new Text(out); output.collect(word, send); } } Below is the reducer class import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.io.*; import org.apache.hadoop.mapred.*; public class StringReducer extends MapReduceBase implements Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { //reduce method accepts the Key Value pairs from mappers, do the aggregation based on keys and produce the final output public void reduce(Text key, Iterator&lt;IntWritable&gt; values, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException { int sum=0; while(values.hasNext()){ sum=sum+values.next().get(); } output.collect(key, new IntWritable(sum)); } } Sample input : dashjdasdhashjfsda dashjdasdhashjfsda dashjdasdhashjfsda dashjdasdhashjfsda dashjdasdhashjfsda Sample output 0 10 Here output should be 0 5 instead of 0 10, because there are only five lines in my input.
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/26924305
tagged with: java
tagged with: mapreduce
has comment: http://stackoverflow.com/comment/42395617
tagged with: hadoop
score: 2
type: AnsweredQuestion
downvote count: 0
has title: Unexpected output in Mapreduce program in Hadoop
favorite count: 0
has answer: http://stackoverflow.com/a/26924305
type: Question

http://stackoverflow.com/q/26914327
answer count: 1
tagged with: simpledateformat
tagged with: java
accepted answer: http://stackoverflow.com/a/26914486
has title: Timezone and SimpleDateFormat strange behavior
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/91267752
downvote count: 0
score: 1
favorite count: 0
type: Question
tagged with: timezone
tagged with: datetime
has answer: http://stackoverflow.com/a/26914486
has body: if I execute this code: String data = "08/02/1941"; SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date date = dateFormat.parse(data); I have in output the date: Sat Feb 08 01:00:00 CEST 1941 instead if I execute this code: String data = "08/02/1971"; SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); Date date = dateFormat.parse(data); the date is: Sat Feb 08 01:00:00 CET 1971. Why do I have this difference (CET and CEST)? My timezone is Europe/Berlin (UTC+1) and I'm using Java 1.7.0_67-b01
has comment: http://stackoverflow.com/comment/42377803
upvote count: 1

http://stackoverflow.com/comment/42399971
type: Comment
comment on: http://stackoverflow.com/a/26926850
has text: @PeterLawrey I switched the order around, and I think I fixed the issue you're referring to. What compile error though?
type: AnswerComment
score: 1

http://stackoverflow.com/comment/42428383
type: QuestionComment
comment on: http://stackoverflow.com/q/26925625
has text: you may want to take a look @ map utils library which will help calculate distance in meters. Conversion should not be a problem https://developers.google.com/maps/documentation/android/utility/#spherical
score: 0
type: Comment

http://stackoverflow.com/q/26990024
answer count: 2
tagged with: arrays
has body: Take a look at the following code used for constructing a card deck. I was using the The xFactor "variable" (hard coded) to subtract 1 off the array size to adjust for the zero index. I noticed that I could actually subtract a total of 40 before I encountered a 'java.lang.ArrayIndexOutOfBoundsException: 12' error. If I enter 39 as the xFactor, it runs perfectly fine. It constructs the entire deck, all 52 cards, although strangely, cards.length will equal deckTotal - xFactor on BOTH sides of the for each loop?!? That doesn't make sense because it would need to reach an index of 51 in order to construct the entire deck, which it does... public void constructDeck(){ int deckTotal = SUITS.length * CARDS_PER_SUIT; System.out.println(deckTotal); // 52 Card[] cards = new Card[deckTotal - xFactor]; System.out.println(cards.length); // Prints deckTotal - xFactor for(String cardSuit : SUITS){ int cardNum = 1; while(cardNum &lt;= CARDS_PER_SUIT){ String cardDesc = cardDescription(cardNum); int cardValue = cardNum; if(cardNum &gt;= VALUE_CEILING){ cardValue = VALUE_CEILING; } cards[cardNum -1] = new Card(cardDesc,cardSuit,cardValue); this.deck.addCard(cards[cardNum -1]); //System.out.println(cardDesc + " of " + cardSuit + " added to the deck"); cardNum++; } } System.out.println(cards.length); // prints: deckTotal - xFactor } The only thing I can think is that memory is being trimmed off the start of the array to make room new cards being added to the back. So that would mean the ArrayIndexOutOfBoundsException is really just a function of how quickly my computer can process the loop and/or collect the garbage. I only wrote this code to test a really basic assignment for an intro to Java class. Coming from a JS background, declaring the size of an array before you use it seems a little odd to begin with (although I get why). The behavior here was really unexpected though, and I'm curious what is happening behind the scenes. Update: Thank you for the advice. Here's my final code b…
tagged with: size
accepted answer: http://stackoverflow.com/a/26990084
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42511753
has answer: http://stackoverflow.com/a/26990330
type: Question
has title: Java Arrays: Unexpected behavior regarding size?
possible better answer: http://stackoverflow.com/a/26990330
has answer: http://stackoverflow.com/a/26990084
tagged with: capacity
score: 0

http://stackoverflow.com/comment/43660979
comment on: http://stackoverflow.com/a/26948996
type: AnswerComment
has text: what is the difference between `someField.class` and `someField.getClass()` ?
score: 0
type: Comment

http://stackoverflow.com/comment/42281921
type: QuestionComment
comment on: http://stackoverflow.com/q/26860462
has text: Why while(y != q.length)? Maybe while(y <= q.length)?
score: 0
type: Comment

http://stackoverflow.com/q/26954914
type: Question
has title: java how to iterate through json object to get keys AND values
score: 0
type: UnansweredQuestion
has body: I'M searching for a solution to a problem, that, from my understanding, should be fairly common. I have a bunch of json objects with different keys (some represent a user, some a text by the user, some a place). Now what I need to do is, create a dataset in my key-value store db (happens to be an embedded neo4j) for every json object to come in - I need to use the java interface not the rest interface. The problem is, I do not know the json layout (names of keys) during compile time - well of course I do know them for each object type, but I don't want to write a bunch of methods for each and every object type but rather a generic method. So I thought, well, no big deal, I just create an entry with the key being the json-key and the value being the json-value. BUT, I can't, for the sake of whatever, find a solution to iterate over a json structure and retrieve the key-names. Every solution I found so far, expects the keynames to be known in advance to get the value. Is there any way of doing so??? Is this such a rare situation? I would have expected this to be quite a common a task. Can anyone help??? Thanks in advance, Chris
answer count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: loops
has comment: http://stackoverflow.com/comment/42449641
has comment: http://stackoverflow.com/comment/42449650

http://stackoverflow.com/a/26944869
has comment: http://stackoverflow.com/comment/71900587
upvote count: 6
has body: There already exists a class (BitSet) in the standard library to help you do this, you should use that instead of a boolean array. The class allows you to get and set bits and to various logical operations on your boolean values as a group. eg. BitSet bits = BitSet.valueOf(bytes); boolean third_bit = bits.get(3); bits.set(5, false); byte[] new_bytes = bits.toByteArray(); If you really need to use a boolean array then the following will work. static boolean[] toBooleanArray(byte[] bytes) { BitSet bits = BitSet.valueOf(bytes); boolean[] bools = new boolean[bytes.length * 8]; for (int i = bits.nextSetBit(0); i != -1; i = bits.nextSetBit(i+1)) { bools[i] = true; } return bools; } static byte[] toByteArray(boolean[] bools) { BitSet bits = new BitSet(bools.length); for (int i = 0; i &lt; bools.length; i++) { if (bools[i]) { bits.set(i); } } byte[] bytes = bits.toByteArray(); if (bytes.length * 8 &gt;= bools.length) { return bytes; } else { return Arrays.copyOf(bytes, bools.length / 8 + (bools.length % 8 == 0 ? 0 : 1)); } }
type: Answer
score: 6
has comment: http://stackoverflow.com/comment/60516406
has comment: http://stackoverflow.com/comment/60513418
answers question: http://stackoverflow.com/q/26944282
downvote count: 0

http://stackoverflow.com/comment/42336084
comment on: http://stackoverflow.com/q/26891113
score: 2
has text: Better fit for codegolf.se.....
type: Comment
type: QuestionComment

design-patterns
tags question: http://stackoverflow.com/q/26935845
tags question: http://stackoverflow.com/q/26986278
tags question: http://stackoverflow.com/q/26862117
tag name: design-patterns
tags question: http://stackoverflow.com/q/26984983
tags question: http://stackoverflow.com/q/26894245
tags question: http://stackoverflow.com/q/26955166
tags question: http://stackoverflow.com/q/26874513
tags question: http://stackoverflow.com/q/26952373
tags question: http://stackoverflow.com/q/26980486
tags question: http://stackoverflow.com/q/26854068
tags question: http://stackoverflow.com/q/26958073
type: Tag
tags question: http://stackoverflow.com/q/26884881
tags question: http://stackoverflow.com/q/26966960
tags question: http://stackoverflow.com/q/26919811
tags question: http://stackoverflow.com/q/26853249
tags question: http://stackoverflow.com/q/26932394
tags question: http://stackoverflow.com/q/26911867
tags question: http://stackoverflow.com/q/26951932
tags question: http://stackoverflow.com/q/26919612
tags question: http://stackoverflow.com/q/26890405
tags question: http://stackoverflow.com/q/26949503
tags question: http://stackoverflow.com/q/26925073
tags question: http://stackoverflow.com/q/26935997
tags question: http://stackoverflow.com/q/26946728
tags question: http://stackoverflow.com/q/26931651
tags question: http://stackoverflow.com/q/26890747

http://stackoverflow.com/q/26894670
score: 1
tagged with: java
tagged with: substring
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/44990616
has answer: http://stackoverflow.com/a/44990616
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/26894706
upvote count: 1
type: AnsweredQuestion
has body: in java, String month= "November 2014"; for making a substring giving the index from right hand side, I cannot use someString.substring(-4); as negative values are not supported. Is there any simple implementation I can use to achieve this.
accepted answer: http://stackoverflow.com/a/26894706
has title: implementation for java substring with negative values

http://stackoverflow.com/a/46385883
downvote count: 0
has comment: http://stackoverflow.com/comment/117749713
has body: See this "java.nio.file.AccessDeniedException" it says all. Give permissions to the gassfish folder. sudo chmod -R 777 /wherever-the-folder-is/glassfish-folder
type: Answer
answers question: http://stackoverflow.com/q/26931211
upvote count: 5
score: 5

http://stackoverflow.com/a/26941099
type: Answer
score: 3
downvote count: 0
upvote count: 3
type: AcceptedAnswer
has body: You are misunderstanding where java and javascript run. You use &lt;% and %> as if that sends values to the server, which it does not. those tags are used only inside the jsp to start snippets of java code. This only works while you are generating the page. Once your html is at your browser, these tags will not do anything. Highlighting important keywords, this is not intended as sarcarsm When you request a jsp page with your browser, the browser opens a network connection to the server. Think of these 2 (browser, server) as living in 2 completely different places. The server then runs the java code. When it executes, it generates an html page. This html page is sent back across the network connection to the client (your browser) Your browser will receive this fully formed html page and use it to create it's view. On this page you can run javascript but the javascript will only run on the client (browser) To get any variable back to the server again, you will need to either: get or post a form (using a submit inside a form tage, or use JavaScript post request like a form submit) , do an ajax call (http://www.javascriptkit.com/dhtmltutors/ajaxgetpost.shtml) or have the user click a link (a href="...your page"). The easiest way is to do: &lt;form method="POST" action="your/page/url"&gt; &lt;input type="hidden" name="someName" value="someValue" /&gt; &lt;input type="submit" /&gt; &lt;/form&gt; read some of the links and make sure you keep in mind, your browser and the server are separated, so running javascript in your browser will not reach the server.
accepted answer of: http://stackoverflow.com/q/26940739
answers question: http://stackoverflow.com/q/26940739

http://stackoverflow.com/q/26914446
type: Question
has comment: http://stackoverflow.com/comment/42378291
accepted answer: http://stackoverflow.com/a/26914614
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26914582
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/42379301
tagged with: random
possible better answer: http://stackoverflow.com/a/26914582
favorite count: 0
has title: ArrayList contains
has comment: http://stackoverflow.com/comment/42378014
has comment: http://stackoverflow.com/comment/42378507
type: AnsweredQuestion
has body: I don't really understand what's happening, if someone could explain this to me that would be great. So, here's my code: public static ArrayList&lt;Integer&gt; numbers = new ArrayList&lt;Integer&gt;(); public static void main(String[] args){ for(int i =0; i != 90; i++){ System.out.println(generate()); } } public static int generate(){ Random random = new Random(); int rand = random.nextInt(89)+1; while(numbers.contains(rand)){ //&lt;---Here seems to be my problem rand = random.nextInt(89)+1; System.out.println("Number: " + rand + " already exists!"); } numbers.add(rand); return rand; } I am writing a program that generates a random number from 0-90, each of which are different to the last. Unfortunately, it seems that the while loop only returns true.
downvote count: 3
has answer: http://stackoverflow.com/a/26914614

http://stackoverflow.com/q/26855676
has answer: http://stackoverflow.com/a/27033336
has comment: http://stackoverflow.com/comment/42578148
has comment: http://stackoverflow.com/comment/42310778
has comment: http://stackoverflow.com/comment/42281450
tagged with: java
type: Question
has body: I wish to import a series of data from excel to my table through adf. I follow the way of this blog(http://technology.amis.nl/2010/09/16/adf-11g-import-from-excel-into-an-adf-table) yet still fail to do so. Any suggestion? I can't even simple call valueChangeEvent from from value change listener on my page. Below is my code ADF Page: &lt;af:panelGroupLayout id="pgl2"&gt; &lt;af:inputFile label="File:" id="if1" valueChangeListener="#{uploadTelephoneUsageBean.fileUploaded}" autoSubmit="true"/&gt; &lt;af:commandButton text="Upload" id="cb1" actionListener="#{uploadTelephoneUsageBean.check_file_upload}"/&gt; &lt;/af:panelGroupLayout&gt; Request Scope Manage Bean: public void fileUploaded(ValueChangeEvent valueChangeEvent) { // Add event code here... UIComponent Temp_uic=valueChangeEvent.getComponent(); Temp_uic.processUpdates(FacesContext.getCurrentInstance()); FacesContext.getCurrentInstance().renderResponse(); System.out.println("Check value change "); try { UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue(); parseFile(file.getInputStream()); AdfFacesContext.getCurrentInstance().addPartialTarget(valueChangeEvent.getComponent()); eventADF=valueChangeEvent; } catch (IOException e){ e.printStackTrace(); } } No syntax error message showing. I can't view "Check value change". Any idea regarding this issues?
has title: ADF Import Data From Excel Into ADF Table
accepted answer: http://stackoverflow.com/a/27033336
score: 0
answer count: 1
tagged with: oracle-adf
has comment: http://stackoverflow.com/comment/42587932
type: AnsweredQuestion

http://stackoverflow.com/comment/42400822
type: QuestionComment
has text: any one line solution?
comment on: http://stackoverflow.com/q/26927301
score: 0
type: Comment

http://stackoverflow.com/a/45744343
score: 0
answers question: http://stackoverflow.com/q/26956546
has body: I believe this only works with JSF 2.0 . JSF 2.0 adds implicit variables to make resolving components easier. like disabled="#{myBackingBean.canEditAttachment(component.id)}" If you are working with outdated legacy code that uses JSF lower than 2.0, this will not work.
type: Answer

http://stackoverflow.com/q/26938414
tagged with: macos
favorite count: 0
has answer: http://stackoverflow.com/a/26938545
upvote count: 7
has title: Code sign Java app for OS X Gatekeeper
type: AnsweredQuestion
has body: I am trying to distribute a Java application to OS X users. I am not using the Mac store - it is to be distributed through my own website. Whatever I try, OS X's Gatekeeper rejects the app. Here's my method: (1) Build the app as usual, get a JAR file (2) Use appbundler as described here: https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html. This creates a .app around my JAR which runs nicely, and contains the JVM in the MyApp.app/Contents/PlugIns directory. (3) Sign the app with my Developer certificate: codesign -s 'Developer ID Application: MyCompany Ltd' --deep MyApp.app ...process completes successfully (4) Verify that the .app will adhere to Gatekeeper's iron-fist laws: spctl --assess --verbose=4 --type execute MyApp.app ...and the result I get back is: MyApp.app: a sealed resource is missing or invalid Doesn't seem very verbose to me! What could I be doing wrong? Or how can I get more information? SO/Google searches around 'a sealed resource...' refer to signing frameworks (which I don't have) or suggest signing with the --force option (which I tried but doesn't work).
score: 7
tagged with: java
tagged with: osx-gatekeeper
type: Question
tagged with: app-bundle
downvote count: 0
tagged with: code-signing
accepted answer: http://stackoverflow.com/a/26938545
answer count: 1

http://stackoverflow.com/comment/42286430
score: 0
type: Comment
type: QuestionComment
has text: That depends a whole lot on the technical details of your MVC framework. How does the conroller order changes on the View in general? Does the View subscribe to events from the Controller? Because that would be the best practice. In that case you'd just need to define an `error` event.
comment on: http://stackoverflow.com/q/26863292

http://stackoverflow.com/comment/42464396
type: QuestionComment
score: 0
has text: You know you are using [ASCII](http://en.wikipedia.org/wiki/ASCII#ASCII_control_code_chart) for the subtraction. If you want to use integer subtraction then use int res2 = Integer.parseInt(Character.toString(combinaison.charAt(i))) - Integer.parseInt(Character.toString(coup.charAt(i)))
comment on: http://stackoverflow.com/q/26963230
type: Comment

http://stackoverflow.com/a/27071818
score: 1
upvote count: 1
has body: The count of the files in processeddir was the problem. So we were getting this (seemingly confusing) FileNotFoundException because there were too many files in the target directory. After we archived a big subset of these files into a compressed (but single) file, the exception disappeared.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26912219
answers question: http://stackoverflow.com/q/26912219

http://stackoverflow.com/comment/42363905
type: QuestionComment
comment on: http://stackoverflow.com/q/26906530
score: 0
has text: @StephenC that's what I wanted to know, I was wondering if appart for the readability and personnal preference, the "else if" statement was more efficient
type: Comment

http://stackoverflow.com/comment/42520285
has text: @brunodahora You have to specify the field name.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26948551

http://stackoverflow.com/q/26939152
has comment: http://stackoverflow.com/comment/56948973
accepted answer: http://stackoverflow.com/a/26939682
tagged with: java
possible better answer: http://stackoverflow.com/a/26939208
has body: From : https://developer.android.com/training/material/lists-cards.html I want to set RecyclerView in widget on home screen. Is it possible, and if it is, how to do it? Give some samples please.
has title: How to set RecyclerView in android widget
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26939208
downvote count: 0
favorite count: 0
type: Question
score: 14
tagged with: android
has answer: http://stackoverflow.com/a/26939682
linked to: http://stackoverflow.com/q/29051733
tagged with: view
upvote count: 14
tagged with: widget
answer count: 2
tagged with: android-recyclerview

http://stackoverflow.com/comment/49316800
comment on: http://stackoverflow.com/a/30600986
type: AnswerComment
score: 0
type: Comment
has text: So is that basically a similar process, but rather a different folder you are copying the .so file to?

http://stackoverflow.com/q/26960158
type: Question
has answer: http://stackoverflow.com/a/26960269
has comment: http://stackoverflow.com/comment/42458808
has answer: http://stackoverflow.com/a/35309187
score: 0
has comment: http://stackoverflow.com/comment/42458811
tagged with: random
answer count: 3
has answer: http://stackoverflow.com/a/26960238
tagged with: for-loop
has comment: http://stackoverflow.com/comment/42458800
has comment: http://stackoverflow.com/comment/42458783
has comment: http://stackoverflow.com/comment/42458767
tagged with: while-loop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42458671
has comment: http://stackoverflow.com/comment/42458794
has comment: http://stackoverflow.com/comment/42458749
has body: Hey guys I need help with this project I'm working on, I want to limit the things I use to for loops and do/while loops. I've been working on it a while and I am still confused with what I am doing. Here is what I have so far. public class Array2 { public static void main(String[] args) { int[] array1= new int[10]; int x=0; int num=0; do { for(int i=0; i&lt;array1.length; i++) { int j= 2 + (int)(Math.random() * (99-1)); if(i==0) { array1[i]=j; } else { if(j==array1[i-1]) { x++; } else array1[i]=j; } System.out.println(array1[i]); num++; } }while(x==0&amp;&amp;num&lt;array1.length); } I understand that this code does not work, I am looking for a solution so that when x is set equal to 1 that it just sets j equal to a different random number and checks again if it is a repeating number or not. I also want to know how to check j for a repeating number instead of doing if(j==array1[i-1] because that only checks the previous array slot. Please help! Edit: My main question right now is how to check if j is equal to any of the numbers in array1, right now I have if(j==array1[i-1]) but that only checks the previous slot. Thanks
has comment: http://stackoverflow.com/comment/42458758
tagged with: java
has title: Non Repeating Random Numbers Array Java, for/do/while loop
has comment: http://stackoverflow.com/comment/42458722

http://stackoverflow.com/a/26856286
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26856099
has body: A component can only reside within a single container. Each time you add the component to another container, it is first (effectively) removed from it's current parent. You can't re-use empty the way you are. CardLayout can not manage multiple containers, it is responsible for the management of a single container. My "gut" feeling would be to create a separate custom class extending from JPanel which had a show method which would allow you to show the named component. This panel would use it's own CardLayout and manage its internal state. This would allow you a jumping of point for adding additional content as required...
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/26856099

http://stackoverflow.com/comment/42328777
type: Comment
type: AnswerComment
has text: yes ROUND in that context is very strange but I don't understand, why without ROUND the sum is not correct.
comment on: http://stackoverflow.com/a/26886949
score: 0

http://stackoverflow.com/comment/42470144
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26966472
has text: @KickButtowski It surely does looks confusing, but different issue. Seems more like design issue rather than compiler error.
type: Comment

http://stackoverflow.com/comment/42318078
type: QuestionComment
has text: Your output corresponds to printing an array of strings, but your code prints individual strings. Delete all compiled class files and rebuild everything.
score: 0
comment on: http://stackoverflow.com/q/26880962
type: Comment

http://stackoverflow.com/a/31753179
answers question: http://stackoverflow.com/q/26928976
type: Answer
accepted answer of: http://stackoverflow.com/q/26928976
upvote count: 14
has body: Recently Google has released a new support library based on Material Design Guideline. The Codepath details the same components in this post. The library can be already used with Gradle adding the following line in build.gradle: dependencies { ... compile 'com.android.support:design:25.3.1' } This is a simple example of usage: &lt;android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_add" android:layout_gravity="bottom|end" /&gt; See more FloatingActionButton example with Support Library.
score: 14
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42446075
score: 0
type: Comment
has text: Your stacktrace is incomplete. When you paste errors, please make sure you include as much detail as is relevant - it saves time when debugging. For example, here you've omitted the actual type of exception being thrown. You also haven't included the bit of the code that's actually breaking - you're not referencing any scanner here.
type: QuestionComment
comment on: http://stackoverflow.com/q/26952698

http://stackoverflow.com/q/26844581
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26870018
score: 0
has title: JAX-WS - Soap request null
tagged with: web-services
has comment: http://stackoverflow.com/comment/42273155
type: Question
has comment: http://stackoverflow.com/comment/42297726
tagged with: java
tagged with: jax-ws
tagged with: jaxb
has body: I'm trying to develop a web service to insert data into the database, but testing the service (using soapUI), the object passed as a parameter in the operation is null. The Endpoint : @WebService(name = "IAuthencationService", targetNamespace = "http://cursus-web-services", serviceName = "IAuthencationService") @Service public class AuthenticationEndpoint { @Autowired UserService userService; @Autowired RoleService roleService; @Autowired UserRoleService userRoleService; @WebMethod(operationName = "addRole") @WebResult(name = "int") public Integer addRole( @WebParam(name = "role") Role role){ return roleService.addRole(role); } } The Role entity class: @Entity @Table(name = "role") @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Role", namespace = "http://cursus-web-services", propOrder = { "roleId", "role" }) public class Role extends BaseEntity implements Serializable { /** * */ private static final long serialVersionUID = -4582739221593442099L; @XmlElement(name = "roleId") private Integer roleId; @XmlElement(name = "role") private String role; @Id @Column(name = "ROLE_ID", unique = true, nullable = false) public Integer getRoleId() { return roleId; } public void setRoleId(Integer roleId) { this.roleId = roleId; } @Column(name = "ROLE", nullable = false, length = 25) public String getRole() { return role; } public void setRole(String role) { this.role = role; } }
answer count: 1
has answer: http://stackoverflow.com/a/26870018
tagged with: soap

http://stackoverflow.com/q/26891508
has comment: http://stackoverflow.com/comment/42436817
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/42360297
type: UnansweredQuestion
answer count: 0
has title: Unmarshall XML object List into HashMap with XMLAdapter
has body: I've got the following XML 03290 study_identifier somename name bbRad_BUILD_dem_03290_BUILD_006742.xml <study_cache_dir>somestring</study_cache_dir> The annotations in Demographics2 class are currently like this: @XmlRootElement( name = "demographics" ) public class Demographics2 { @XmlElement( name = "study_cache_dir" ) private String studyCacheDir; @XmlElement( name = "filename" ) private String filename; @XmlElement( name = "field" ) private List<Field2> mutivalueFields; } Field2.java ( simple container ): public class Field2 { @XmlElement( name = "XMLtag") private String xmlTag; @XmlElement( name = "value" ) private String value; } If I unmarshall the XML it works fine, and multivalueFields contains a list of two Field2 objects. What I want is to convert the List< Field2 > to be HashMap< String, Field2 > where the String key will be the xmlTag value from the Field2 object. So far I've tired changing Demographics2 class and using a XmlAdapter as follows: @XmlElement( name = "field" ) @XmlJavaTypeAdapter( MultiValueFieldsAdapter.class ) private Map< String, Field2> mutivalueFields; I thought the adapter should work like this: public class MultiValueFieldsAdapter extends XmlAdapter< List<Field2>, Map<String, Field2>> { @Override public List<Field2> marshal( Map<String, Field2> arg0) throws Exception { // loop all in Map and just add the Field2 objects to a list then // return the list return null; } @Override public Map<String, Field2> unmarshal( List<Field2> arg0 ) throws Exception { // The problem is here arg0 will be emtpy list, unless we make arg0 a Field2 object // it seems to be calling unmarshal for each Field2 object, rather than some list // loop each Field2 and add to Map Map<String, Field2> newMap = new HashMap<String, Field2>( arg.length() ); for ( Field2 f : arg0 ) newMap.put( f.xmlTag, f ); } } My MultiValueFieldsAdapter is wrong, but I also think maybe I have my annotations are incorrect? I can't figure out how it manages to put all the Field2 object…
score: 1
tagged with: java
upvote count: 1
tagged with: jaxb
type: Question
downvote count: 0

http://stackoverflow.com/comment/42311380
score: 0
type: QuestionComment
type: Comment
has text: Hy MadProgrammer! Nice to see you again xD Could you give me a some basic info on Layouts. I read the tutorial on oracle, but I am still not 100% what I am actually doing. For some reason pack() ignores both panels atm. What could cause this? And which Layout would be best for this situation(just two panels under each other).
comment on: http://stackoverflow.com/q/26876827

http://stackoverflow.com/q/26964672
accepted answer: http://stackoverflow.com/a/26967826
linked to: http://stackoverflow.com/q/14421353
favorite count: 0
linked to: http://stackoverflow.com/q/21091536
tagged with: maven
has body: After adding quartz-scheduler to a project, Tomcat's server log is being spammed with the following message: [INFO] [talledLocalContainer] 12:15:06.319 [DefaultQuartzScheduler_QuartzSchedulerThread] DEBUG o.quartz.core.QuartzSchedulerThread - batch acquisition of 0 triggers I'm trying to disable that log message, which repeats every 25-seconds or so. I've been through a number of other answers to this same question, such as: Disable quartz logging stop quartz debug logging log4j Disabling Log4J Output in Java ...and none of the approaches suggested are working. I have the following dependencies declared in pom.xml: org.quartz-scheduler quartz 2.2.1 org.slf4j slf4j-log4j12 1.7.5 And I've added the following log4j.properties settings to my project: log4j.rootLogger=OFF log4j.logger.quartz=OFF log4j.logger.o.quartz=OFF log4j.logger.org.quartz=OFF ...and also the following simplelogger.properties: org.slf4j.simpleLogger.defaultLogLevel=error In addition to attempting the programmatic solution suggested on one of the linked answers, which should disable all logging and goes roughly like: List<Logger> loggers = Collections.<Logger>list(LogManager.getCurrentLoggers()); loggers.add(LogManager.getRootLogger()); for ( Logger logger : loggers ) { logger.setLevel(Level.OFF); } That seems to disable everything except the log message from quartz when it runs. Is there a way to get rid of the log message from quartz, short of modifying the quartz source-code to remove it?
linked to: http://stackoverflow.com/q/571960
tagged with: logging
type: AnsweredQuestion
tagged with: java
tagged with: quartz-scheduler
type: Question
has title: Can't disable quartz-scheduler logging using SLF4J
has answer: http://stackoverflow.com/a/26967826
score: 5
upvote count: 5
answer count: 1
downvote count: 0
tagged with: slf4j

http://stackoverflow.com/comment/42440608
has text: Sure, just use a mode variable that is a String and set it to "MovingBall" or "Shooting" or what have you.
comment on: http://stackoverflow.com/a/26942180
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42454717
score: 0
type: AnswerComment
has text: My mistake, I was thinking about interpret not make... I've just edited the question so that it matches the case. 1. I don't want to use operator overloading because I will be also interpreting expressions with only one 'argument' - like interpet(ExpVar). 2. The behaviours are defined in my interpret function but Scala seems to ignore precedence of more specific methods.
type: Comment
comment on: http://stackoverflow.com/a/26957353

http://stackoverflow.com/q/26981426
has answer: http://stackoverflow.com/a/26981763
has comment: http://stackoverflow.com/comment/42497324
has answer: http://stackoverflow.com/a/26992615
type: UnansweredQuestion
has body: This is the sample of a JSON object. I want to extract the part of it and display those values in a jTable (SWING) in JAVA. Keys as table column names and values as row data respectively. [ { "_id":{ "date":"xxxxxxxx", "time":"xxxxxxx", "inc":"xxxx" }, "DOCUMENTS":[ { "EName":"John", "eAge":"25", "eAddress":"UK" }, { "EName":"Alex", "eAge":"24", "eAddress":"Australia" } ] } ] I want to extract this part. [ { "EName":"John", "eAge":"25", "eAddress":"UK" }, { "EName":"Alex", "eAge":"24", "eAddress":"Australia" } ] I used this way to get the answer. Here jsonstring is the string that contains above data. String[] splits = jsonString.split("DOCUMENTS\":"); String[] splits2 = splits[1].split("\\}]", 2); System.out.println("spilted :"+splits2[0]); but it is giving me the answer as [{"EName":"John","eAge":"25","eAddress":"UK"}, {"EName":"Alex","eAge":"24","eAddress":"Australia" it removed the closed square bracket. How can I get the correct answer? Your help is much appreciated.
upvote count: 1
has comment: http://stackoverflow.com/comment/42497151
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42497429
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42496903
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42496905
has title: Extract a part of the JSON object in JAVA

http://stackoverflow.com/q/26843044
tagged with: sorting
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/26844465
tagged with: http://stackoverflow.com/tag/xml
has body: Greeting. Been searching tool that can sort xml strings in strings.xml correctly but seems can't find good one. Strings example: Exit "Are you sure you want to exit? Click OK to continue" Continue Stop Start Stop Male Female Basically, I need good and fast way to sort string names for such xml file. I've tried Android Tools and plugins for it, but most of them just bugs the file, it sorts all strings and adds text that start with new line in the end. "Click OK to continue" this part of text appears just in the end of file. The only working tool I've found is https://bitbucket.org/jtuc/winmerge2011/issue/31/feature-request-sort-xml-files-for-better which works with Saxon jar. It does job flawlessly except when you have strings options like "formatted="false" and "TEXT". Those options are needed for project so can't remove them. XML Sorter log on file containing such options: Sorting the XML file . . . Error on line 7 of sort.xslt: XTTE1020: A sequence of more than one item is not allowed as the @select attri bute of xsl:sort in built-in template rule Transformation failed: Run-time errors were reported Oops! An error occurred, errorlevel=2. Contact the author for help.
type: UnansweredQuestion
downvote count: 2
upvote count: 1
tagged with: xslt
tagged with: java
score: -1
has title: XML strings sort alphabetically
type: Question
answer count: 1

http://stackoverflow.com/a/26923402
type: Answer
answers question: http://stackoverflow.com/q/26923375
has body: Excel's data import parser is smart enough to skip spaces that are in between quotes.
score: 0

http://stackoverflow.com/comment/42358363
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26903186
has text: Yes, webDS is the datasource

http://stackoverflow.com/comment/42405891
type: QuestionComment
has text: are you sure that you are not Using URI?
comment on: http://stackoverflow.com/q/26929810
score: 0
type: Comment

global-variables
tags question: http://stackoverflow.com/q/26864449
tag name: global-variables
type: Tag

http://stackoverflow.com/a/26874246
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26873878
has body: You should rather learn Java, OOP and other base constructs. If you really insist, you can use labels (to be honest since the advent of structured programming, in the sixties people try not to use GOTO anymore... but if you want to fail a job interview go ahead ;-) ) // ... // label is your label, you can use any text label:{ // ... // here is your GOTO break label; } Side note : it works like a charm, but please don't do it (or at least don't say I'm the one who told you about labels) !

http://stackoverflow.com/comment/42351418
has text: @ajb: yes, I can understand. But I am not getting any clue how to implement. Just thought if I would get any suggestions on how to implement this or any related code snippet, it would be helpful.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26899067

http://stackoverflow.com/a/26956151
has body: You are missing a s.next(); in the given code. while(s.hasNext()){ while(s.hasNextInt()){ A[i] = s.nextInt(); i++; } // here s.next() is missing... s.close(); } Please add the s.next(); statement before the end of second-while loop of your program for proper iteration of your program...
has comment: http://stackoverflow.com/comment/42452552
answers question: http://stackoverflow.com/q/26956100
score: 0
has comment: http://stackoverflow.com/comment/42452366
has comment: http://stackoverflow.com/comment/42452604
type: Answer
has comment: http://stackoverflow.com/comment/42453852
has comment: http://stackoverflow.com/comment/42451910

http://stackoverflow.com/comment/42242293
has text: @Raghu You have to define `isErrorPage` to `true` at the error.jsp in order to have access to the `exception` like this (you may change other parts, this is just an example): `<%@ page isErrorPage="true" import="java.io.*" contentType="text/html"%>`
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26838092

http://stackoverflow.com/a/26896693
has comment: http://stackoverflow.com/comment/42346985
answers question: http://stackoverflow.com/q/26896658
upvote count: 1
has comment: http://stackoverflow.com/comment/42347339
has comment: http://stackoverflow.com/comment/42346959
downvote count: 0
score: 1
has body: Your brackets are mismatched. Here: if(recordAns.equals('n')) System.out.print("\nDid You Receive At Least A D Grade In Pass Irish In The Leaving Cert &lt;y or n&gt;?: "); certAns = input.nextLine(); You need a { after that if. Sometimes these errors can be confusing. Some tips: Start at the line the error is reported on and carefully work backwards, checking for subtle problems. Use a decent editor that can show you matched brackets. Notepad++ is a good choice for a basic editor. If your editor supports auto-indentation, turn it on. You can catch things like this by spotting problems with the indentation. You could also sometimes consider restructuring of the code, if possible, to clarify it a bit. For example, if you want to insist that your entered age is in range: do { System.out.print("\nPlease Enter Your Age: "); age = input.nextFloat(); } while (age &lt; 18 || age &gt;= 35); After that block of code, it's guaranteed that age &gt;= 18 &amp;&amp; age &lt; 35.
type: Answer

http://stackoverflow.com/comment/42344503
type: Comment
comment on: http://stackoverflow.com/a/26881189
has text: http://stackoverflow.com/questions/26895319/applet-shows-up-blank-not-initializing#comment42344143_26895319
score: 0
type: AnswerComment

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/26877982
tags question: http://stackoverflow.com/q/26837034
tags question: http://stackoverflow.com/q/26930429
tags question: http://stackoverflow.com/q/26935903
tags question: http://stackoverflow.com/q/26869196
tags question: http://stackoverflow.com/q/26991786
tags question: http://stackoverflow.com/q/26890162
tags question: http://stackoverflow.com/q/26990486
tags question: http://stackoverflow.com/q/26847251
tags question: http://stackoverflow.com/q/26853974
tags question: http://stackoverflow.com/q/26980676
type: Tag
tags question: http://stackoverflow.com/q/26926943
tags question: http://stackoverflow.com/q/26950104
tags question: http://stackoverflow.com/q/26846317
tags question: http://stackoverflow.com/q/26970110
tags question: http://stackoverflow.com/q/26939577
tags question: http://stackoverflow.com/q/26855244
tags question: http://stackoverflow.com/q/26861306
tags question: http://stackoverflow.com/q/26971528
tags question: http://stackoverflow.com/q/26895582
tags question: http://stackoverflow.com/q/26841307
tags question: http://stackoverflow.com/q/26956258
tags question: http://stackoverflow.com/q/26986177
tags question: http://stackoverflow.com/q/26927419
tags question: http://stackoverflow.com/q/26982531
tags question: http://stackoverflow.com/q/26938871
tags question: http://stackoverflow.com/q/26942666
tag name: html
tags question: http://stackoverflow.com/q/26888579
tags question: http://stackoverflow.com/q/26967648
tags question: http://stackoverflow.com/q/26945137
tags question: http://stackoverflow.com/q/26989159
tags question: http://stackoverflow.com/q/26894282
tags question: http://stackoverflow.com/q/26867413
tags question: http://stackoverflow.com/q/26970449
tags question: http://stackoverflow.com/q/26882245

http://stackoverflow.com/comment/42501554
type: Comment
comment on: http://stackoverflow.com/q/26983784
has text: http://stackoverflow.com/questions/415687/why-are-local-variables-not-initialized-in-java
score: 0
type: QuestionComment

http://stackoverflow.com/a/28822082
answers question: http://stackoverflow.com/q/26849618
type: Answer
has body: Your unsatisfied link error is most likely due to the server not understanding where the appropriate shared objects exist on the filesystem. You will need to have the opencv jar, opencv java shared object, and the opencv shared libraries available to the JVM. This varies depending on your container and OS. You may wish to look at setting "java.library.path" or LD_LIBRARY_PATH.
score: 0

http://stackoverflow.com/q/26908842
tagged with: openjpa
has answer: http://stackoverflow.com/a/26920161
has comment: http://stackoverflow.com/comment/42369205
type: Question
tagged with: java
tagged with: caching
accepted answer: http://stackoverflow.com/a/26920161
downvote count: 0
answer count: 1
favorite count: 0
has title: OpenJPA L2 Cache not caching related objects
score: 2
type: AnsweredQuestion
has body: I have a simple data model which consists of a parent object with a one-to-many relationship to a list of child objects. @Entity public class Client implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @OneToMany(cascade = CascadeType.ALL) private List<Session> sessions; ... } @Entity public class Session implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Column(length = 200) private String location; ... } I have enabled L2 caching using OpenJpa in the persistence.xml: <?xml version="1.0" encoding="UTF-8"?> org.apache.openjpa.persistence.PersistenceProviderImpl java:jboss/datasources/GymTracker za.co.blacklemon.entities.Client za.co.blacklemon.entities.Session ALL <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> <property name="jboss.as.jpa.providerModule" value="org.apache.openjpa"/> <property name="openjpa.DynamicEnhancementAgent" value="false"/> <property name="openjpa.Log" value="File=stdout, DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/> <property name="openjpa.QueryCache" value="true(CacheSize=10000, SoftReferenceSize=1000)"/> <property name="openjpa.DataCache" value="true(CacheSize=20000, SoftReferenceSize=1000)"/> I then get individual clients by calling find and then accessing the list of sessions. The second line here triggers OpenJPA to populate the child objects from the DB: Client client = dao.find(Client.class, id); System.out.println(client.getSessions().size()); The first time this runs there appears two queries in the log, one for the parent object and one each for any children: executing prepstmnt 782097742 SELECT t0.contactNumber, t0.description, t0.firstName, t0.photo, t0.surname FROM Client t0 WHERE t0.id = ? [params=?] executing prepstmnt 626498798 SELECT t1.id, t1.location FROM Client_Session t0 INNER JOIN Session t1 ON t0.SESSIONS_ID = t1.id WHERE t0.CLIENT_ID = ? [params=?] The second time this run…
upvote count: 2

http://stackoverflow.com/comment/42296612
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26863430
has text: @RedBaron : It is easy to have misspelled something (I remember my first answer). You should use the debugger (Netbeans is quite easy for that) with a breakpoint on `String radio = request.getParameter("radios1");` to see exactly what happens.

http://stackoverflow.com/q/26895240
duplicate of: http://stackoverflow.com/q/513832
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26895321
type: Question
has comment: http://stackoverflow.com/comment/42343922
has comment: http://stackoverflow.com/comment/42343913
has body: Okay, I am a newbie java programmer, and am trying to create some java code to read a configuration file that I have created, and return the results. I will give you the code first, then explain what I am trying to do: public static String read(String property, File file) throws IOException{ FileInputStream in = new FileInputStream(file); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String line; String r = "ERROR"; while ((line = br.readLine()) != null) { if(!line.startsWith("//")){ String[] split = line.split(" "); if(split[0] == property){ r = split[1]; } } } br.close(); return r; } This is what the actual configuration file looks like, where "hello" is the property, and "world" is the value: hello world To explain, the desired property is taken as a parameter, as well as the location of theconfiguration file. It will then read each line (ignoring "//") and split it into the property name and value. It will then return the value if it was found, or "ERROR" if the property could not be found. I then run the following code: System.out.println(Property.read("hello", new File("config/confix.txt"))); However, every time I run this code, "ERROR" will be printed. I have checked and re-checked my code, and still can't think of what I have done wrong. Apologies if I have not made myself very clear, so do ask if I need to explain better!
has title: Java: Reading file line by line
answer count: 1
score: 0

http://stackoverflow.com/q/26924136
tagged with: java
tagged with: javafx
has body: I am loading an FXML file the following way FXMLLoader loader = new FXMLLoader(getClass().getResource("register.fxml")); Controller c = new Controller("Welcome to EAST"); loader.setController(c); Scene scene = new Scene(loader.load()); fx.setScene(scene); // fx is a JFXPanel which is used to integrate FX in Swing The above code is working fine, now I want to access the the default values of textFields of the register.fxml in the constructor of Controller Class but It gives and error: Exception in thread "JavaFX Application Thread" java.lang.NullPointerException. Note: I have assigned some default values to the textFields that is why I want to access them. following is My Controller class Controller.java public class Controller { @FXML private TextField username; @FXML private PasswordField pass; @FXML private TextField ip; @FXML private TextField sPort; @FXML private TextField fPort; public Controller(String str) { System.out.println(str); System.out.println(ip.getText()); // this line gives the NullPointerException Error } @FXML private void login() { } @FXML private void register(){ } @FXML private void cancel(){ System.exit(0); } } Any suggestions will be greatly appreciated . Thanks :)
has answer: http://stackoverflow.com/a/26924693
type: Question
answer count: 2
has title: How to access JavaFX components in the constructor of Controller Class
downvote count: 0
favorite count: 0
score: 2
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26924945

http://stackoverflow.com/q/26850095
type: Question
upvote count: 4
answer count: 2
downvote count: 0
score: 4
favorite count: 0
has title: Java 1.7 Override of hashCode() not behaving as I would expect
possible better answer: http://stackoverflow.com/a/26850140
has body: I have a class where I have overridden both the hashCode method as well as the equals method. The equals method behaves as I would expect it to, however the hashCode method does not seem to behave as I would expect. I'm assuming therefor my expectation is incorrect, but not sure why. Below are the overridden methods: public class Car extends SomeBaseClass implements Cloneable, Serializable { private static final long serialVersionUID = 1L; private String id; private String name; private String carName; private String carModel; private String displayTextCar; public boolean equals(Car car) { return (getCarName().equals(car.getCarName()) &amp;&amp; getCarModel().equals(car.getCarModel())); } public int hashCode() { return (this.getCarName() + this.getCarModel()).hashCode(); } Now I have a test class where create two car objects, and call the equals method and then put each instance of car into a HashMap. I set each instance to have the same car Name and Model and calling equals method in fact returns true. However even though each instance returns the same hashCode, when I add them to the HashMap, it keeps two objects int the Map, whereas I would expect the second put to replace the first object in the map ??? Below is the guts of the test class: HashMap&lt;Car,String&gt; testMap; Car testCar1 = new Car(); testCar1.setCarName("DaveCar"); testCar1.setCarModel("DaveModelTest"); System.out.println("Car Hash 1: " + testCar1.hashCode()); Car testCar2 = new Car(); testCar2.setCarName("DaveCar"); testCar2.setCarModel("DaveModelTest"); System.out.println("Car Hash 2: " + testCar2.hashCode()); //hashCodes prints identical numbers System.out.println("Car 1 equal Car 2 ?? " + testCar1.equals(testCar2)); //returns true testMap.put(testCar1, "3"); testMap.put(testCar2, "16"); System.out.println("Map size is " + testMap.size()); //I would expect the size to be 1 here, but it's in fact 2. So this doesn't seem correct to me, I have naturally left some of the code out here, but this is…
tagged with: equals
has answer: http://stackoverflow.com/a/26850139
accepted answer: http://stackoverflow.com/a/26850139
has answer: http://stackoverflow.com/a/26850140
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/27581
tagged with: hashcode
tagged with: java

c++
tags question: http://stackoverflow.com/q/26881251
tags question: http://stackoverflow.com/q/26990902
tags question: http://stackoverflow.com/q/26859707
tags question: http://stackoverflow.com/q/26894558
tags question: http://stackoverflow.com/q/26987071
tags question: http://stackoverflow.com/q/26990125
type: Tag
tags question: http://stackoverflow.com/q/26904342
tags question: http://stackoverflow.com/q/26880953
tags question: http://stackoverflow.com/q/26859056
tags question: http://stackoverflow.com/q/26928776
tags question: http://stackoverflow.com/q/26942748
tags question: http://stackoverflow.com/q/26869974
tags question: http://stackoverflow.com/q/26854186
tags question: http://stackoverflow.com/q/26881861
tags question: http://stackoverflow.com/q/26950004
tags question: http://stackoverflow.com/q/26939755
tags question: http://stackoverflow.com/q/26978791
tag name: c++
tags question: http://stackoverflow.com/q/26980349
tags question: http://stackoverflow.com/q/26838194
tags question: http://stackoverflow.com/q/26963813
tags question: http://stackoverflow.com/q/26840737

contextclassloader
type: Tag
tags question: http://stackoverflow.com/q/26953597
tag name: contextclassloader

http://stackoverflow.com/a/26934057
has comment: http://stackoverflow.com/comment/44203577
has comment: http://stackoverflow.com/comment/44186855
upvote count: 4
answers question: http://stackoverflow.com/q/26933883
has comment: http://stackoverflow.com/comment/42413944
downvote count: 0
has comment: http://stackoverflow.com/comment/44212154
has comment: http://stackoverflow.com/comment/44211511
has body: Too long for a comment, but not an answer. There will be classes. Hopefully many of them. Java naming conventions should be followed, e.g., name methods starting with a lowercase letter. StaffClass is a poor name, instead just use Staff. Consider providing input to it in a different way: as is, Staff can only be populated by its own input methods. But how data gets into a Staff instance should be completely unrelated to what a Staff actually is. There is no "One Right Way" to assemble a Java program from its classes, or even One Right Way to break up responsibilities. But the Single Responsibility Principle is important. Equally important is the notion that methods (and possibly classes) should always operate at the same level of abstraction.
type: Answer
has comment: http://stackoverflow.com/comment/42413884
score: 4

http://stackoverflow.com/comment/42502806
has text: what would you recommend?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26984530
type: AnswerComment

directory
tags question: http://stackoverflow.com/q/26933499
tags question: http://stackoverflow.com/q/26959047
tags question: http://stackoverflow.com/q/26928940
tag name: directory
tags question: http://stackoverflow.com/q/26835094
tags question: http://stackoverflow.com/q/26835522
type: Tag
tags question: http://stackoverflow.com/q/26924700
tags question: http://stackoverflow.com/q/26947287
tags question: http://stackoverflow.com/q/26846862
tags question: http://stackoverflow.com/q/26922142
tags question: http://stackoverflow.com/q/26989477
tags question: http://stackoverflow.com/q/26962727

http://stackoverflow.com/comment/42474641
comment on: http://stackoverflow.com/q/26969125
score: 0
has text: Have you tried translationY instead of margin?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42397309
comment on: http://stackoverflow.com/q/26922551
score: 0
has text: I think JRI is the best option - you can just load the plain R data files with it - no complicated translation needed.
type: Comment
type: QuestionComment

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/26894793
type: Tag

http://stackoverflow.com/comment/42246260
score: 0
has text: Sorry, path is added!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26840117

http://stackoverflow.com/q/26979440
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26979570
downvote count: 0
has answer: http://stackoverflow.com/a/26979570
accepted answer: http://stackoverflow.com/a/26980794
score: 3
has body: So I have several Enums defined like the following. I have a method that uses the Enum to find the value. public enum MyEnum1 { STRING1("My String1"), STRING2("My String2"), STRING3("My String3"), STRINGLESS("String not found"); private String s; private MyEnum1(String s) { this.s = s; } public String getValue() { return s; } } public enum MyEnum2 { STRING1("My String1"), STRING2("My String2"), STRING3("My String3"), STRINGLESS("String not found"); private String s; private MyEnum2(String s) { this.s = s; } public String getValue() { return s; } } public class MyClass1 { public static String getPlacement(String myString) { for (MyEnum1 a: MyEnum1.values()) if (myString.contains(a.toString())) return a.getValue(); return MyEnum1.STRINGLESS.getValue(); } } public class MyClass2 { public static String getPlacement(String myString) { for (MyEnum2 a: MyEnum2.values()) if (myString.contains(a.toString())) return a.getValue(); return MyEnum2.STRINGLESS.getValue(); } } Right now I have 5 Enums defined that all get processed by the same getPlacement method but I had to create 5 different MyClass classes (MyClass2, MyClass3...) with MyEnum2, MyEnum3... hard coded in the For Loop to make it happen. I've tried... public static String getPlacement(Enum e, String myString) {} and public static String getPlacement(Enum&lt;?&gt; e, String myString) {} but neither works. I would like to pass an Enum to the getPlacement method as a parameter thus allowing me to only have one MyClass class that could process the 5 different Enums. Is this possible?
tagged with: generics
favorite count: 0
upvote count: 3
has answer: http://stackoverflow.com/a/26980794
type: AnsweredQuestion
tagged with: enums
tagged with: java
has title: Java Generic Enum as a Parameter

http://stackoverflow.com/comment/42358520
score: 1
has text: Is there any chance you make doc(Document) variable null? Looking at http://developer.android.com/reference/javax/xml/parsers/DocumentBuilder.html#parse(java.io.InputStream), there is no reason parse method returns null document object.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26902338

http://stackoverflow.com/comment/42448296
has text: *"i think you are saying.."* Add a `FocusListener` for the button, and use a search engine to find out how to use it. If you read anything beyond that, it is your own imagination.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26953956

http://stackoverflow.com/q/26987268
upvote count: 1
has answer: http://stackoverflow.com/a/26988469
tagged with: inversion-of-control
favorite count: 0
has comment: http://stackoverflow.com/comment/42507874
has title: NoSuchBeanDefinitionException: No unique bean of type is define. While two beans of same type
tagged with: spring
tagged with: autowired
has comment: http://stackoverflow.com/comment/42508311
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26988120
accepted answer: http://stackoverflow.com/a/26988120
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26988469
has comment: http://stackoverflow.com/comment/42507740
has body: This is first time I am using @autowiring, I have a example. I want to use Autowiring by TYPE , SO that at Run time container injects appropriate Object and calls appropriate bean/method. 1.INTERFACE public interface Calculator { public int add(int a,int b); } 2.First Class public class CalculatorImpl implements Calculator { public int add(int a, int b) { // TODO Auto-generated method stub int result=a+b; return result; } } 3.Second Class public class CalculatorImpl2 implements Calculator{ public int add(int a, int b) { // TODO Auto-generated method stub int result=a-b; return result; } } 4.REST CLASS @Component @Path("/calc") public class CalculationService { @Autowired Calculator calculator; @GET @Path("/add/{a}/{b}/") @Qualifier("calculatorImpl") @Produces("text/plain") public Response serveAdd(@PathParam("a") int a, @PathParam("b") int b) { int result= calculator.add(a, b); return Response.status(200).entity(String.valueOf(result)).build(); } @GET @Path("/sub/{a}/{b}") @Qualifier("calculatorImpl2") public Response serveSub(@PathParam("a") int a, @PathParam("b") int b) { int result= calculator.add(a, b); return Response.status(200).entity(String.valueOf(result)).build(); } } 5.APPLICATION-CONTEXT.xml &lt;context:component-scan base-package="com.veke.rest" /&gt; &lt;bean id="calculatorImpl" class="com.veke.calcImpl.CalculatorImpl" autowire="byType"/&gt; &lt;bean id="calculatorImpl2" class="com.veke.calcImpl.CalculatorImpl2" autowire="byType"/&gt; &lt;/beans&gt; ERROR: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'calculationService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.veke.calc.Calculator com.veke.rest.CalculationService.calculator; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.veke.calc.Calculator] is defined: expected single matching bean bu…

http://stackoverflow.com/a/26854666
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42299619
has comment: http://stackoverflow.com/comment/42299641
answers question: http://stackoverflow.com/q/26853851
has body: Even with the introduction of Java 8 Supplier, there is unfortunately not a succinct one-liner like nCopies. To be honest, I don't know why. (Though @DavidConrad has shown that Stream can do this.) You can easily create one yourself, for example: public static &lt;E, L extends List&lt;? super E&gt;&gt; L fill( L list, Supplier&lt;E&gt; sup, int n) { for(; n &gt; 0; --n) list.add(sup.get()); return list; } Call like: List&lt;List&lt;Integer&gt;&gt; list = ArrayUtils.fill( new ArrayList&lt;&gt;, ArrayList&lt;Integer&gt;::new, 10 ); For arrays, there is the new method Arrays#setAll: Integer[] oneToTen = new Integer[10]; Arrays.setAll(oneToTen, i -&gt; i + 1); List&lt;Integer&gt; asList = Arrays.asList(oneToTen); But it is a void method so it can't be used in a single statement. (Personal remark: why can't Java API be fluid?) Prior to Java 8 there is not a library method to do this and it is more cumbersome to create one. Since clone is protected, it cannot be invoked generically. Reflection can do it but reflection is pretty cumbersome.
upvote count: 1
has comment: http://stackoverflow.com/comment/42299550

http://stackoverflow.com/comment/42370560
has text: That can be simplified with, `return !keycheck;`
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26909236

http://stackoverflow.com/comment/42386333
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26918856
has text: i've refined the questions
score: 0

http://stackoverflow.com/a/26970804
downvote count: 0
has body: Separate the task into two sub-tasks and schedule those separately on their own thread pools. You could have X threads performing download tasks and queuing work onto a job queue and Y processing threads that dequeue work items and process them.
upvote count: 2
answers question: http://stackoverflow.com/q/26970658
type: Answer
score: 2

http://stackoverflow.com/a/26917258
answers question: http://stackoverflow.com/q/26917111
score: 4
has body: Well, here you go: (?:[^\]\[,]+|\[[^\]\[]+\])+ Here is a regex demo. You can find with the pattern matching: Pattern pattern = Pattern.compile("(?:[^\\]\\[,]+|\\[[^\\]\\[]+]\])+"); Matcher matcher = pattern.matcher(str); while (matcher.find()) System.out.println(matcher.group()); This matches all sequences which doesn't contain commas or square brackets. When we come upon square brackets, the group alternates to the right hand side, which matches everything between the square brackets, and returns to the left hand side for matching everything up to the next comma, rinse and repeat, effectively asserting matches without coming upon a disqualifying comma. Here is a jdoodle code demo.
type: Answer
has comment: http://stackoverflow.com/comment/42383969
upvote count: 4
accepted answer of: http://stackoverflow.com/q/26917111
type: AcceptedAnswer
downvote count: 0

dictionary
tags question: http://stackoverflow.com/q/26914365
tags question: http://stackoverflow.com/q/26867366
tags question: http://stackoverflow.com/q/26983658
tags question: http://stackoverflow.com/q/26948200
tags question: http://stackoverflow.com/q/26909750
tags question: http://stackoverflow.com/q/26907795
tag name: dictionary
tags question: http://stackoverflow.com/q/26947183
tags question: http://stackoverflow.com/q/26848606
tags question: http://stackoverflow.com/q/26871483
tags question: http://stackoverflow.com/q/26945192
tags question: http://stackoverflow.com/q/26939613
tags question: http://stackoverflow.com/q/26839643
type: Tag
tags question: http://stackoverflow.com/q/26853139
tags question: http://stackoverflow.com/q/26907926

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/26936271
tag name: maven-jaxb2-plugin

http://stackoverflow.com/a/26863412
has comment: http://stackoverflow.com/comment/42286812
type: Answer
answers question: http://stackoverflow.com/q/26863244
has comment: http://stackoverflow.com/comment/42286550
has comment: http://stackoverflow.com/comment/42286706
has body: You could throw an exception when you get bad input, and either catch it, or allow it to kill the program. However I don't think that is what your teacher is trying to tell you. I think he/she is actually trying to get you to make the program ask (repeatedly) for a valid input if the user enters something invalid. And in fact, that is what the messages you are outputting in the event of an error imply you should be doing. (It is possible to restructure your code so that the main method has a single point of return; i.e. at the end. There are a variety of ways, you could do that. But, if your teacher is asking you to do that, they are not being helpful, IMO.)
score: 0

http://stackoverflow.com/comment/42362733
has text: I forgot to mention that. Thanks for pointing out. Updated the question
comment on: http://stackoverflow.com/q/26905967
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42426750
type: Comment
has text: I guess it would be interesting to see what the `getOneIntersectingObject()` method returns.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26899106

http://stackoverflow.com/a/26942552
has body: Try This : BufferedReader br = new BufferedReader(new FileReader("input.txt")); while((line=br.readline())!=null) System.out.println(line);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26942477

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/26891426
tags question: http://stackoverflow.com/q/26857898
tags question: http://stackoverflow.com/q/26864725
tags question: http://stackoverflow.com/q/26923326
tags question: http://stackoverflow.com/q/26893902
tags question: http://stackoverflow.com/q/26991896
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/26980985
tags question: http://stackoverflow.com/q/26925856
tags question: http://stackoverflow.com/q/26907165
tags question: http://stackoverflow.com/q/26965810
tags question: http://stackoverflow.com/q/26971401
tags question: http://stackoverflow.com/q/26885163
tags question: http://stackoverflow.com/q/26929132

http://stackoverflow.com/comment/42472302
score: 0
comment on: http://stackoverflow.com/a/26924068
type: AnswerComment
has text: `IReport` and `JVM` are two different things. And Sans Serif is not available with `JVM` by default.
type: Comment

http://stackoverflow.com/comment/42456059
comment on: http://stackoverflow.com/q/26958636
type: Comment
type: QuestionComment
score: 0
has text: But what about the casting, is it resource consuming ?

http://stackoverflow.com/comment/42442344
type: Comment
type: QuestionComment
has text: That's the problem. I can't get a hook onto an element in the collection like I did with the example in the post.
comment on: http://stackoverflow.com/q/26950520
score: 0

http://stackoverflow.com/q/26874487
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/26874535
upvote count: 1
has answer: http://stackoverflow.com/a/26874535
type: AnsweredQuestion
tagged with: object
accepted answer: http://stackoverflow.com/a/26874532
has title: Blue J, my listMembers method is not printing off the correct data from my Array List
type: Question
tagged with: bluej
answer count: 3
tagged with: arrays
downvote count: 0
has answer: http://stackoverflow.com/a/26874691
favorite count: 0
has body: When I add a member object from a class called Member to an array list "members = new ArrayList();" within a class called Library, and then try and print off a list of data within the array list I get an error message in the print out: Member@12eb9b8 Member@172d568 The method I am using to add the member objects to the array list is: public void joinMember(Member joinMember) { members.add(joinMember); } And the method I am using to print out all of the data within the array list is: public void listMembers() { for(Member joinMember : members){ System.out.println(joinMember); } } Can anyone please help? I have checked over the code and I cannot work out why it's not printing out the correct data.
has answer: http://stackoverflow.com/a/26874532

http://stackoverflow.com/q/26879503
has answer: http://stackoverflow.com/a/26879883
tagged with: multidimensional-array
tagged with: reference
has body: So I have a 9x9 array representing a Sudoku board. I'd like to be able to break in down into multiple arrays, each referencing the original. For the rows I can simply do int[] row = Board[0]; but how can I do this for the columns? I'd also like to do something similar for the nine 3x3 blocks, but once I figure out the columns I should be fine. I realise that 2d arrays are just 1d arrays of 1d arrays, so I will probably have to iterate through, but I can't seem to get anything to work out. Any help is appreciated. Thank you
type: AnsweredQuestion
tagged with: java
has title: How can I shallow copy columns and subarrays of a 2d array in Java?
has comment: http://stackoverflow.com/comment/42315893
type: Question
accepted answer: http://stackoverflow.com/a/26879883
has comment: http://stackoverflow.com/comment/42315753
possible better answer: http://stackoverflow.com/a/26879644
tagged with: arrays
has answer: http://stackoverflow.com/a/26879644
score: 0
has comment: http://stackoverflow.com/comment/42315894
answer count: 3
has answer: http://stackoverflow.com/a/26880587

http://stackoverflow.com/comment/42422829
comment on: http://stackoverflow.com/q/26939289
type: Comment
has text: Mouse events are contextaul to the component that created them (that is 0x0 is the top left corner of the component). You will need to translate the mouse coordinates to the parent container, assuming you are dragging about within the parent container...
score: 2
type: QuestionComment

http://stackoverflow.com/a/26955256
has comment: http://stackoverflow.com/comment/42450359
has comment: http://stackoverflow.com/comment/42450365
accepted answer of: http://stackoverflow.com/q/26955225
has body: how should I properly set the class up to be collected by the Java garbage collection. You may not need to do anything. If there are no references to the Duel from elsewhere, then the Duel object itself is eligible for garbage collection... and if the Duel is the last thing that refers to the relevant Champion objects (etc) then those will be eligible for garbage collection too. If Champion refers to Duel via a currentDuel field (as it sounds like it does) then if you've got a separate reference to the champions (e.g. you've got a list of champions somewhere) then those champions will prevent the Duel from being garbage collected, until currentDuel is set to a different value. But really, you should be thinking in terms of what's logically useful rather than worrying about garbage collection... presumably once the duel is completed, it makes sense to set currentDuel to null anyway, as the champions are no longer fighting that duel... and at that point, they won't be keeping the Duel alive any more. It's very unlikely that you need to change anything in Duel itself though. If the champions themselves are eligible for garbage collection anyway, then you don't need to worry about the cycle of references between Duel and Champion - that won't prevent garbage collection. The principle in all of this is the question of "Can I still reach the relevant object through any code path from any live thread?" If you can't, then it will be eligible for garbage collection. If you can reach the relevant object, then it won't be garbage collected.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42450258
downvote count: 0
has comment: http://stackoverflow.com/comment/42450178
has comment: http://stackoverflow.com/comment/42450188
score: 8
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/42450242
answers question: http://stackoverflow.com/q/26955225
has comment: http://stackoverflow.com/comment/42457619
has comment: http://stackoverflow.com/comment/42450213
has comment: http://stackoverflow.com/comment/42450172

http://stackoverflow.com/q/26843340
has body: I compiled a wallpaper app from a source code, inserted some 1230x720 pictures, But when I applied the walls using that app, they always get cropped automatically. What should I change in the code to apply at the original size and resolution? Here's an example: 1.Original Picture: https://i.sstatic.net/ziSBt.jpg 2.After applying as an wallpaper using my app: https://i.sstatic.net/19xMQ.jpg Source code: blog.blundell-apps.com/set-phone-wallpaper/ Thanks EDIT: this code in HeavyLifter.java seems to be the culprit, how do I change it to "Fit the screen resolution"? private Bitmap getImage(int resourceId) { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId, null); Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, manager.getDesiredMinimumWidth(), manager.getDesiredMinimumHeight(), true); bitmap.recycle(); bitmap = null; return scaledBitmap; }
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Wallpapers are auto cropped after applying
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26851969
linked to: http://stackoverflow.com/q/15440647
tagged with: wallpaper
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/1016896
tagged with: android
has answer: http://stackoverflow.com/a/26851969
tagged with: http://stackoverflow.com/tag/xml

towers-of-hanoi
tag name: towers-of-hanoi
tags question: http://stackoverflow.com/q/26882472
type: Tag

http://stackoverflow.com/q/26918008
has comment: http://stackoverflow.com/comment/42384810
type: UnansweredQuestion
tagged with: maven
tagged with: soap
answer count: 0
score: 0
tagged with: java
has title: Can I create a jar file out of the classes I import using the top down approach(SOAP) of creating client web-service?
has comment: http://stackoverflow.com/comment/42386066
type: Question
tagged with: ant
has body: I have a SOAP web-service client that I created using a top down approach. I basically have imported all the necessary classes using wsimport. Can I create a jar file out of these downloaded classes and use this jar instead of the the classes I imported (as the classes are large in number)? I tried to create a jar using the command jar cvf name.jar *.class *.java but when I tried to import it into my project -- although the classes are recognized -- I can not import them. So what I am thinking is that I am not using the correct way of making the jar. I tried this command too wsimport -clientjar name.jar wsdl_file but I got the following error: Usage: wsimport [Options] &lt;WSDL_URI&gt; Does anyone have an idea how to do this using ant or maven or any other procedures?
has comment: http://stackoverflow.com/comment/42384982
has comment: http://stackoverflow.com/comment/42387010
tagged with: jar

http://stackoverflow.com/a/26838848
type: Answer
upvote count: 2
has body: The scaleX and scaleY values you are getting are actually cos(1 rad) which is correct. They do not represent the scale of an object after applying affine transformation. As per this documentation, scaleX is the contribution of the initial X coordinate before transform to the final X coordinate after transform. Same goes for scaleY. It doesn't mean that x1 = x0*scaleX, but x1 = x0*scaleX + y0*m01y + m02. To assert that there is no scaling done, you can get the matrix values of the transformation and get the determinant. If there is no scale or shear, the determinant will be 1. Furthermore the 2 components representing displacement should be 0. double[] m = transform.getMatrix() Assert.assertEquals(1, m[0]*m[4] - m[1]*m[3], 0.001) Assert.assertEquals(0, m[2], 0.001); Assert.assertEquals(0, m[5], 0.001);
answers question: http://stackoverflow.com/q/26838424
accepted answer of: http://stackoverflow.com/q/26838424
score: 2
type: AcceptedAnswer
downvote count: 0

communication
tag name: communication
type: Tag
tags question: http://stackoverflow.com/q/26882576

http://stackoverflow.com/comment/42437412
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26947773
has text: Tried that. Changed nothing.
type: Comment

http://stackoverflow.com/comment/42397880
type: AnswerComment
type: Comment
has text: I don't understand the need for two maps. Why not just have the machine id link directly to its associated sessions. eg. `Map<MachineId,List<Session>>` or `Map<MachineId,Set<Session>>`
score: 1
comment on: http://stackoverflow.com/a/26911282

http://stackoverflow.com/comment/42238397
has text: `wrapAnimation` would be a starting point, but what's actually trigger the updates?
comment on: http://stackoverflow.com/q/26836299
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42335341
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26890603
has text: What is this? Somebody arguing with the mighty Jon Skeet?!

http://stackoverflow.com/comment/42281466
comment on: http://stackoverflow.com/a/26860065
type: AnswerComment
type: Comment
has text: It was more a suggestion for voluntary exercise for the OP ;)
score: 1

http://stackoverflow.com/q/26875301
tagged with: notifications
has comment: http://stackoverflow.com/comment/42311360
has body: You can send a desktop notification with JavaFx like this (requires jdk 8u20 or later): package sample; import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.stage.Stage; import org.controlsfx.control.Notifications; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ // Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); Button notifyButton = new Button("Notify"); notifyButton.setOnAction(e -&gt; { Notifications.create().title("Test").text("Test Notification!").showInformation(); }); primaryStage.setTitle("Hello World"); primaryStage.setScene(new Scene(notifyButton, 100, 50)); primaryStage.show(); } public static void main(String[] args) { launch(args); } } But this way you have to create a main window (stage), is it possible to avoid this? I am looking for a way to send notification like using zenity in bash: most of the code is non-gui, but uses some gui elements for informing or interacting with user in a very basic fashion.
tagged with: user-interface
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/42311947
favorite count: 0
has title: Sending notification with javafx without stage
has answer: http://stackoverflow.com/a/26876019
accepted answer: http://stackoverflow.com/a/26876019
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42311251
tagged with: java
tagged with: javafx
type: Question
upvote count: 3

http://stackoverflow.com/comment/86593319
type: AnswerComment
type: Comment
has text: dynamodb-localhost module have some UI bugs, difficult to use
comment on: http://stackoverflow.com/a/38281210
score: 0

http://stackoverflow.com/a/26913356
accepted answer of: http://stackoverflow.com/q/26912953
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26912953
type: Answer
has body: I don't think you want a new list of staff each time you create a new staff memeber so make your ArrayList in staff static public class staff { //blabla private static ArrayList&lt;staff&gt; st =new ArrayList&lt;staff&gt;(); public staff (String StaffID, String StaffPW) { //st = new ArrayList&lt;staff&gt;(); this.StaffID = StaffID; this.StaffPW = StaffPW; //eventually: st.add(this); } public static void thestaff(){ //blabla } //blabla public static ArrayList&lt;staff&gt; getst() { return st; } } This way, you can acces your staff list using staff.gestst() To check your login use a.equals(m) instead of a==m. Don't use == on String. By the way, you should wrote your class names with a capital char.

http://stackoverflow.com/comment/42341507
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26893745
has text: You need a mapping for the servlet, like it says? Which mapping do you expect will map that servlet to a url path?
score: 0

http://stackoverflow.com/comment/42375057
score: 0
type: Comment
has text: Create Read Update Delete - just type of app from the functional approach
comment on: http://stackoverflow.com/a/26911283
type: AnswerComment

http://stackoverflow.com/comment/42406483
type: Comment
has text: Thanks for your answer! In this example (http://stackoverflow.com/questions/4355046/java-insert-multiple-rows-into-mysql-with-preparedstatement) there is stated that I am using a standard SQL syntax.
comment on: http://stackoverflow.com/a/26930615
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42475085
score: 0
type: Comment
has text: I tried the solution, but i still get &quot; when the Soap request is called.
comment on: http://stackoverflow.com/a/26968269
type: AnswerComment

http://stackoverflow.com/q/26857572
has answer: http://stackoverflow.com/a/26858174
has body: How to retrieve a response code for an error page? For successful page I am using getresponsecode method. But for an error page, which method I have to use to get a status code of a response of web application?
has title: Retrieveing status code from a response in java
has answer: http://stackoverflow.com/a/26857624
score: 0
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: http-response-codes
answer count: 2

http://stackoverflow.com/comment/77421293
type: Comment
has text: for [JavaScript binding](https://github.com/SeleniumHQ/selenium/tree/master/javascript/node/selenium-webdriver), it can run without selenium-server. The 3rd point of official selenium doc may not all collect.
comment on: http://stackoverflow.com/a/42130587
type: AnswerComment
score: 0

http://stackoverflow.com/comment/42389660
type: QuestionComment
has text: @JC2188 If it behaves correctly, then you have implemented what you want to do correctly. Currently you are not using reflection, and I'm not sure how you believe you would fit it in here. If you want a general code review, check out http://codereview.stackexchange.com.
score: 0
comment on: http://stackoverflow.com/q/26920663
type: Comment

http://stackoverflow.com/a/59965358
answers question: http://stackoverflow.com/q/26952078
score: 0
type: Answer
has body: in my case the solution was to add the project as maven project, besides the fact that i imported as maven project :P go to pom.xml -> right click -> add as maven project

http://stackoverflow.com/comment/42298861
type: Comment
has text: If all else fails you could try defining your fragment in its own class instead of making it an inner class of the activity.
type: AnswerComment
comment on: http://stackoverflow.com/a/26867863
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/26882839
tags question: http://stackoverflow.com/q/26957028
tags question: http://stackoverflow.com/q/26915620
tags question: http://stackoverflow.com/q/26880241
tags question: http://stackoverflow.com/q/26919616
tags question: http://stackoverflow.com/q/26868168
tags question: http://stackoverflow.com/q/26892717
tags question: http://stackoverflow.com/q/26910019
tags question: http://stackoverflow.com/q/26881013
tags question: http://stackoverflow.com/q/26936721
tag name: tcp
tags question: http://stackoverflow.com/q/26838101

http://stackoverflow.com/a/26969753
has comment: http://stackoverflow.com/comment/42593287
answers question: http://stackoverflow.com/q/26944171
upvote count: 1
has body: All java classes are descendant of the Object class. The Javadoc of Object class defines the general contract for methods equal and hashcode. Extracts : The equals method implements an equivalence relation on non-null object references It is reflexive: for any non-null reference value x, x.equals(x) should return true. It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true. It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true. It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified. For any non-null reference value x, x.equals(null) should return false. The equals method for class Object implements the most discriminating possible equivalence relation on objects; that is, for any non-null reference values x and y, this method returns true if and only if x and y refer to the same object (x == y has the value true). Note that it is generally necessary to override the hashCode method whenever this method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes. These are general java requirements, so you can safely assume that all classes you test respect them. The good part if that Java containers or arrays(*) implement equality in a sense that is coherent with the equality of their elements. EDIT : (*) For arrays equality, you will have to use Arrays.equals() - thanks to Nikolay Ivanov for noting it
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42593467

http://stackoverflow.com/a/26842539
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42249491
has comment: http://stackoverflow.com/comment/42249242
type: Answer
answers question: http://stackoverflow.com/q/26842454
has comment: http://stackoverflow.com/comment/42249636
has comment: http://stackoverflow.com/comment/42249107
downvote count: 0
has comment: http://stackoverflow.com/comment/42289611
accepted answer of: http://stackoverflow.com/q/26842454
has comment: http://stackoverflow.com/comment/42249087
has comment: http://stackoverflow.com/comment/42248968
has comment: http://stackoverflow.com/comment/42249678
has body: If possible, move this code : if (eventModelAdd != null) { new MyAsyncTask().execute(eventModelAdd); } To your dialog's positive button's onClick to make sure the AsyncTask will only be executed when the user click the positive button.
score: 1
has comment: http://stackoverflow.com/comment/42249216
upvote count: 1

http://stackoverflow.com/comment/42242183
comment on: http://stackoverflow.com/a/26838484
type: Comment
has text: You should use `criteria.add(Restrictions.eq("vote.Event_ID", eventId));`
type: AnswerComment
score: 0

http://stackoverflow.com/q/26891707
type: Question
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has title: Error Instantiating Activity
tagged with: android
tagged with: android-activity
has answer: http://stackoverflow.com/a/26891824
has body: I have fixed the problem, I checked my manifest file and it told me my activity was no longer concrete, I changed the class to abstract by mistake, changing it back from abstract fixed the error I have added in a interface in my app so I can edit a textEdit depending on a button click in the listview, The app was running fine until I added in this interface, now I get an error when I try run the app. I have searched the forums but can find th solution to my problem, hope somebody can help! this is my main activity import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.os.Handler; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.Toast; import com.pinchtapzoom.R; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.sql.SQLException; public abstract class MyActivity extends Activity implements MyAdapterInterface{ private CustomCursorAdapter customAdapter; public ListView list1; com.example.rory.dbtest.DBAdapter db = new com.example.rory.dbtest.DBAdapter(this); //public EditText TotalCost; //public EditText TotalLitres; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); list1 = (ListView)findViewById(R.id.data_list); db.open(); final MyAdapterInterface ad = new MyAdapterInterface() { @Override public void updateEditText(int value) { EditText myEditText = (EditText)findViewById(R.id.edit1); myEditText.setText(value); } }; Button addBtn = (Button)findViewById(R.id.add); addBtn.setOnCl…
upvote count: 1
tagged with: logcat
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/26891824

http://stackoverflow.com/q/26990274
type: Question
tagged with: actionlistener
has comment: http://stackoverflow.com/comment/42512502
tagged with: java
has answer: http://stackoverflow.com/a/27228838
has title: How to add a combo box when a check box is selected?
tagged with: jcheckbox
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/42513110
has comment: http://stackoverflow.com/comment/42512122
has body: I'm trying to have an action listener add a combo box to a control panel when only when a check box is selected. For example, the project I'm currently working on is a t-shirt order form. A check box for "Graphic" is available. When "Monogram" is checked, a combo box "Graphic Style" should appear. How can I go about doing this? Nothing I've tried so far has worked. Here is my method for building the checkbox public JPanel createGraphicCheckBox() { graphicCheck = new JCheckBox("Graphic"); ActionListener listener = new MyListener(); graphicCheck.addActionListener(listener); JPanel panel = new JPanel(); //add check box to panel panel.add(graphicCheck); panel.setBorder(new TitledBorder(new EtchedBorder(), "Graphic")); return panel; } Here is my method for building the combo box public JPanel createGraphSelectComboBox() { graphSelectBox = new JComboBox(); //Fills graphics combo box graphSelectBox.addItem("Select Graphic"); graphSelectBox.addItem("AB20"); graphSelectBox.addItem("JM17"); graphSelectBox.addItem("PJ23"); graphSelectBox.addItem("TR16"); graphSelectBox.addItem("JK52"); graphSelectBox.setEditable(true); JPanel panel = new JPanel(); panel.add(graphSelectBox); return panel; } And here is my class for my listener class MyListener implementes ActionListener { public void actionPerformed(ActionEvent e) { if(e.getSource() == monoCheck) { if(monoCheck.isSelected()) { JPanel comboBoxPanel5 = createGraphSelectComboBox(); controlPanel.add(comboBoxPanel5); revalidate(); } } } } Thank you guys for all the help you provide!
tagged with: jcombobox
type: UnansweredQuestion

http://stackoverflow.com/comment/42339469
has text: @Muhammad: Some perils are cited [here](http://stackoverflow.com/a/20892645/230513).
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/26887758

http://stackoverflow.com/q/26951932
answer count: 1
linked to: http://stackoverflow.com/q/70689
has title: Java Abstract Factories and Singletons
favorite count: 0
has comment: http://stackoverflow.com/comment/42444590
duplicate of: http://stackoverflow.com/q/70689
type: UnansweredQuestion
tagged with: singleton
tagged with: design-patterns
score: 2
has answer: http://stackoverflow.com/a/26954296
upvote count: 3
has body: I would like to implement an example of abstract factory, however concrete factories must be served as singletons. Giving the example of Mr. Banas here : http://www.newthinktank.com/2012/09/abstract-factory-design-pattern/ I should modify UFOEnemyShipFactory and UFOBossEnemyShipFactory right ? I tried something for UFOEnemyShipFactory but I'm not sure to be right : public class UFOEnemyShipFactory implements EnemyShipFactory{ private UFOEnemyShipFactory(){}; private static UFOEnemyShipFactory firstInstance = null; public static UFOEnemyShipFactory getInstance(){ if(firstInstance == null){ synchronized(UFOEnemyShipFactory.class){ if(firstInstance == null){ firstInstance = new UFOEnemyShipFactory(); } } } return firstInstance; } public ESWeapon addESGun(){ return new ESUFOGun(); } public ESEngine addESEingine() { return new ESUFOEngine(); } It seems a bit weird, I think that I'm not applying the needed modification in the correct class. If I'm totally wrong could you please give me a brief explanation (why am I wrong and which class(es) I have to modify and why ?) Thanks In advance.
tagged with: java
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/26835985
tagged with: factory-pattern

http://stackoverflow.com/comment/42379775
score: 0
type: QuestionComment
type: Comment
has text: Is the first quote part of the Regular Expresion?
comment on: http://stackoverflow.com/q/26915473

http://stackoverflow.com/a/26845675
accepted answer of: http://stackoverflow.com/q/26845344
has comment: http://stackoverflow.com/comment/42254873
has comment: http://stackoverflow.com/comment/42255298
type: Answer
has comment: http://stackoverflow.com/comment/42255408
has comment: http://stackoverflow.com/comment/42255095
score: 0
has body: Try removing the apostrophes from the location parameter, you don't have them in the valid url you posted: URL url = new URL("http://www.onemap.sg/API/services.svc/revgeocode?token=qo/s2TnSUmfLz+32CvLC4RMVkzEFYjxqyti1KhByvEacEdMWBpCuSSQ+IFRT84QjGPBCuz/cBom8PfSm3GjEsGc8PkdEEOEr&amp;location="+eventX+","+eventY); Also, there is probably more information about the problem in the Exception that gets thrown, but you are throwing that away and printing out 'Error', try ex.printStackTrace(); instead.
answers question: http://stackoverflow.com/q/26845344
type: AcceptedAnswer

http://stackoverflow.com/q/26960809
type: Question
score: 0
answer count: 1
tagged with: java
tagged with: servlets
has body: I am developing some web application, with java scripts and servlets. On the web application, a thread works at the background and a page should be refreshed automatically until the threads returns some results. I would like to know how to stop the auto refresh after receiving some results. Please see my codes. if (result == null) { \\ while result equals null, the auto refresh should work } else { \\ after receiving some result, the auto refresh should be stopped }
has answer: http://stackoverflow.com/a/26960871
has title: How to stop the auto refresh function with java scripts after receiving some results from a thread
tagged with: javascript
type: UnansweredQuestion
tagged with: ajax

http://stackoverflow.com/a/26988837
answers question: http://stackoverflow.com/q/26988235
score: 13
has comment: http://stackoverflow.com/comment/54422183
has comment: http://stackoverflow.com/comment/42525588
has comment: http://stackoverflow.com/comment/42543994
has body: Remove this chunk of code from your build.gradle in the root directory apply plugin: 'com.android.application' and android { compileSdkVersion 21 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.wsandhu.conjugation" minSdkVersion 15 targetSdkVersion 19 versionCode 1 versionName "0.5" } } As it says that: // NOTE: Do not place your application dependencies here; they belong in the individual module build.gradle files Meaning this line of code goes to in the gradle file inside your app folder. Try making your top gradle file like this: // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.5.0' } } allprojects { repositories { jcenter() } } I had the same problem before. So I think this will solve your case.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26988235
upvote count: 13

http://stackoverflow.com/a/26891585
type: Answer
score: 0
has body: change like this.. public class YourSuperClass{ private JButton button; public YourSuperClass(){ // your logics button = new JButton(); button.addActionListener(new GrowAndShrinkListener(button)); frame.add(button, BorderLayout.NORTH); } class GrowAndShrinkListener implements ActionListener { GrowAndShrinkListener(JButton button) { } @Override public void actionPerformed(ActionEvent e) { if(e.getSource() == button){ button.setText("Click to shrink square"); } } } }
answers question: http://stackoverflow.com/q/26891333

http://stackoverflow.com/comment/42450836
has text: If this helped then please accept this answer so it gets closed off.
type: AnswerComment
comment on: http://stackoverflow.com/a/26955561
score: 0
type: Comment

retina-display
tags question: http://stackoverflow.com/q/26893951
type: Tag
tag name: retina-display

http://stackoverflow.com/a/26878272
downvote count: 0
has body: I'd bet that the best results can be achieved via perfect hashing, assuming you want to spend some non-negligible time creating the set. There are some general ways for computing such a hashing, but in your case, they might be inferior to a simple array scan due to their fixed overhead. In case the creation time does not matter, consider an algorithm like in this answer of mine, where an expression of the form TABLE[(MULTIPLIER * c) &gt;&gt; SHIFT] == c gets used to test if c is contained in the set. Finding a proper MULTIPLIER takes some time, but the test is extremely fast.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/26872951
upvote count: 1

http://stackoverflow.com/comment/42333544
comment on: http://stackoverflow.com/q/26889542
score: 0
has text: I'd still just suggest trying it--but IMO this isn't necessarily a great way to enforce conditions as Joni hints at.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42381665
type: Comment
type: QuestionComment
has text: You might want to have a look at this: http://sourceforge.net/p/tus/code/HEAD/tree/tjacobs/ui/swing_ex/JPanelCustomBkground.java it is a broader solution which uses Paint rather than Image... The main method demonstrates how to get a Paint from an Image
score: 0
comment on: http://stackoverflow.com/q/26916443

http://stackoverflow.com/comment/42448453
score: 0
has text: why don't you re-initialize the array by putting the exact `row` and `column` index. e.g. `array[userRow-1][userColumn-1]=userValue;`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26954135

http://stackoverflow.com/comment/42247680
comment on: http://stackoverflow.com/q/26840861
score: 0
type: Comment
type: QuestionComment
has text: You can store data in a tree : http://stackoverflow.com/questions/3522454/java-tree-data-structure

http://stackoverflow.com/comment/42300204
score: 4
type: QuestionComment
type: Comment
has text: If your solution works and you're looking for code improvement then go to http://codereview.stackexchange.com/
comment on: http://stackoverflow.com/q/26870809

http://stackoverflow.com/comment/42468777
has text: I added the CustomerList class
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26965661
score: 0

http://stackoverflow.com/comment/42336099
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26891113
has text: Avoid naming variables with numbers. When you start seeing numbers in the variable names it is time for a collection such as an array or `ArrayList`
score: 1

http://stackoverflow.com/comment/42486633
score: 1
comment on: http://stackoverflow.com/q/26975669
type: Comment
type: QuestionComment
has text: Well, in Java you cannot extend from an `enum`, so your use case is just impossible as is. There are two alternatives, probably you should not use an `enum` to solve this *issue*.

http://stackoverflow.com/q/26858510
has answer: http://stackoverflow.com/a/26859321
answer count: 1
favorite count: 0
tagged with: spring
accepted answer: http://stackoverflow.com/a/26859321
has body: I have following definition to get datasource object via JNDI created at weblogic 12c application server. &lt;jee:jndi-lookup id="test.db" jndi-name="DB_JNDI"/&gt; &lt;bean name="TestImpl" class="com.test.db.TestImpl"&gt; &lt;property name="dataSource" ref="test.db" /&gt; &lt;/bean&gt; I would like to know how I can set queryTimeOut value of datasource and how I can pass this value while initializing it Using weblogic 12c, Spring 3.5
type: AnsweredQuestion
tagged with: java
score: 0
upvote count: 1
has title: Setting queryTimeout Value of Datasource created via JNDI
downvote count: 1
type: Question
tagged with: weblogic

http://stackoverflow.com/q/26963158
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/26970615
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/26970615
has title: Inserting Nodes into a priority queue java
favorite count: 0
tagged with: priority-queue
has comment: http://stackoverflow.com/comment/42464937
has comment: http://stackoverflow.com/comment/42472157
has body: Hi im trying to get all the nodes I create into the pq so i can order them in terms of weight and then remove the first two items (the smallest) so i can build a huffman tree which is a specialized version of a Binary tree whats the best way to do this? Thanks public class Main { public void main(String[] args) throws IOException { long start = System.currentTimeMillis(); String inputFileName = args[0]; FileReader reader = new FileReader(inputFileName); Scanner in = new Scanner(reader); // read in the data and do the work here // read a line at a time to enable newlines to be detected and allowed for while(in.hasNext()){ CharacterMap&lt;Character, Integer&gt; hashMap = new CharacterMap&lt;Character, Integer&gt;(); char[] chars = scanner.nextLine().toLowerCase().toCharArray(); int c_count = 0; for (Character c : chars) { c_count += 1; if (hashMap.containsKey(c)) { hashMap.put(c, hashMap.get(c) + 1); } else { hashMap.put(c, 1); } } PriorityQueue&lt;Node&gt; pq = new PriorityQueue&lt;Node&gt;(new Comparator&lt;Node&gt;() { for (Map.Entry&lt;Character, Integer&gt; entry : hashMap.entrySet()){ Node n = new Node(); int f = entry.getValue(); String c = entry.getKey(); n.setWeight(f); n.setCharacter(c); n.setLeftChild(null); n.setRightChild(null); pq.add(n); } reader.close(); String outputFileName = args[1]; FileWriter writer = new FileWriter(outputFileName); writer.write("Input file " + inputFileName + " Huffman algorithm\n\n"); // write out the results here long end = System.currentTimeMillis(); writer.write("\nElapsed time: " + (end - start) + " milliseconds"); writer.close(); } }
type: AnsweredQuestion

http://stackoverflow.com/a/26984958
downvote count: 0
has body: Lets start by removing the duplication, for example, instead of... if (i % 2 == 0) { g.setColor(Color.white); g.fillRect(x, y, w, h); g.setColor(Color.black); g.drawRect(x, y, w, h); g.setColor(Color.green); g.fillOval(x2, y2, w2, h2); g.setColor(Color.black); g.drawOval(x2, y2, w2, h2); } else if (i % 2 == 1 &amp;&amp; j % 2 == 1) { g.setColor(Color.yellow); } g.fillRect(x, y, w, h); g.setColor(Color.black); g.drawRect(x, y, w, h); g.setColor(Color.green); g.fillOval(x2, y2, w2, h2); g.setColor(Color.black); g.drawOval(x2, y2, w2, h2); You really only need... if (i % 2 == 0) { g.setColor(Color.white); } else if (i % 2 == 1 &amp;&amp; j % 2 == 1) { g.setColor(Color.yellow); } g.fillRect(x, y, w, h); g.setColor(Color.black); g.drawRect(x, y, w, h); g.setColor(Color.green); g.fillOval(x2, y2, w2, h2); g.setColor(Color.black); g.drawOval(x2, y2, w2, h2); Anything you did in the first if statement is getting wiped out by the other paint code outside of the if-else block... Next, your logic is slightly off, instead of... if (i % 2 == 0) { g.setColor(Color.white); } else if (i % 2 == 1 &amp;&amp; j % 2 == 1) { g.setColor(Color.yellow); } You could use something more like... if ((i + j) % 2 == 0) { g.setColor(Color.white); } else { g.setColor(Color.yellow); } This will get you the checker board look you're after. Step closer. You will need another for-loop to generate the inner circles, try not to directly modify the values you are currenly relying on though ;) You could also use the if block to define the background and foreground colors you need to use, assign them to some variables and apply them within the paint section, this will give you more flexibility
has comment: http://stackoverflow.com/comment/42503609
has comment: http://stackoverflow.com/comment/42503581
answers question: http://stackoverflow.com/q/26984778
has comment: http://stackoverflow.com/comment/42536241
upvote count: 3
accepted answer of: http://stackoverflow.com/q/26984778
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42535009
has comment: http://stackoverflow.com/comment/42534668
type: Answer
score: 3

http://stackoverflow.com/comment/42270394
has text: Well, all you have to do is (1) undo the change that you made (2) iterate through the `counts` array by index, printing out each index as many times as the value in the array dictates.
comment on: http://stackoverflow.com/a/26853053
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26961111
score: 2
has body: Your problem seems to be due to the size of your PlayerPanel JPanel. Sometimes it helps to debug things by testing to see what size things are when they're rendered. For instance, if you change your Board paintComponent method to this: @Override public void paintComponent(Graphics g) { super.paintComponent(g); if (boardImage != null) { g.drawImage(boardImage, 0, 200, null); } System.out.printf("Board size: [%d, %d]%n", getWidth(), getHeight()); System.out.printf("Player size: [%d, %d]%n", playerPanel.getWidth(), playerPanel.getHeight()); } it will tell you exactly what the sizes are of itself and its constituent playerPanel. To solve the issue, you could give Board a layout manager that expands its constituent components such as a BorderLayout. Another possible solution is to give PlayerPanel its own getPreferredSize() method override, especially if you want it to size itself to its image. e.g., @Override public void paintComponent(Graphics g) { super.paintComponent(g); if (playerImage != null) { g.drawImage(playerImage, 0, 0, null); } } Alternatively, you could use a JLabel that holds an ImageIcon rather than draw in the JPanel. Note, you should swap views with a CardLayout rather than calling remove(...), add(...), revalidate(), repaint()
upvote count: 2
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/26959250

http://stackoverflow.com/a/26964928
downvote count: 1
has body: If you use the full path to your java.exe, you dont need to set up any PATH and JAVA_HOME: c:\&gt; cd \work c:\work&gt; c:\java\bin\java.exe -cp classes\ your.Main If your book does not use the normal JDK installers it really is supposed to explain that. (However it is normal behaviour for any executable). (The above example asumes you compile into c:\work\classes\your\Main.class and your JDK is installed (installer does the unpack) in C:\java (typically you would use default locations like C:\Program Files\Java\jdk1.8.0\bin\java.exe).
upvote count: 0
answers question: http://stackoverflow.com/q/26964678
has comment: http://stackoverflow.com/comment/42622915
type: Answer
score: -1

http://stackoverflow.com/q/26910487
duplicate of: http://stackoverflow.com/q/2623995
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/2623995
has body: I am not very good at java. I can do all of the easy basic stuff but I can't get the complex things to work. I have a main class with a JFrame and container and ColorPanel... then here is the ColorPanel class that draws everything. The person class right now only draws a square... I cannot find a way to use a KeyListener or any other method to get my square dudes to respond to multiple key presses (They only move one way at a time and not very smoothly). I have looked at what everyone says, but the links are way too confusing for me to understand how to apply it to my program. Please, someone help! And if you do please give examples not including links to the confusing sites I have read. Pretend you are talking to a baby or something. public class ColorPanel extends JPanel implements KeyListener { Person Drake; Person Grant; public ColorPanel(Color backColor) { setBackground(backColor); Drake = new Person(100, 100); Drake.setColor(Color.magenta); Color boodyliciousBlue = new Color(50, 0, 255); Grant = new Person(300, 200); Grant.setColor(boodyliciousBlue); addKeyListener(this); setFocusable(true); } public void paintComponent(Graphics g) { super.paintComponent(g); Drake.draw(g); Grant.draw(g); } @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_W) { Drake.move(0, -10); } if (e.getKeyCode() == KeyEvent.VK_S) { Drake.move(0, 10); } if (e.getKeyCode() == KeyEvent.VK_A) { Drake.move(-10, 0); } if (e.getKeyCode() == KeyEvent.VK_D) { Drake.move(10, 0); } repaint(); } @Override public void keyReleased(KeyEvent e) { } @Override public void keyTyped(KeyEvent e) { } }
type: Question
has title: Need to have a method respond to multiple key presses at once
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing

http://stackoverflow.com/comment/42348688
comment on: http://stackoverflow.com/q/26882254
has text: "A lot of things involved here"... you can say that again. This is not so much an SO question as a consulting engagement.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42469027
has text: @Jason C I thought by stating I had a problem with a do while loop and then commenting on the exact do while loop where the error occurred I was being clear, but sorry for the confusion. I will fix the inappropriate break statement in the initial while loop; however, my real issue as stated in the question is with the do while loop. It only runs part of the way through to the marked comment (only prints the first statement, also marked).
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26965687

http://stackoverflow.com/comment/42393903
type: Comment
comment on: http://stackoverflow.com/a/26922820
type: AnswerComment
has text: Maybe you could add a bit of explanation as to what this code actually does ? Thanks.
score: 0

http://stackoverflow.com/q/26883550
tagged with: java
answer count: 2
tagged with: api
has answer: http://stackoverflow.com/a/35551814
downvote count: 0
has answer: http://stackoverflow.com/a/26885928
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42324220
tagged with: android
score: 2
has body: I want to execute adb commands like adb backup -noapk com.your.packagename directly in my android app. How can I do it? Is it possible or do I have to use an Android API? I want to write an Android app using Java and be able to run it as if I had a terminal with adb in it.
upvote count: 2
tagged with: adb
has title: execute ADB command directly in android app
type: Question

http://stackoverflow.com/comment/42423563
has text: Can you try to reproduce it, minimally? The actual contents don't matter. It's the structure that does.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26938250

http://stackoverflow.com/comment/42492073
has text: Better is println(), as it will take care of `line separator`.
comment on: http://stackoverflow.com/a/26978776
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/26847785
favorite count: 0
linked to: http://stackoverflow.com/q/8798403
has comment: http://stackoverflow.com/comment/42258378
has answer: http://stackoverflow.com/a/26847940
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/26847946
type: Question
has comment: http://stackoverflow.com/comment/42262010
has body: I need to convert a set of chars into a string. The problem is, I don't know how to do it without an array (it's forbidden to use them, because we didn't see the this subject yet). So the method starts with asking the user to type in a word (String type). In this case I use the word "programma" as an example. The first step is too count +4 to every character of that word. In this example it must change from "programma" --> "tvskveqqe". I split up the input string "programma", into seperate chars, and added +4 in the alfabet. Afterwards I made sure if the letters "wxyz" are used, that they are converted to w --> a, x -->b, y --> c and z --> d. But now I'm stuck at the part, where I need to put the chars 't''v''s''k''v''e''q''q''e' into a string "tvskveqqe", and use that as return statement. Thanks! public char coderen() { String str; //input string char c, e = ' '; int a = 4, b, d; System.out.println("Geef een woord in: "); str = Input.readString(); //input for (int i = 0; i &lt; str.length(); i++) { // Splits up the string into separate chars b = (int) str.charAt(i) + a; // +4 in ASCII c = (char) b; if (c &gt;= 'e' &amp;&amp; c &lt;= 'z') { e = c; System.out.println(e); } else if (c &gt;= '{' &amp;&amp; c &lt;= '~') { // converts 'w''x''y''z' into 'a''b''c''d' d = (int)c - 26; e = (char) d; System.out.println(e); } else { System.out.println("fout!"); } } return e; }
accepted answer: http://stackoverflow.com/a/26847940
possible better answer: http://stackoverflow.com/a/26847946
has title: Converting chars into a string (without array)?
has comment: http://stackoverflow.com/comment/44010493
tagged with: char
answer count: 3
tagged with: converters
downvote count: 0
tagged with: string
has answer: http://stackoverflow.com/a/26847860

http://stackoverflow.com/q/26892076
type: Question
has comment: http://stackoverflow.com/comment/42412208
answer count: 1
tagged with: url
upvote count: 1
has title: Getting image from server and saving to MySQL DB
accepted answer: http://stackoverflow.com/a/26935497
favorite count: 0
tagged with: ftp
has answer: http://stackoverflow.com/a/26935497
has comment: http://stackoverflow.com/comment/42338951
has body: Im getting an image from server as InputStream and then saving it to mySQL database. It works when I use Thread.sleep(5000);. But if I dont use it no picture is saved to the DB or only one picture and half of it or less. So I understand that the program needs time writing image to the database, but how much time? This is the question, I would like to know exactly when it finished writing image to the database and can start with the next image. Below is my code: ResultSet rs = stmt.executeQuery(query); while (rs.next()) { int ID = rs.getInt(1); String myName = rs.getString(2); try { String myCommand = "take picture and save /mydir/mydir2/mydir3" + myName + ".png"; telnet.sendCommand(myCommand); // Here taking a picture via telnet // Thread.sleep(5000);// If I uncomment this line it works String sqlCommand = "UPDATE my_table SET Picture = ? WHERE ID ='" + ID +"';"; PreparedStatement statement = conn.prepareStatement(sqlCommand); String ftpUrl = "ftp://"+server_IP+"/mydir/mydir2/mydir3" + myName + ".png;type=i"; URL url = new URL(ftpUrl); URLConnection connUrl = url.openConnection(); //Thread.sleep(5000); // If I uncomment this line, it works too. InputStream inputStreamTelnet = connUrl.getInputStream(); statement.setBlob(1, inputStreamTelnet); int row = statement.executeUpdate(); if (row &gt; 0) { System.out.println("A picture was inserted into DB."); System.out.println("Value of row(s) : " + row); } } catch (Exception e) { e.printStackTrace(); } } // End of while I would expect to put the waiting(sleep) after InputStream inputStreamTelnet = connUrl.getInputStream(); but it doesnt work when I put the sleep after this line. It works only when the sleep is before. Could someone explain me why and I would like to avoid using Thread.sleep(5000); and instead would like to wait exact time or not wait at all which will make the program faster also there might be a case saving the picture can take more than 5 seconds or maybe saving the picture doesnt take time but opening th…
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: mysql
tagged with: inputstream
has comment: http://stackoverflow.com/comment/42415378

http://stackoverflow.com/comment/42387797
type: Comment
type: QuestionComment
has text: Yep, a "clean" computer. If it fails there, work a bit to get it down to a minimal failing testcase.
score: 0
comment on: http://stackoverflow.com/q/26876014

http://stackoverflow.com/a/26940230
has body: You can specify additional property files with command line parameters: java -jar myproject.jar --spring.config.location=classpath:/default.properties,classpath:/override.properties Take a look at Application properties file Spring Boot doc chapter.
upvote count: 3
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26935960
answers question: http://stackoverflow.com/q/26935960
score: 3
type: AcceptedAnswer

http://stackoverflow.com/q/26971584
has comment: http://stackoverflow.com/comment/42497145
has title: ValidationException Exception Description: uses a non-entity as target entity in the relationship attribute
upvote count: 3
tagged with: java
tagged with: glassfish-4
tagged with: java-ee-7
type: Question
has answer: http://stackoverflow.com/a/33426505
has body: I am getting the following exception and have done all this 1000 times before but now I am getting errors: ValidationException Exception Description: [class com.smartphonedev.rsvplaw.entities.Staff] uses a non-entity [class com.smartphonedev.rsvplaw.entities.Address] as target entity in the relationship attribute [field addresses].. here are the entities in question. Can someone help me identify what is wrong with my relationships? @Entity @Table(name="address") public class Address implements Serializable, { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Column(name="addressType") @Enumerated(EnumType.ORDINAL) private AddressType addressType; @Column(name="streetLineOne") private String streetLineOne; @Column(name="streetLineTwo") private String streetLineTwo; @Column(name="city") private String city; @Column(name="adState") private String state; @Column(name="postCode") private String postCode; @OneToMany(fetch=FetchType.LAZY, targetEntity=PhoneNumber.class, cascade = {CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH},orphanRemoval=true) @JoinColumn(name="phoneNumbers") private Collection<PhoneNumber> phoneNumbers; ….. } @Entity @Table(name="staff") public class Staff implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; //private Profile profile; @OneToOne(fetch=FetchType.LAZY,cascade = {CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH}) @JoinColumn(name="permission") private Permission permission; @OneToOne(fetch=FetchType.LAZY,cascade = {CascadeType.MERGE, CascadeType.REFRESH, CascadeType.DETACH}) @JoinColumn(name="login") private Login login; @Column(name="firstName") private String firstName; @Column(name="surnameName") private String surnameName; @Column(name="emailAddress") private String emailAddress; @OneToMany(fetch=FetchType.LAZY, targetEntity=PhoneNumber.class, cascade = {C…
score: 3
has comment: http://stackoverflow.com/comment/42486486
has comment: http://stackoverflow.com/comment/42518537
tagged with: ejb
has comment: http://stackoverflow.com/comment/42514041
has comment: http://stackoverflow.com/comment/42538904
has comment: http://stackoverflow.com/comment/42494187
linked to: http://stackoverflow.com/q/11938253
answer count: 1
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/42493232
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/26918590
upvote count: 1
has comment: http://stackoverflow.com/comment/42385802
type: Question
has title: How do I recreate the width of columns in a JTable after changing the ColumnModel
downvote count: 0
has comment: http://stackoverflow.com/comment/42385770
tagged with: jtable
linked to: http://stackoverflow.com/q/10088853
has comment: http://stackoverflow.com/comment/42385492
favorite count: 0
has body: So I have a JTable with 24 columns. When the table is initialized, I make set the widths of the columns and the user interface looks great. No complaints. The user can click a button to only see 4 of the columns. I change the array of columns on the table model and then call firetablestructurechanged() which then removes all of the column widths I established (but now only shows the 4 columns, the intended behavior). When I try re-defining the column widths, nothing seems to change. This is what I use to set column widths TableColumnModel columnModel = table.getColumnModel(); for (int i = 1; i &lt; columnModel.getColumnCount(); i++) { columnModel.getColumn(i).setMinWidth(50); columnModel.getColumn(i).setMaxWidth(50); } How do I get the columns to resize after firetablestructurechanged() gets called?
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/22417797
answer count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26904207
tagged with: android
has answer: http://stackoverflow.com/a/26917321
tagged with: android-tabhost
tagged with: android-fragments
score: 0
tagged with: java
tagged with: android-tabs
answer count: 1
accepted answer: http://stackoverflow.com/a/26917321
has body: I'm trying to add a tabhost in my fragment that will hold 2 child fragments. I need to add arguments to them, but seems I cannot do this because I get this in my logCat: java.lang.IllegalArgumentException: you must specify a way to create the tab indicator. at android.widget.TabHost.addTab(TabHost.java:221) at com.myapp.fragments.CommunitySearchFragment.addTab(CommunitySearchFragment.java:247) at com.myapp.fragments.CommunitySearchFragment.initTabs(CommunitySearchFragment.java:151) at com.myapp.fragments.CommunitySearchFragment.onCreateView(CommunitySearchFragment.java:223) This is the important code from my fragment that is doing the tabs init and provides the tabs functionality: private void initTabs(View mView) { Bundle args = new Bundle(); mTabHost = (TabHost) mView.findViewById(android.R.id.tabhost); mTabHost.setup(); TabInfo tabInfo = null; args.putSerializable("communityClipboards", rArray); addTab(mTabHost, mTabHost.newTabSpec("Tab1"), (tabInfo = new TabInfo("Tab1", CommunityClipsFragment.class, args))); args.putParcelableArrayList("communityClips", clipsArray); addTab(mTabHost, mTabHost.newTabSpec("Tab2"), (tabInfo = new TabInfo("Tab2", FragmentSearchMyClipboards.class, args))); // ------------------------ mapTabInfo.put(tabInfo.tag, tabInfo); // Default to first tab onTabChanged("Tab1"); // // mTabHost.setOnTabChangedListener(this); } private void addTab(TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) { // Attach a Tab view factory to the spec tabSpec.setContent(new TabFactory(getActivity())); String tag = tabSpec.getTag(); // Check to see if we already have a fragment for this tab, probably // from a previously saved state. If so, deactivate it, because our // initial state is that a tab isn't shown. tabInfo.fragment = getActivity().getSupportFragmentManager() .findFragmentByTag(tag); if (tabInfo.fragment != null &amp;&amp; !tabInfo.fragment.isDetached()) { FragmentTransaction ft = getActivity().getSupportFragmentManager() .beginTransaction(); …
type: AnsweredQuestion
has title: Tabhost in fragment is throwing - you must specify a way to create the tab indicator exception
type: Question

http://stackoverflow.com/q/26918098
upvote count: 2
type: Question
tagged with: hibernate-envers
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/26937397
tagged with: servlets
has title: Hibernate Envers save Username just using servlet
has comment: http://stackoverflow.com/comment/42419043
answer count: 1
downvote count: 0
has body: I have a project where i use Hibernate and i wanna use Envers for logging, but i need the username of who is making the changes because a incorrect configuration can lead to financial problems so the cliente wanna know who did it. The project use Java EE but just with servets, there is anyway to get the user from a session while envers is saving the audited entity? The logged user stay in a session, so i need to retrieve it from there or save in another place use another strategy i don't know. I searched alot but just found solution when using Frameworks like spring, vraptor etc I need a solution without framework because i can't port the project to this framework, at least not now. Thx in advance!
favorite count: 0
has answer: http://stackoverflow.com/a/26937397
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/42267812
score: 0
has text: Saying something "doesn't work" is a no-no on StackOverflow; we need to know just **how** it's not working--what output you expect and what you're getting instead, for instance.
comment on: http://stackoverflow.com/q/26852254
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26857475
score: 1
accepted answer of: http://stackoverflow.com/q/26857383
answers question: http://stackoverflow.com/q/26857383
type: AcceptedAnswer
downvote count: 0
upvote count: 1
type: Answer
has body: R.java is a auto generated file in which reference of resources such as strings, drawbles, layouts, and styles are automatically added. In your question 0x7f05001c is just a reference id of action_bar. For example: in activity we always write TextView v = (TextView)findViewById(R.id.something); In this we are getting the reference of Texview which is automatically generated in R.java

http://stackoverflow.com/comment/42477892
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26962814
has text: @MadProgrammer yes it does exist in jar and can be normally opened so not corrupted, and the jar is the same application so it is builded every time
score: 0

http://stackoverflow.com/comment/42472734
score: 0
type: Comment
type: QuestionComment
has text: I realize that I need to use "integratedSecurity=true" somehow in the cmd, what I do not understand is how to extract or how to create a 'Connection' in my java program by executing the way I described.
comment on: http://stackoverflow.com/q/26967963

quartz-scheduler
tags question: http://stackoverflow.com/q/26964672
tags question: http://stackoverflow.com/q/26846551
type: Tag
tags question: http://stackoverflow.com/q/26918531
tags question: http://stackoverflow.com/q/26873343
tags question: http://stackoverflow.com/q/26870035
tag name: quartz-scheduler
tags question: http://stackoverflow.com/q/26904346
tags question: http://stackoverflow.com/q/26853803

http://stackoverflow.com/a/26988754
has body: minValue = -(1 &lt;&lt; (bitscount - 1)); maxValue = (1 &lt;&lt; (bitscount - 1)) - 1;
has comment: http://stackoverflow.com/comment/42509553
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26988666
accepted answer of: http://stackoverflow.com/q/26988666

http://stackoverflow.com/comment/42491894
comment on: http://stackoverflow.com/a/26978053
score: 0
has text: Sorry but I didn't understand what you explained, or how to use what you posted. Could you post a more thoroughly explained example?
type: Comment
type: AnswerComment

http://stackoverflow.com/q/26878765
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/26882658
tagged with: rmi
tagged with: java
type: Question
answer count: 1
downvote count: 0
has body: We're migrating an application from Java 6 to Java 7. At the high level, the issue is that its slower. Going into more detail, we've been upgrading classes as the profiler tells us hot spots. At this point we have java.net.SocketInputStream.socketRead0(Native Method) showing up with 42% of the usage when using jvisualvm's sampler. Doing a thread dump, many of the threads have this stack "RMI TCP Connection(68)-192.168.1.198" daemon prio=5 tid=0x00007ff3279f3800 nid=0x49d2b runnable [0x000000013e279000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) - locked &lt;0x00000007f881b7f0&gt; (a java.io.BufferedInputStream) at java.io.FilterInputStream.read(FilterInputStream.java:83) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:538) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:811) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:670) 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) Locked ownable synchronizers: - &lt;0x0000000763e82c50&gt; (a java.util.concurrent.ThreadPoolExecutor$Worker) My understanding of this is that the application is hanging on a response. I can't tell if its a response from the database or from our testing endpoint. We mimic http requests and shoot them at our application in our testing. Googling around I've tried setting the following properties: -Dsun.rmi.transport.tcp.responseTimeout=5000 -Djava.net.preferIPv4Stack=true with no effect. Here is a quick rundown of what could be relevant in our setup Centos or M…
accepted answer: http://stackoverflow.com/a/26882658
has title: Application seems to be hanging on SocketRead
favorite count: 0
upvote count: 2
tagged with: sockets

http://stackoverflow.com/q/26875877
tagged with: java
has answer: http://stackoverflow.com/a/79433503
type: Question
has comment: http://stackoverflow.com/comment/42309369
has comment: http://stackoverflow.com/comment/42309379
score: -1
has body: I know there's some way to change a string into an integer but it's not really working out for me when I try to do it. I was asked to take in an integer 'n' and 'a' string 's' and print 's' 'n' times Here's my code and my main question / question is how do I easily turn the string into an integer so I can multiply the two together: public static void main(String args[]) { System.out.println("Enter the number of times you want to print a string"); Scanner n = new Scanner(System.in); int x = n.nextInt(); System.out.println("Enter the string you want printed"); Scanner y = new Scanner(System.in); String s = y.nextLine(); }
answer count: 2
downvote count: 1
has title: How to multiply a String by an Integer?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42309400
upvote count: 0
has comment: http://stackoverflow.com/comment/42310273
has answer: http://stackoverflow.com/a/26875892

http://stackoverflow.com/q/26845594
type: Question
accepted answer: http://stackoverflow.com/a/26845665
tagged with: android
has title: Trouble getting arraylist objects returned correctly
tagged with: java
answer count: 3
upvote count: 1
possible better answer: http://stackoverflow.com/a/26845645
has answer: http://stackoverflow.com/a/26845645
has answer: http://stackoverflow.com/a/26845665
has body: Here's is my activity class: package com.blogspot.joyouslybeingjoy.cybpromises; import android.app.Activity; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.os.Bundle; import android.util.Log; import android.widget.ListView; import java.util.ArrayList; public class DisplayResult extends Activity { String selectedCategory; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.verses); Bundle b = getIntent().getExtras(); String selectedCategory = b.getString("ITEMVALUE"); //Toast.makeText(DisplayResult.this, "Category passed: " + selectedCategory, // Toast.LENGTH_LONG).show(); final ListView lv = (ListView) findViewById(R.id.listViewItems); ArrayList&lt;Promise&gt; results = null; lv.setAdapter(new MyCustomArrayAdapter(this, results)); } // end onCreate public ArrayList&lt;Promise&gt; GetPromises() { String table = "promises"; ArrayList&lt;Promise&gt; promises = new ArrayList&lt;Promise&gt;(); Promise prms = new Promise(); SQLiteDatabase newDB; //SQLiteDatabase db = MyDBHandler.getReadableDatabase(); ArrayList&lt;Promise&gt; results = null; try { MyDBHandler dbHandler = new MyDBHandler(this.getApplicationContext()); newDB = dbHandler.getReadableDatabase(); Cursor c = newDB.rawQuery("SELECT * FROM " + MyDBHandler.TABLE_NAME + " WHERE KEY_CATEGORY = ?", new String[]{selectedCategory}); if (c != null) { if (c.moveToFirst()) { do { String category = c.getString(c.getColumnIndex("KEY_CATEGORY")); String book = c.getString(c.getColumnIndex("KEY_BOOK")); String chapter = c.getString(c.getColumnIndex("KEY_CHAPTER")); String verse = c.getString(c.getColumnIndex("KEY_VERSE")); String word = c.getString(c.getColumnIndex("KEY_WORD")); assert results != null; results.add(category + book + chapter + verse + word); } while (c.moveToNext()); } // end inner if } // end outer if } catch (SQLiteException se) { Log.e(getClass().getSimple…
tagged with: arraylist
has comment: http://stackoverflow.com/comment/42254246
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26845768
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/q/26907542
answer count: 2
has comment: http://stackoverflow.com/comment/42365442
has comment: http://stackoverflow.com/comment/42365880
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/42365301
has comment: http://stackoverflow.com/comment/42365568
favorite count: 0
has body: This question is not Java specific, however the code examples are in Java. Sometimes you encounter very simple objects, like the following code: public class Coordinates { private int x; private int y; public Coordinates (int x, int y) { this.x = x; this.y = y; } public void setX (int x) { this.x = x; } public void setY (int y) { this.y = y; } public int getX () { return x; } public int getY () { return y; } } I would say it would be much more efficient to access fields directly rather than through methods. Plus, the code would look simpler. The use itself would be simpler, and the class definition would be free of (unnecessary boiler-plate code) 4 methods than don't really do anything. (In a way I'm thinking of a use similar to struct in C or record in Pascal.) The way I would do it is probably like this: public class Coordinates { public int x; public int y; public Coordinates (int x, int y) { this.x = x; this.y = y; } } So why does the first way seem preferred? It feels like forcing something into becoming an object. It is just values bunched together into one variable, why using OOP just for the sake of it? True, I have kept the constructor. It is actually handy for when values are initially assigned, but there really is no need for other methods, except maybe a method set that sets both fields (like the constructor). I know OOP is handy for many things, but to me this doesn't seem to be one of them. Am I wrong thinking like that?
has comment: http://stackoverflow.com/comment/42365357
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42365460
linked to: http://stackoverflow.com/q/1568091
has answer: http://stackoverflow.com/a/26907647
has comment: http://stackoverflow.com/comment/42365468
has comment: http://stackoverflow.com/comment/42366512
tagged with: oop
has answer: http://stackoverflow.com/a/26907657
has comment: http://stackoverflow.com/comment/42365437
tagged with: java
duplicate of: http://stackoverflow.com/q/1568091
has title: OOP - fields vs methods
type: Question
upvote count: 4

http://stackoverflow.com/q/26902047
tagged with: cxf
upvote count: 2
has body: This is not a problem with a solid answer. Any answer of any level of experience would be highly appreciated. I think many new comer to java web-service might have such problems. The main problems are: How CXF and spring support each other ? The Spring-mvc supports RESTful web-service, and CXF also supports it. Are they same in terms of their principles? Which is the most popular framework to build web-service currently?
tagged with: web-services
has answer: http://stackoverflow.com/a/26948230
type: Question
tagged with: java
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26902917
has title: How CXF and spring support each other
type: UnansweredQuestion
tagged with: spring
score: 2

http://stackoverflow.com/a/26847663
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26847457
score: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26847457
downvote count: 0
has body: Instead of getView().findViewById(R.id.flCityBac); Use: rootView.findViewById(R.id.flCityBac); You cannot use getView because your view was not created yet. Hope it helps you! :-)

http://stackoverflow.com/comment/42510855
type: Comment
comment on: http://stackoverflow.com/a/26989483
has text: @ChristianBongiorno OK, then you can't omit it, sorry. :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42413937
type: Comment
has text: That's ok. Which additional libraries do you use? Primefaces, Richfaces, etc. Could you add the xhtml portion that belongs to your code? Otherwise it is hard to reproduce your example.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26934202

http://stackoverflow.com/comment/42310601
score: 1
comment on: http://stackoverflow.com/a/26876397
has text: All right, I knew about the existence of higher level abstractions, I just wanted to start with the classics. Thanks!
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26832437
answer count: 1
has comment: http://stackoverflow.com/comment/42232860
has comment: http://stackoverflow.com/comment/42232779
has title: Cache with long running computations of values
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42231681
has comment: http://stackoverflow.com/comment/42231654
has comment: http://stackoverflow.com/comment/42232704
has answer: http://stackoverflow.com/a/26833328
has comment: http://stackoverflow.com/comment/42232727
tagged with: java.util.concurrent
type: Question
has body: I need to store objects in a cache and hese objects take a long time to create. I started with ConcurrentHashMap&lt;id, Future&lt;Object&gt;&gt; and everything was fine, until Out of Memory started to happen. Moved to SoftReferences and it was better, but now I need to control eviction. I'm in the process of moving to Ehcache. I'm sure there is a library for such thing but I really need to understand the logic of doing the cache storage and calculation in two phases, while keeping everything consistent and not recalculating something that is already calculated or in the process of being calculated. Is a two level cache, one for the more persistent result and the other for the in the process of being calculated. Any hints on how to better the following code which I'm sure has concurrency problems in the Callable.call() method? public class TwoLevelCache { // cache that serializes everything except Futures private Cache complexicos = new Cache(); private ConcurrentMap&lt;Integer, Future&lt;Complexixo&gt;&gt; calculations = new ConcurrentHashMap&lt;Integer, Future&lt;Complexico&gt;&gt;(); public Complexico get(final Integer id) { // if in cache return it Complexico c = complexicos.get(id); if (c != null) { return c; } // if in calculation wait for future Future f = calculations.get(id); if (f != null) { return f.get(); } // exceptions obviated // if not, setup calculation Callable&lt;Complexico&gt; callable = new Callable&lt;Complexico&gt;() { public Complexico call() throws Exception { Complexico complexico = compute(id); // this might be a problem here // but how to synchronize without // blocking the whole structure? complexicos.put(id, complexico); calculations.remove(id); return complexico; } }; // store calculation FutureTask&lt;Complexico&gt; task = new FutureTask&lt;Complexico&gt;(callable); Future&lt;Complexico&gt; future = futures.putIfAbsent(id, task); if (future == null) { // not previosly being run, so start calculation task.run(); return task.get(); // ex…
tagged with: java
tagged with: concurrency
tagged with: caching
score: 0

http://stackoverflow.com/a/26928971
has comment: http://stackoverflow.com/comment/42406266
has comment: http://stackoverflow.com/comment/42406877
has comment: http://stackoverflow.com/comment/42406104
has body: Override the onBackPressed in the Activity that manages the Fragments. In it you can check if the fragment is visible or not (the one from which an action should be performed if the back is pressed) and then execute your action. @Override public void onBackPressed(){ Fragment myFragment = getFragmentManager().findFragmentByTag("MY_FRAGMENT"); if (myFragment.isVisible()) { String json = myFragment.getJsonData(); //update it locally if(isUpdated){ Fragment listFragment = getFragmentManager().findFragmentByTag("MY_LIST_FRAGMENT"); listFragment.updateListView(json); //Add this method on your fragment } } super.onBackPressed(); } Obs.: To use the .findFragmentByTag() you should add tags once you're making the transaction like so: fragTrans.replace(android.R.id.content, myFragment, "MY_FRAGMENT"); If, for any reason the listFragment has been cleaned from memory, you would have to reload the data anyway so just download the new data again. To update the ListView please see: How to refresh Android listview? . Note thought that you will need to will need to send a new data set to the list view (which you can do inside the updateListView() method)
has comment: http://stackoverflow.com/comment/42406447
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42406421
has comment: http://stackoverflow.com/comment/42408881
has comment: http://stackoverflow.com/comment/42405744
answers question: http://stackoverflow.com/q/26927700

http://stackoverflow.com/comment/42305575
type: AnswerComment
type: Comment
has text: It seems that it is a bug in Google Maps. Here is a link with de problem: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5992&thanks=5992&ts=1383090620
comment on: http://stackoverflow.com/a/26873014
score: 1

http://stackoverflow.com/comment/46968160
comment on: http://stackoverflow.com/a/27347498
has text: OK! @Tuksn's answer worked for me.. Although you have added `dropDownVerticalOffset` to the solution, it seems you just want to show that the offset can be given. Also, **I would like to highlight that the offset starts from the bottom of the actionbar**.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26891796
score: 0
type: Answer
has body: By replacing ? with &amp;, the first part of the URL (http://someexample.com/) becomes a param too. Splitting this one with the = will only return 1 part, as it does not contain any equal sign. And then, accessing [1] of it will fail. I would suggest to only split a param if it contains an equal sign: if (param.contains("=") { ... }
has comment: http://stackoverflow.com/comment/42337366
answers question: http://stackoverflow.com/q/26891733
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26891733

http://stackoverflow.com/q/26866325
tagged with: distributed-computing
tagged with: parallel-processing
has comment: http://stackoverflow.com/comment/42292239
has comment: http://stackoverflow.com/comment/42292274
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42292470
upvote count: 1
has comment: http://stackoverflow.com/comment/42291979
has comment: http://stackoverflow.com/comment/42292477
has comment: http://stackoverflow.com/comment/42292373
has comment: http://stackoverflow.com/comment/42292167
has comment: http://stackoverflow.com/comment/42292126
has title: What concepts do I need to learn to achieve following scenario?
score: 1
tagged with: java
tagged with: mapreduce
has body: May be I am thinking loud here but how can I run a simple java program (with no other dependencies) on different computers (no parallel processing is required) as per following conditions: I have a set of data. Let's say data is in .txt file. I also have a simple java program (see below) that uses this data as input. Now I have 10 computers.Let's call them nodes. I have to run java program on each nodes (nodes are independent to each other) and gets back the output from each of them and save it into another txt. Let's say output.txt. It could be like reducing part of mapping-reducing tech. And here is my thought on it: Divide the data into small .txt(s). I have already done this Install the Java program at each node by extracting it into .jar. Already done this Now what next I have to do to achieve it? I am rookie in Parallel Processing and MPI. Just need some guidance on it. Thanks for your help in Advance :) And here the Java program: import java.io.*; public class CopyFile { public static void main(String args[]) throws IOException { FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream("input.txt"); out = new FileOutputStream("output.txt"); int c; while ((c = in.read()) != -1) { // want to do some computation. Let's say finding prime number } } finally { if (in != null) { in.close(); } if (out != null) { out.close(); } } } }
type: Question
has comment: http://stackoverflow.com/comment/42292423
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/42292058
has comment: http://stackoverflow.com/comment/42292159
has answer: http://stackoverflow.com/a/26870739
has comment: http://stackoverflow.com/comment/42292308
has comment: http://stackoverflow.com/comment/42291929

http://stackoverflow.com/comment/42350463
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26897986
has text: Your answer was terse enough to satisfy the main issue, but the extra bits are a bit...much. Your answer's right, but there's a lot of extra noise here.
type: AnswerComment

http://stackoverflow.com/q/26923282
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/26923692
has body: Suppose I have a JPanel Called panel, and already with a paintComponent, I drew some shapes like rectangles. I can get a buffered image out of my panel like: int w = panel.getWidth(); int h = panel.getHeight(); BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); Graphics2D g = bi.createGraphics(); panel.paint(g); ImageIO.write(bi1, "png", new File("test.png")); How can I get a High Resolution image out of my panel? (the current output image is just based on the resolution of my JPanel in my monitor) I tried AffineTransform, but it doesn't do what I need. Note that I already drew everything in my panel, and do not want to change my drawing in my paintComponent method. I am really searching for a practical way, and appreciate any help.
type: Question
has comment: http://stackoverflow.com/comment/42393829
has comment: http://stackoverflow.com/comment/42393816
answer count: 2
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/42394182
has answer: http://stackoverflow.com/a/37623905
has title: Getting High Resolution Image from JPanel
possible better answer: http://stackoverflow.com/a/37623905
has answer: http://stackoverflow.com/a/26923692
upvote count: 2
tagged with: swing
downvote count: 1

http://stackoverflow.com/q/26853974
answer count: 1
accepted answer: http://stackoverflow.com/a/26869246
tagged with: java
has comment: http://stackoverflow.com/comment/42270739
downvote count: 0
has comment: http://stackoverflow.com/comment/42270818
has title: how to replace the content between the strong tags with bold text in android
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/26869246
score: 1
favorite count: 0
type: Question
has body: I'm parsing html content with the Jsoup library and I want to transform the content between the strong tag in bold text in android; here is my attempt: paragraph.html().replace("&lt;strong&gt;(.+?)&lt;/strong&gt;", new StyleSpan(android.graphics.Typeface.BOLD).toString()); I've already tried to use Html.fromHtml but it doesn't work.. Where am I doing wrong?
tagged with: android
upvote count: 1

http://stackoverflow.com/comment/42316457
has text: Maps don't have any order. There is no first one. That doesn't make much sense. You should probably not use a Map.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26879840
type: QuestionComment

http://stackoverflow.com/q/26860173
has comment: http://stackoverflow.com/comment/42281120
has answer: http://stackoverflow.com/a/26860203
has answer: http://stackoverflow.com/a/26862853
tagged with: java
score: 16
downvote count: 1
upvote count: 17
type: Question
tagged with: stringbuilder
has answer: http://stackoverflow.com/a/26860282
tagged with: stringbuffer
has comment: http://stackoverflow.com/comment/84730804
has body: I have read some articles about the pros and cons of String and StringBuilder in the Java Programming language. In one of the articles, the author mentioned that: StringBuilder is not Thread-safe, so in multiple threads use StringBuffer. Unfortunately, I cannot understand what it means. Could you please explain the difference between String, StringBuilder and StringBuffer especially in the context of "Thread safety". I would appreciate it if you could describe with the code example.
possible better answer: http://stackoverflow.com/a/26860282
accepted answer: http://stackoverflow.com/a/26860203
linked to: http://stackoverflow.com/q/48558432
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/58580415
has answer: http://stackoverflow.com/a/26862666
answer count: 5
tagged with: multithreading
has title: What does " StringBuilders are not thread-safe" mean?
type: AnsweredQuestion

http://stackoverflow.com/comment/42303446
comment on: http://stackoverflow.com/q/26871358
score: 0
type: Comment
type: QuestionComment
has text: Did you try adding a '/' prior to the rest of the filename? "/config/config.properties"

http://stackoverflow.com/a/26929855
type: Answer
upvote count: 2
score: 2
has body: You need to add the ActionListener to the JButton with button.addActionListener(this); And then add in the actionPerformed the text of the JTextfield to the list : player.add(txt.getText());
answers question: http://stackoverflow.com/q/26929739
downvote count: 0
has comment: http://stackoverflow.com/comment/42406651
has comment: http://stackoverflow.com/comment/42405396

http://stackoverflow.com/a/26964282
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26964226
type: Answer
has body: You would parse your first command line argument. Create a text file named SimCraps.java public class SimCraps { public static void main(String[] args) { if (args.length &gt; 0) { int number = Integer.parseInt(args[0]); System.out.println("You entered " + number); } else { System.out.println("No number provided"); } } } You compile SimCraps.class from Simcraps.java like javac SimCraps.java Then you can run it like java -cp . SimCraps 1000
accepted answer of: http://stackoverflow.com/q/26964226
score: 0

http://stackoverflow.com/comment/42232165
comment on: http://stackoverflow.com/q/26832730
has text: Where does the applet get the image from? User's file system?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42363558
comment on: http://stackoverflow.com/q/26906268
score: 0
type: Comment
type: QuestionComment
has text: The value of ObjectType.CLASS is "Foo"

http://stackoverflow.com/comment/42322028
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26877116
has text: this is not the answere. We are not reading from simple string
type: Comment

http://stackoverflow.com/comment/42363222
type: QuestionComment
comment on: http://stackoverflow.com/q/26890186
score: 0
has text: @ChrisStratton Сan i solve my probem using SDK? or i need to use NDK?
type: Comment

http://stackoverflow.com/a/26835480
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26835454
has comment: http://stackoverflow.com/comment/42236848
downvote count: 0
has body: You can use a different variable other than c as the loop and by using and if condition you can check when c become 9 and reset it to 0. public static String getNumberString( String s) { String word = s; String word1 = word.replaceAll("[AEIOUaeiou]", "@"); int c = 0; String word2 = word1; for(int i = 0; i &lt;= word.length(); i++) { word2 = word2.replaceFirst("@", Integer.toString(c)); if(c == 9) { c = 0; } else { c++; } } return word2; }
has comment: http://stackoverflow.com/comment/42236834
type: Answer

http://stackoverflow.com/comment/42480744
has text: http://stackoverflow.com/questions/18151123/how-to-save-edited-jtable-data-to-database use this link i hope this is what you are looking for.
type: Comment
comment on: http://stackoverflow.com/a/26967397
score: 0
type: AnswerComment

http://stackoverflow.com/q/26923658
linked to: http://stackoverflow.com/q/23630094
has title: Send PUT, DELETE HTTP request in HttpURLConnection
has comment: http://stackoverflow.com/comment/42394392
tagged with: http-delete
possible better answer: http://stackoverflow.com/a/38190420
tagged with: httpurlconnection
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/26923939
tagged with: java
tagged with: web-services
linked to: http://stackoverflow.com/q/1051004
type: Question
has comment: http://stackoverflow.com/comment/42395456
has answer: http://stackoverflow.com/a/38190420
has comment: http://stackoverflow.com/comment/42394436
has answer: http://stackoverflow.com/a/26926110
accepted answer: http://stackoverflow.com/a/26926110
has body: I have created web service call using java below code. Now I need to make delete and put operations to be perform. URL url = new URL("http://example.com/questions"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setRequestMethod( "POST" ); conn.setRequestProperty("Content-Type", "application/json"); OutputStream os = conn.getOutputStream(); os.write(jsonBody.getBytes()); os.flush(); When I add below code to perform DELETE action it gives errors saying: java.net.ProtocolException: HTTP method DELETE doesn't support output. conn.setRequestMethod( "DELETE" ); So how to perform delete and put requests?
has comment: http://stackoverflow.com/comment/42395609
upvote count: 2
answer count: 3
tagged with: http-post
favorite count: 0

http://stackoverflow.com/comment/42450227
type: Comment
has text: I declared everything and after I get the error shown above
type: AnswerComment
comment on: http://stackoverflow.com/a/26949993
score: 0

http://stackoverflow.com/comment/42304259
comment on: http://stackoverflow.com/q/26871840
score: 0
type: QuestionComment
has text: @arcy I apologise. I completely forgot about the variables. I changed them to english. I hope it helps.
type: Comment

http://stackoverflow.com/a/26941741
type: AcceptedAnswer
downvote count: 0
has body: We can use XYStepAreaRenderer. Here is complete code: import java.awt.GridLayout; import java.awt.LayoutManager; import javax.swing.JFrame; import org.jfree.chart.*; import org.jfree.chart.labels.StandardXYToolTipGenerator; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYPlot; import org.jfree.chart.renderer.xy.XYStepAreaRenderer; import org.jfree.data.xy.*; public class ChartMarketDepth extends JFrame { public ChartMarketDepth(LayoutManager layout) { super("market depth chart"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(createChart()); setSize(600, 200); setLocationRelativeTo(null); pack(); setVisible(true); } private static ChartPanel createChart() { // dataset &amp; series XYSeriesCollection xYSeriesCollection = new XYSeriesCollection(); XYSeries xyseries = new XYSeries("bid"); xyseries.add(95D, 4D); xyseries.add(96D, 3D); xyseries.add(97D, 2D); xyseries.add(98D, 1D); XYSeries xyseries1 = new XYSeries("ask"); xyseries1.add(100D, 1D); xyseries1.add(101D, 2D); xyseries1.add(102D, 3D); xyseries1.add(103D, 4D); xyseries1.add(104D, 5D); xYSeriesCollection.addSeries(xyseries); xYSeriesCollection.addSeries(xyseries1); // chart JFreeChart jfreechart = ChartFactory.createXYLineChart("", "Price", "Amount", xYSeriesCollection, PlotOrientation.VERTICAL, false, false, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); XYStepAreaRenderer xysteparearenderer = new XYStepAreaRenderer(2); xysteparearenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); xysteparearenderer.setDefaultEntityRadius(6); xyplot.setRenderer(xysteparearenderer); // chart panel final ChartPanel chartPanel = new ChartPanel(jfreechart); chartPanel.setMaximumDrawHeight(2000); chartPanel.setMaximumDrawWidth(3000); return chartPanel; } public static void main(String[] args) { new ChartMarketDepth(new GridLayout(1, 1)); } } And the result:
answers question: http://stackoverflow.com/q/26941740
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26941740
score: 1
has comment: http://stackoverflow.com/comment/42428256

http://stackoverflow.com/a/27135919
has body: If anyone else faces the same problem: It seems that what I want is not achievable with the current code base. I.e., I had to fork the complete SSL/TLS stack. I have opened a bug report: https://code.google.com/p/android/issues/detail?id=80353 Hope this helps anyone looking for answers regarding this.
answers question: http://stackoverflow.com/q/26918242
type: Answer
score: 2
downvote count: 0
upvote count: 2
accepted answer of: http://stackoverflow.com/q/26918242
type: AcceptedAnswer

http://stackoverflow.com/a/26946017
has comment: http://stackoverflow.com/comment/98944610
downvote count: 0
answers question: http://stackoverflow.com/q/26945891
has comment: http://stackoverflow.com/comment/98944192
has comment: http://stackoverflow.com/comment/42434594
score: 10
has comment: http://stackoverflow.com/comment/42459110
has comment: http://stackoverflow.com/comment/42434455
has body: You could use a Mockito Answer for this. doAnswer(new Answer&lt;Object&gt;(){ @Override public Object answer(InvocationOnMock invocation){ Article article = (Article) invocation.getArguments()[0]; article.setId(1L); return null; } }).when(em).persist(any(Article.class)); This tells Mockito that when the persist method is called, the first argument should have its setId method invoked. But if you do this, I don't understand what the purpose of the test would be. You'd really just be testing that the Mockito Answer mechanism works, not that the code of Article or of EntityManager works correctly.
has comment: http://stackoverflow.com/comment/42434563
has comment: http://stackoverflow.com/comment/42459649
upvote count: 10
type: Answer
has comment: http://stackoverflow.com/comment/42464503

http://stackoverflow.com/comment/42277069
has text: Can you please give me idea how it can be done?
comment on: http://stackoverflow.com/q/26857719
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26947065
score: 1
answers question: http://stackoverflow.com/q/26946779
accepted answer of: http://stackoverflow.com/q/26946779
has comment: http://stackoverflow.com/comment/89037684
has body: I'm not sure if there's a way to get it to work otherwise, but adding it to a typedef in package-info.java fixes the problem @TypeDef( name = UUIDCustomType.UUID, defaultForType = UUID.class, typeClass = UUIDCustomType.class ) package com.xenoterracide.rpf.model; import org.hibernate.annotations.TypeDef; import org.hibernate.type.UUIDCustomType; import java.util.UUID;
upvote count: 1
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/89044626
downvote count: 0

http://stackoverflow.com/q/26946150
tagged with: android-activity
favorite count: 0
has title: Removing duplication in Android Layout and Activity codes
has answer: http://stackoverflow.com/a/26946443
type: UnansweredQuestion
tagged with: android
has body: I have a simple Activity/ LinearLayout combination that has two buttons and changes the background colour when each button is clicked. The code is as below It appears to me that there is a lot of high-level duplication of code. For example, I should not need to define and make variables out of the buttons and the LinearLayout background in my Java file. When I express my intention to couple them, I should be getting them automatically So, lines like btnBlue = (Button) findViewById(R.id.btnBlue); should not be necessary. A good framework should allow me to use some conventions (like give me a Java variable btnBlue if my resource file @+id/ resource is named as btnBlue, etc Where can I find a framework that achieves these for me in Android programming? Thanks 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" android:background="#ff000000" android:weightSum="1" android:id="@+id/background"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="Linear Layout Tutorial" android:textColor="#ff33ff" android:textSize="32sp" /&gt; &lt;Button android:id="@+id/btnGreen" android:layout_width="177dp" android:layout_height="wrap_content" android:text="Change to Green" android:layout_weight="0.07" /&gt; &lt;Button android:id="@+id/btnBlue" android:layout_width="400sp" android:layout_height="wrap_content" android:text="Change12 to Blue" android:layout_weight="0.19" /&gt; &lt;/LinearLayout&gt; Activity Java code package com.example.xxx.testandroid; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.renderscript.Sampler; import android.view.Menu; import android.view.MenuItem; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Line…
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: android-layout
answer count: 1
downvote count: 0

http://stackoverflow.com/q/26911032
tagged with: pointers
favorite count: 0
has title: Don't stop evaluation on exception?
has comment: http://stackoverflow.com/comment/42371744
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26911119
has comment: http://stackoverflow.com/comment/42371678
has comment: http://stackoverflow.com/comment/42371795
has answer: http://stackoverflow.com/a/26911081
score: 1
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/26911054
tagged with: null
has comment: http://stackoverflow.com/comment/42372065
tagged with: java
answer count: 3
downvote count: 0
has body: I currently have quite a long list of OR conditions within an if statement. However, some of them may or may not be initalised. Is it possible to instruct java to ignore null pointer exceptions and continue evaluating the rest of the conditions in the if statement instead of jumping to the catch? I need to call a method on a list of objects to check for a certain value, but some of the objects might not be intialised. Thanks

multidimensional-array
tags question: http://stackoverflow.com/q/26857156
tags question: http://stackoverflow.com/q/26978083
tags question: http://stackoverflow.com/q/26989278
tags question: http://stackoverflow.com/q/26891114
tags question: http://stackoverflow.com/q/26899936
tags question: http://stackoverflow.com/q/26982737
tags question: http://stackoverflow.com/q/26875846
tags question: http://stackoverflow.com/q/26879503
type: Tag
tags question: http://stackoverflow.com/q/26897502
tags question: http://stackoverflow.com/q/26938780
tags question: http://stackoverflow.com/q/26834865
tags question: http://stackoverflow.com/q/26954135
tags question: http://stackoverflow.com/q/26840134
tags question: http://stackoverflow.com/q/26847351
tags question: http://stackoverflow.com/q/26906964
tags question: http://stackoverflow.com/q/26844514
tags question: http://stackoverflow.com/q/26943069
tags question: http://stackoverflow.com/q/26989965
tags question: http://stackoverflow.com/q/26961495
tags question: http://stackoverflow.com/q/26948689
tag name: multidimensional-array
tags question: http://stackoverflow.com/q/26876752
tags question: http://stackoverflow.com/q/26860190
tags question: http://stackoverflow.com/q/26915167

http://stackoverflow.com/comment/42395735
comment on: http://stackoverflow.com/a/26923498
score: 0
type: AnswerComment
has text: I dont know what Im doing but my dialog returns nothing.
type: Comment

http://stackoverflow.com/comment/42469020
has text: @MadProgrammer Thank you mad, how should I solve this situation? I can add an id for each object can maintain a Map<id,object>, though it is such an ugly solution.
comment on: http://stackoverflow.com/q/26965808
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26953614
type: Answer
has comment: http://stackoverflow.com/comment/42447790
has comment: http://stackoverflow.com/comment/42447766
accepted answer of: http://stackoverflow.com/q/26953567
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42447725
answers question: http://stackoverflow.com/q/26953567
type: AcceptedAnswer
downvote count: 0
has body: You don't seem to be entering more then one value (and you never store integers in your array). Also, you aren't setting the min. I think you wanted public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Number of integers to enter:"); int numberEnter = keyboard.nextInt(); int numbers[] = new int[numberEnter]; int pos = 0; do { System.out.printf("Please enter integer #%d/%d:%n", pos, numberEnter); numbers[pos++] = keyboard.nextInt(); } while (pos &lt; numberEnter &amp;&amp; keyboard.hasNextInt()); int min = numbers[0]; int max = numbers[0]; for (pos = 1; pos &lt; numbers.length; pos++) { if (numbers[pos] &lt; min) { // &lt;-- test min. min = numbers[pos]; } if (numbers[pos] &gt; max) { // &lt;-- test max. max = numbers[pos]; } } // Display everything. System.out.printf("%s Min: %d Max: %d%n", Arrays.toString(numbers), min, max); }

http://stackoverflow.com/a/27028592
score: 0
has body: Try using this for getting the number of coins: System.out.println("How many coins would you like to flip?"); BufferedReader br = new BufferedReader( new InputStreamReader(System.in)); String s = br.readLine(); numOfCoins = Integer.parseInt(br.readLine()); Note that you will have to import java.io.BufferedReader. Another thing I should mention is that the way you have set up your array won't work. You initialized it as an empty array and then you try to assign values to it in the for loop. It might be easier to do away with the array altogether and just use a counter in the for loop to see how many coins (either heads or tails) you get based on what the user chose. If you're really set on using arrays, you can establish a max number of coins to flip (ex: 10), then create an array of size 10 and fill in the values that way. Finally, you should check out Random's nextInt() function for an easy way to simulate a coin flip.
type: Answer
answers question: http://stackoverflow.com/q/26942635

http://stackoverflow.com/comment/42309869
has text: Be sure to check the JNLP using JaNeLA, available at my [share drive](https://drive.google.com/drive/#folders/0B5B9wDXIGw9lUnJaUjA2cmlVRE0).
comment on: http://stackoverflow.com/q/26868964
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26863903
type: Answer
downvote count: 0
has body: I am able to call overridden method of Activity from other class as ((name of Interface) context).documentRead(dataUnit);
answers question: http://stackoverflow.com/q/26863602
score: 2
upvote count: 2

http://stackoverflow.com/comment/52072750
has text: Did you get this to work?
score: 0
comment on: http://stackoverflow.com/q/26876620
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42327034
has text: Please Try with return Action.SUCCESS once.
comment on: http://stackoverflow.com/q/26881923
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42398073
comment on: http://stackoverflow.com/a/26925751
has text: Not necessarily, if the entity has been updated by another concurrent transaction this error would also occur.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/26888659
has comment: http://stackoverflow.com/comment/42342654
upvote count: 8
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/42355359
has comment: http://stackoverflow.com/comment/42342610
has body: What you need to do is create a RichTextString for your cell. That's the way of applying different formatting / styles to different parts of the same cell for display in Excel You'll want to review the POI "Working With Rich Text" example for more on how to use it, but broadly it'll be something like Cell cell = row.createCell(1); RichTextString rt = new XSSFRichTextString("The quick brown fox"); Font font1 = wb.createFont(); font1.setBoldWeight(Font.BOLDWEIGHT_BOLD); rt.applyFont(0, 10, font1); Font font2 = wb.createFont(); font2.setItalic(true); font2.setUnderline(XSSFFont.U_DOUBLE); rt.applyFont(10, 19, font2); Font font3 = wb.createFont(); font3.setBoldWeight(Font.BOLDWEIGHT_NORMAL); rt.append(" Jumped over the lazy dog", font3); cell.setCellValue(rt); That should give you a cell with a mixture of bold, italic+underline and normal
has comment: http://stackoverflow.com/comment/42355917
answers question: http://stackoverflow.com/q/26885834
has comment: http://stackoverflow.com/comment/42342890
has comment: http://stackoverflow.com/comment/42336255
has comment: http://stackoverflow.com/comment/42356267
has comment: http://stackoverflow.com/comment/42343030
downvote count: 0
has comment: http://stackoverflow.com/comment/42332172
has comment: http://stackoverflow.com/comment/42336704
has comment: http://stackoverflow.com/comment/42341919

http://stackoverflow.com/q/26967437
tagged with: spring
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42471746
tagged with: java
answer count: 1
tagged with: url
has comment: http://stackoverflow.com/comment/42471697
has body: I have a question regarding navigation. Currently this is my URL http://localhost:8080/spring/Account/ump I would like to navigate to **http://localhost:8080/spring/Scheduler/test** this is the URL i am trying to hit but i cannot find the correct ahref code to achieve My Code test page I have tried alternatives such as test page The result would be http://localhost:8080/Scheduler/test and for the redirect result it will be redirect:/Scheduler/test I use a InternalResourceViewResolver if it matters.
score: 0
accepted answer: http://stackoverflow.com/a/26967572
has comment: http://stackoverflow.com/comment/42471657
has comment: http://stackoverflow.com/comment/42471631
has title: Navigating in spring URL
has comment: http://stackoverflow.com/comment/42471680
has answer: http://stackoverflow.com/a/26967572
has comment: http://stackoverflow.com/comment/42471686

http://stackoverflow.com/a/26906897
type: Answer
has body: i think you are simply printing the value, first store it in some variable then compare: String userage = age.nextLine(); int a=Integer.valueOf(userage); if (a &gt;= 15){ System.out.println("welcome to Azura World"); }else{ System.out.println("insufficient experience"); }
score: 0
answers question: http://stackoverflow.com/q/26906752

http://stackoverflow.com/a/26929816
has comment: http://stackoverflow.com/comment/42405380
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26929739
score: 1
has body: You only need to get the text from the textfield. player.add(txt.getText()) This will do what you want to have. There you will get the current String which is in the TextField. So you can add it into your List.

http://stackoverflow.com/q/26921133
favorite count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/26921157
has body: I am trying to get HashMap store a String and a ArrayList&lt;String&gt;. Basicly what I want is for the first String to be a Name, and the arraylist to contain every country the user have been to. Example: {Andrew, [USA, China]} {Lola, [Sweden, Denmark]} The problem I meet is whenever the user puts in a country, the country will be stored under both names: "The HashMap contains: {Andrew=[USA, China, Sweden, Denmark], Lola=[USA, China, Sweden, Denmark]}" ArrayList&lt;String&gt; namelist = new ArrayList&lt;&gt;(); ArrayList&lt;String&gt; test = new ArrayList&lt;&gt;(); ArrayList&lt;String&gt; archive = new ArrayList&lt;&gt;(); HashMap&lt;String, ArrayList&lt;String&gt;&gt; thearchive = new HashMap&lt;&gt;(); (input.equals("New Country")){ System.out.println("Name of the Person? "); String name = in.nextLine(); if(namelist.contains(name)){ System.out.println("Which Country have you visited?"); String country = in.nextLine(); if (archive.contains(country)){ System.out.println("You've already visited this country."); } else { test.add(country); thearchive.put(name, country); System.out.println("HashMap Contains: " + thearchive); } } else{ System.out.println("The person does not exist please add first."); } Does someone knows why the HashMap is not storing the key/values the way I want too?
has answer: http://stackoverflow.com/a/26921248
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/42390325
tagged with: hashmap
downvote count: 0
has title: HashMap<String, ArrayList<String>>
score: 3

http://stackoverflow.com/comment/42449541
comment on: http://stackoverflow.com/q/26954169
has text: I haven't tried to understand your whole code, but there's something that calls to mind: you run some asynchronous code by using Callable and an ExecutorService, which means that you'll have several tasks executed in parallel. But you never call awaitTermination, which means that your program may end before everything is executed. It may result in unexpected behaviours, like the one you're pointing out.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42346158
score: 1
comment on: http://stackoverflow.com/q/26895462
has text: Please refine the question so others are able to understand the problem you have to solve. What is the format of the file? What is the expected output of your solution? It is not at all clear ...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26923728
has title: interface ServletContextListener don't save state of ServletContext
tagged with: java
has comment: http://stackoverflow.com/comment/42394514
type: Question
has comment: http://stackoverflow.com/comment/42394679
score: 0
answer count: 1
tagged with: websocket
has answer: http://stackoverflow.com/a/28052290
type: UnansweredQuestion
tagged with: servletcontextlistener
has body: I have next websocket @ServerEndpoint(value="/list") public class WebSocketList implements ServletContextListener { private ServletContextEvent sce; @Override public void contextInitialized(ServletContextEvent sce) { System.out.println("contextInitialized"); this.sce = sce; } @OnMessage public void receiveMessage(ByteBuffer bb, Session sn) { if (sce == null) System.out.println("not good"); } File beans.xml <?xml version="1.0" encoding="UTF-8"?> In debug, the object ServletContextEvent in method contextInitialized was not null, but when I receive a message from client (in method receiveMessage), always logs "not good" - object ServletContextEvent is null. UPDATE: When I add System.out.println(this) in both methods, logged next - WebSocketList@da599a0 WebSocketList@2942d8d0

http://stackoverflow.com/comment/42404989
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26929810
has text: Is the URL correctly encoded?

http://stackoverflow.com/comment/42495533
type: Comment
type: QuestionComment
has text: @OlaviMustanoja It's just a method to read a file and dump in a text to write out current texts. If you don't want to help you just could stay away. I don't need your comments, it's not encouraging.
comment on: http://stackoverflow.com/q/26979817
score: 0

http://stackoverflow.com/comment/42499322
type: Comment
comment on: http://stackoverflow.com/q/26980363
score: 0
has text: *My issue is that I have a Spring model*. But I don't see how Spring is involved here.
type: QuestionComment

http://stackoverflow.com/comment/42495424
comment on: http://stackoverflow.com/q/26980008
score: 0
type: Comment
type: QuestionComment
has text: Tried that once. Not true. Unfotunately, in SO you get voted down for nice puzzeles like this one, even if you phrased your question as a puzzle...

http://stackoverflow.com/comment/42245479
has text: @Peanut actually problem is not null value of user..if i give wrong path of a image then it saves it,,if user is null it wont happen,so user is not null,i am sure .
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26838821

http://stackoverflow.com/a/26884511
type: Answer
score: 1
upvote count: 1
has body: From your Lives object, you can just call super.setFont(font); to call the setFont() method on Glabel. If your Lives class doesn't overrides the setFont() method, you can also directly call setFont(font); without the super prefix.
downvote count: 0
answers question: http://stackoverflow.com/q/26884452

http://stackoverflow.com/a/26972012
accepted answer of: http://stackoverflow.com/q/26967432
type: AcceptedAnswer
score: 0
has body: Internally spring uses org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor for namespace of task:executor and org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler for task:scheduler. Refer respective API docs here and here
type: Answer
has comment: http://stackoverflow.com/comment/42506492
answers question: http://stackoverflow.com/q/26967432

http://stackoverflow.com/q/26843375
has comment: http://stackoverflow.com/comment/42250077
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/42250094
has answer: http://stackoverflow.com/a/26843399
has answer: http://stackoverflow.com/a/26843421
answer count: 3
tagged with: android
has body: I have file at path like "file:///storage/emulated/0/Android/data/com.testcompany.tesapp/files/recs/1234-7896-9076.mp4" videoView.setVideoURI(Uri.parse("file:///storage/emulated/0/Android/data/com.testcompany.tesapp/files/recs/1234-7896-9076.mp4")) the playback starts but I get an error like this 11-10 14:12:30.909: E/MediaPlayer(1022): Error (1,-2147483648) I searched on this error and it says it is unknown MediaPlayer error so how to avoid it.
has answer: http://stackoverflow.com/a/26843498
type: UnansweredQuestion
has title: Getting error in play local video android
tagged with: android-mediaplayer

http://stackoverflow.com/q/26929247
tagged with: sorting
tagged with: jtable
answer count: 2
score: 2
tagged with: user-interface
has answer: http://stackoverflow.com/a/26929787
downvote count: 0
has comment: http://stackoverflow.com/comment/42404169
has body: Please have a look at the below code. import java.awt.*; import java.awt.event.*; import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.*; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.*; import javax.swing.table.*; public class TableBasic extends JFrame { final Class&lt;?&gt;[] columnClasses = new Class&lt;?&gt;[] {Date.class, String.class, Long.class, Boolean.class}; public TableBasic() { String[] columnNames = {"Date", "String", "Long", "Boolean"}; Object[][] data = { {getJavaDate("13-11-2020"), "A", new Long(1), Boolean.TRUE }, {getJavaDate("13-11-2018"), "B", new Long(2), Boolean.FALSE}, {getJavaDate("12-11-2015"), "C", new Long(9), Boolean.TRUE }, {getJavaDate("12-11-2015"), "D", new Long(4), Boolean.FALSE}, {null, null, null, null}, {getJavaDate("12-11-2016"), "N/A", new Long(16), Boolean.FALSE} }; DefaultTableModel model = new DefaultTableModel(data, columnNames) { @Override public Class&lt;?&gt; getColumnClass(int column) { return columnClasses[column]; } }; JTable table = new JTable(); table.setModel(model); table.setPreferredScrollableViewportSize(table.getPreferredSize()); table.setAutoCreateRowSorter(true); table.getColumnModel().getColumn(0).setCellRenderer(tableCellRenderer); // Sort the rows DefaultRowSorter sorter = ((DefaultRowSorter)table.getRowSorter()); ArrayList list = new ArrayList(); list.add( new RowSorter.SortKey(0, SortOrder.DESCENDING) ); sorter.setSortKeys(list); sorter.sort(); JScrollPane scrollPane = new JScrollPane( table ); getContentPane().add( scrollPane ); } //Use the Cell Renderer to convert date formats private TableCellRenderer tableCellRenderer = new DefaultTableCellRenderer() { SimpleDateFormat f = new SimpleDateFormat("dd-MM-yyyy"); public Component getTableCellRendererComponent(JTable table,Object value, boolean isSelected, boolean hasFocus,int row, int column) { if( value instanceof Date) { value = f.format(value); } return …
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/42404137
type: UnansweredQuestion
tagged with: swing
has title: Sort the JTable except the last 2 rows
linked to: http://stackoverflow.com/q/6187566
linked to: http://stackoverflow.com/q/26860204
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26930289
linked to: http://stackoverflow.com/q/10262521

quicksort
tags question: http://stackoverflow.com/q/26838126
tags question: http://stackoverflow.com/q/26943356
tags question: http://stackoverflow.com/q/26835190
tags question: http://stackoverflow.com/q/26869505
tags question: http://stackoverflow.com/q/26954882
tags question: http://stackoverflow.com/q/26953114
tag name: quicksort
type: Tag

http://stackoverflow.com/a/26889423
answers question: http://stackoverflow.com/q/26889258
type: Answer
has body: Two suggestions: Learn How to Write a Mouse Listener - You will definitely need to know this; particularly the mouseEntered() and mouseExited() methods. If you don't need all the methods of the MouseListener interface, you can extend the MouseAdapter abstract class and overriding those two methods I mentioned. Learn How to Use Layered Panes - I think you can take advantage of layered panes to achieve what you want by giving the appearance that the tile has changed colors when the above mouse events are triggered. UPDATE: I found this Stackoverflow post that might be exactly what you need to do. Go there and try the suggested code and try to adapt it to what you are trying to do. I believe it will work great for your particular case.
score: 0

http://stackoverflow.com/q/26859978
has body: I am using java mail to send mail to a sender.But my problem is that i am not able to send multiple information in one mail body only one information is coming.But i want to send multiple information in one mail ,Here i have so far Properties props = System.getProperties(); props.put("mail.smtp.user", senderEmail); props.put("mail.smtp.host", gmail); props.put("mail.smtp.port", port); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.smtp.debug", "true"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.socketFactory.port", port); props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "false"); // Required to avoid security exception. MyAuthenticator authentication = new MyAuthenticator(senderEmail,senderMailPassword); Session session = Session.getInstance(props,authentication); session.setDebug(true); Message message = new MimeMessage(session); message.setFrom(new InternetAddress(senderEmail)); message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(recipeintEmail)); /*message.setRecipients(Message.RecipientType.CC,InternetAddress.parse(WebConstants.AdminMail));*/ message.setSubject("Password Recovery mail"); message.setText(resetLink); message.setText("1236547"); message.setText("Here is another text"); message.setContent(messageText, "text/html; charset=utf-8"); //message.setText(messageText); Transport transport = session.getTransport("smtps"); transport.connect(gmail,port, senderEmail, senderMailPassword); transport.sendMessage(message, message.getAllRecipients()); transport.close(); My problem is that only the first setText is working,not the other two.Can anyone help??
has title: How to send multiple information in mail using java mail API
score: 1
tagged with: java
type: Question
tagged with: jakarta-mail
has comment: http://stackoverflow.com/comment/42280719
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26860065
has comment: http://stackoverflow.com/comment/42280702
has comment: http://stackoverflow.com/comment/42280723
tagged with: email
downvote count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/42472284
comment on: http://stackoverflow.com/q/26967797
has text: Are you trying to display debug level log messages for java.util.logging or log4j
score: 0
type: Comment
type: QuestionComment

ebean
tags question: http://stackoverflow.com/q/26975810
tags question: http://stackoverflow.com/q/26934354
tags question: http://stackoverflow.com/q/26889801
tags question: http://stackoverflow.com/q/26963576
tags question: http://stackoverflow.com/q/26920381
tags question: http://stackoverflow.com/q/26878984
tags question: http://stackoverflow.com/q/26931787
tags question: http://stackoverflow.com/q/26959101
type: Tag
tag name: ebean

http://stackoverflow.com/comment/42453860
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26957315
has text: Please show the code you have, and specify exactly what part that doesn't work.

http://stackoverflow.com/q/26849139
answer count: 1
has comment: http://stackoverflow.com/comment/42261003
has comment: http://stackoverflow.com/comment/42260931
tagged with: android
has comment: http://stackoverflow.com/comment/42261035
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26849186
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/42261134
has title: JAVA JSONObject with prepared data
type: Question
has body: Sorry, I started teach java few days ago and didn't find a solution in google. I know that I can do this: JSONOblect x = new JSONObject; JSONOblect y = new JSONObject; y.put("a","b"); x.put("c",y); I just want to ask is there any way to add one object into other something like JSONObject x = new JSONObject(); x.put("c", new JSONObject{"a":"b"}); I have a lot of objects one inside other and if I declare each as variable - it will be very long.
accepted answer: http://stackoverflow.com/a/26849186
score: 0

http://stackoverflow.com/comment/42254965
comment on: http://stackoverflow.com/q/26845695
type: Comment
type: QuestionComment
has text: As far as I have seen from the 1.35 sources, this doesn't seem to be possible.
score: 0

http://stackoverflow.com/q/26906029
type: UnansweredQuestion
tagged with: jetty
has body: I am currently creating a Docker file for building our webapp in java, and I am running into an issue in regards to having to use a custom .cert key to log over SSL using logstash-logback-forwarder, while the webapp itself needs to do SSL connections (connecting to SOAP SSL). The thing is, I am able to log over SSL, and the webapp can use the SOAP API securely fine (it has always been able to do this), but I can't do both at the same time. For starters, here are the relevant parts of my docker build file ADD logstash-forwarder.crt /root/logstash-forwarder.crt RUN (cd /root &amp;&amp; /usr/java/latest/bin/keytool -import -file logstash-forwarder.crt -alias logstash -storepass SOMEPASS -noprompt -keystore logstash.keystore) This adds the crt file, and then uses the keytool to import into the keyStore. I am using logstash-logback-forwarder, which uses the standard SSLSocketFactory (i.e. https://github.com/logstash/logstash-logback-encoder/blob/master/src/main/java/net/logstash/logback/appender/SSLLogstashTcpSocketAppender.java) Then I run my java site (through jetty-webrunner), using this command CMD java -Dlogback.configurationFile=/root/logback.xml \ -Djavax.net.ssl.keyStorePassword=SOMEPASS \ -Djavax.net.ssl.keyStoreType=pkcs12 \ -Djavax.net.ssl.trustStoreType=jks \ -Djavax.net.ssl.trustStore=logstash.keystore \ -Djavax.net.ssl.trustStorePassword=SOMEPASS \ -server -ea -XX:+UseConcMarkSweepGC \ -XX:+CMSClassUnloadingEnabled \ -Xmx2048M -jar jetty-runner-9.2.3.v20140905.jar \ --port 8080 \ --lib "/root/lib" \ --config jetty.xml \ jetty-web.xml Now with the following command, the secure logging works fine over SSL, the problem is, the webapp is no longer able to securely connect to a SOAP API that it needs to use, I get the following error (java stacktrace provided) AxisFault faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException faultSubcode: faultString: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path bui…
answer count: 0
downvote count: 0
tagged with: java
type: Question
score: 3
has title: Setting up Jetty Runner with custom Cert in Docker Build File
tagged with: ssl
tagged with: docker
has comment: http://stackoverflow.com/comment/42409216
upvote count: 3
tagged with: logstash
favorite count: 0

http://stackoverflow.com/a/26852152
answers question: http://stackoverflow.com/q/26851096
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42272246
type: Answer
has comment: http://stackoverflow.com/comment/42272227
score: 3
has comment: http://stackoverflow.com/comment/42315780
upvote count: 3
has body: Here is the simplest solution: import org.hibernate.validator.constraints.Length; import org.hibernate.validator.constraints.NotEmpty; ... @Length(max = 40, message = "First name is too long") @NotEmpty(message = "First Name is required.") @Column(name = "FIRST_NAME") private String firstName; and here you can find maven dependency: org.hibernate hibernate-validator 4.3.0.Final org.hibernate.javax.persistence hibernate-jpa-2.0-api
accepted answer of: http://stackoverflow.com/q/26851096
has comment: http://stackoverflow.com/comment/42320279

ucanaccess
tag name: ucanaccess
tags question: http://stackoverflow.com/q/26938076
type: Tag

http://stackoverflow.com/comment/42454041
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26956095
has text: @MaxSteel You need to put in some data migration step where you convert the entire database between the two keys. That said; passwords aren't supposed to be decryptable (since they are hashed not encrypted)
score: 0

http://stackoverflow.com/comment/42250895
comment on: http://stackoverflow.com/q/26842125
has text: Isn't this simply setting the JAVA_HOME environment variable for the non-admin user? Environment variables are set per user. On Windows 8.1, press the Windows key to bring up the Start page, type 'environment' to search and click on the Settings category. You'll see 'Edit environment variables for your account'.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/26929861
type: Question
has title: How to count Java PrefixAverages algorithm
accepted answer: http://stackoverflow.com/a/26930213
upvote count: 0
has body: there I have these two algorithms that are implemented from Pseudo code. My question is how can I count primitive operations and derive T(n) for both algorithms and also to find out the time complexity of (Big-Oh, O(n)) of each algorithm? public class PrefixAverages1 { static double array[] = new double[10]; public static void prefixAverages(){ for (int i = 0; i &lt; 10; i++){ double s = array[i]; for (int j = 0; j &lt; 10; j++){ s = s + array[j]; } array[i] = s / (i + 1); System.out.println(Arrays.toString(array)); } } public static double[] prefixAverages(double[] inArray) { double[] outArray = new double[inArray.length]; return outArray; } public static void main(String... args) { System.out.println( Arrays.equals( prefixAverages(new double[] {5, 6, 7, 8}), new double[] {2, 2.5, 3.5, 4} ) ); } } Prefix2 import java.util.Arrays; public class PrefixAverages2 { static double array[] = new double[10]; public static void prefixAverages(){ double s = 0; for (int i = 0; i &lt; 10; i++){ s = s + array[i]; array[i] = s / (i + 1); } array[0] = 10; System.out.println(Arrays.toString(array)); } public static double[] prefixAverages(double[] inArray) { double[] outArray = new double[inArray.length]; return outArray; } public static void main(String... args) { System.out.println( Arrays.equals( prefixAverages(new double[] {3, 4, 5, 6}), new double[] {2, 3.5, 4, 5} ) ); } }
answer count: 1
favorite count: 0
score: -3
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/26930213

http://stackoverflow.com/comment/42419966
score: 0
has text: Nevertheless, I tried this "M"CVE, and for me, it worked properly. (I only tried a small file, but the slider started moving immediately...)
comment on: http://stackoverflow.com/q/26905208
type: QuestionComment
type: Comment

getparameter
tag name: getparameter
type: Tag
tags question: http://stackoverflow.com/q/26906939
tags question: http://stackoverflow.com/q/26838230

http://stackoverflow.com/q/26896046
has answer: http://stackoverflow.com/a/27264111
accepted answer: http://stackoverflow.com/a/27264111
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/32808941
tagged with: java
type: Question
upvote count: 4
tagged with: jsoup
possible better answer: http://stackoverflow.com/a/26896474
has comment: http://stackoverflow.com/comment/42345823
has title: Jsoup connect(): bypass google captcha
answer count: 3
has comment: http://stackoverflow.com/comment/42345713
has comment: http://stackoverflow.com/comment/42345621
favorite count: 0
has answer: http://stackoverflow.com/a/26896474
has body: I make a small application and I have to retrieve the URL based on keywords. This is the code: Elements doc = Jsoup .connect(request) .userAgent( "Mozilla 5.0 (Windows NT 6.1)") .timeout(5000).get().select("li.g&gt;h3&gt;a"); for (Element link : doc) { String url = link.absUrl("href"); try { url = URLDecoder.decode(url.substring(url.indexOf('=') + 1, url.indexOf('&amp;')), "UTF-8"); } catch (UnsupportedEncodingException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(!url.startsWith("http")) continue; // Ads/news/etc. else if(url.contains("/pdf/")) continue; else if(url.contains("//github.com/")) continue; res.add(url); } just get the following error: org.jsoup.HttpStatusException: HTTP error fetching URL. Status=503, URL=http://ipv4.google.com/sorry/IndexRedirect?continue=http://www.google.com/search%3Flr%3Dlang_en.... at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:435) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:446) at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:410) at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:164) at org.jsoup.helper.HttpConnection.get(HttpConnection.java:153) at sperimentazioni.Main.getDataFromGoogle(Main.java:327) at sperimentazioni.Main.getURLs(Main.java:164) at sperimentazioni.Main.main(Main.java:485) Apparently it is the captcha google, how can I bypass?
downvote count: 2

http://stackoverflow.com/q/26885781
has answer: http://stackoverflow.com/a/26887964
downvote count: 0
tagged with: jsp
has body: How to pass the control from interceptor to a JSP. I have an interceptor where I make checks whether app server is up or down by reading a flag from Database. If app is down I need to redirect the control to JSP from the current interceptor. I tried declaring a result in but it didn't work for me. maintenancePage.jsp Can any one suggest what to do?
tagged with: struts2
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/26887964
tagged with: actionresult
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to redirect the control from interceptor to jsp incase of error in interceptor
type: Question
tagged with: configuration

http://stackoverflow.com/comment/42509413
type: QuestionComment
comment on: http://stackoverflow.com/q/26988189
has text: why do you need to know that? it's a private, internal method implementing some action, why is it so important to understand rotation changes?
score: 0
type: Comment

http://stackoverflow.com/q/26906438
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/26908575
type: Question
accepted answer: http://stackoverflow.com/a/26925359
score: 5
upvote count: 5
has title: How to retrieve relationship mapping in hibernate?
possible better answer: http://stackoverflow.com/a/26906758
has answer: http://stackoverflow.com/a/26906758
answer count: 3
downvote count: 0
favorite count: 0
has body: I need to get the relationship between two model classes. For example In database, I have two tables table1 and table2. where table2 has foreign key of table1. I have two classes Table1 and Table2 that maps to these tables respectively and has a relationship mapping One to One. Now, from java code I need to retrieve what relationship do they have? i.e the output should be one-to-one for above example.
has answer: http://stackoverflow.com/a/26925359
type: AnsweredQuestion

http://stackoverflow.com/a/26866900
has comment: http://stackoverflow.com/comment/42362330
has comment: http://stackoverflow.com/comment/42361968
has comment: http://stackoverflow.com/comment/42327982
has comment: http://stackoverflow.com/comment/42362146
score: 0
answers question: http://stackoverflow.com/q/26862513
has comment: http://stackoverflow.com/comment/42362576
type: Answer
has comment: http://stackoverflow.com/comment/42326973
has body: If your Project Root Directory is SRDM, then you need to get back from your executable path. Say you have your exe file at SRDM/Svr/bin/EXECUTABLE.exe then, you need to mention in xml as &lt;srv:ConfigurationResource="../IdP/IdPserver/conf/attribute-r.xml"&gt;&lt;/srv&gt; ie. Current working directory is SRDM/Svr/bin/ and from that you need to get back up to common junction[Svr] in your case.
has comment: http://stackoverflow.com/comment/42362598
has comment: http://stackoverflow.com/comment/42362585
has comment: http://stackoverflow.com/comment/42362379

http://stackoverflow.com/q/26973933
downvote count: 0
has title: Cancel ejb timer on rollback
has body: Is there any way to make sure a periodic (every 10 seconds) and persistent timer is cancelled when an exception occurs? The implementation of the @Timeout method is something like this (simplified from legacy code): @Timeout @TransactionAttribute(REQUIRES_NEW) public void onTimeout(Timer timer) { try { doSomeBusinessLogic(); } catch (Exception e) { // throwing this exception makes sure rollback is triggered throw new EJBException(e); } } Upon any exception in doSomeBusinessLogic(), its transaction needs to be rolled back. This is working fine. However, I would also make sure that the timer is cancelled. The straightforward solution is to put timer.cancel() in the catch block. This is not working, however, because the cancelling will also be rolled back (JEE6 Turorial): An enterprise bean usually creates a timer within a transaction. If this transaction is rolled back, the timer creation also is rolled back. Similarly, if a bean cancels a timer within a transaction that gets rolled back, the timer cancellation is rolled back. In this case, the timer’s duration is reset as if the cancellation had never occurred. How can I make sure that the timer is cancelled (preventing any further timeouts) if an exception/rollback occurs? Setting a maximum nuber of retries would also be sufficient, but I don't think this is supported by JBoss. Application server is JBoss AS 7.2.
has answer: http://stackoverflow.com/a/55297325
answer count: 3
tagged with: jboss7.x
favorite count: 0
tagged with: timer
has answer: http://stackoverflow.com/a/26976473
upvote count: 1
possible better answer: http://stackoverflow.com/a/26974247
has answer: http://stackoverflow.com/a/26974247
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: ejb-3.1
accepted answer: http://stackoverflow.com/a/26976473
type: Question
tagged with: jakarta-ee

http://stackoverflow.com/comment/42249608
type: AnswerComment
type: Comment
has text: Is this your solution? If yes mark it as soon as possible and vote up other good answers.
comment on: http://stackoverflow.com/a/26842646
score: 0

http://stackoverflow.com/comment/42339684
comment on: http://stackoverflow.com/a/26892794
type: Comment
has text: But this works only if LAN is class D, right? This won't work for IP like 87.249.5.218
score: 0
type: AnswerComment

http://stackoverflow.com/a/26844493
has comment: http://stackoverflow.com/comment/42321204
has comment: http://stackoverflow.com/comment/42294801
has comment: http://stackoverflow.com/comment/42320703
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26843524
has comment: http://stackoverflow.com/comment/42320245
has comment: http://stackoverflow.com/comment/42287811
has body: It might be that your org.apache.commons.dbcp.DelegatingConnection is a different class (different classloader) than the org.apache.commons.dbcp.DelegatingConnection from the connection. this can be, if you are supplying this class via your container-bound warfile, and the connection is instantiated via tomcat (or other application server). to test this you can use something like: Class.forName("org.apache.commons.dbcp.DelegatingConnection").getClassLoader().toString() conn.getClassLoader().toString(); you might be able ot use reflection. this from a similar question: // 'source' is from another classloader Method method = conn.getClass().getMethod("getInnermostDelegate", new Class[] {}); Object o = method.invoke(conn, new Object[] {}); However, i'm not sure the return argument is easily castable to a class in your current classloader. If you follow the reflection method, make absolutely sure you encapsulate all of this in a single class, don't let things like Method and Object bleed out from this. I don't recommend this but it ought to work. an alternative is to place your code in the same place as the connection. (tomcat lib) ofcourse first check if indeed you are using 2 different classloaders for your code. :D EDIT: From the comments it looks like there are 2 classloaders at work here. I forgot to mention a 3rd approach. preferred: remove the jar file that supplies DelegatingConnection from your war file and rely on it being supplied by the common/lib classloader. run your code in the common/lib classloader by placing the war there reflect : probably bad, probably will give trouble casting the result object to the right class
has comment: http://stackoverflow.com/comment/42598952
has comment: http://stackoverflow.com/comment/42320830
has comment: http://stackoverflow.com/comment/42602686
has comment: http://stackoverflow.com/comment/42294756
has comment: http://stackoverflow.com/comment/42321170
has comment: http://stackoverflow.com/comment/42317829
has comment: http://stackoverflow.com/comment/42320988

http://stackoverflow.com/a/26988030
answers question: http://stackoverflow.com/q/26955663
has body: From their mailing list: There is no support for non-blocking I/O in JAX-RS 2.0. It is one of the features planned for JAX-RS 2.1 in Java EE 8 .At this point, if you're interested in a portable solution, you'd need to build this on top of Servlet 3.1.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26955663

http://stackoverflow.com/a/26931234
has body: You may be able to use wildfly:shutdown (with the reload option) to achieve the effect of a restart in JBoss EAP 6.x. The success of this may depend on the accessibility of the control port, so an SSH tunnel may be needed. I'm not sure if you can achieve this in your environment though. Try to get it working on a JBoss EAP instance running on an accessible LAN first.
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/26920034
answers question: http://stackoverflow.com/q/26920034
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26931864
has comment: http://stackoverflow.com/comment/42409199
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/42409056
tagged with: java
has title: Printing an image in Netbeans/Java
type: Question
score: 0
has body: I am creating a program for an online class at school where I have to print a specified amount, shape, and color of balloons to... well I don't know what to print it too. There was no information in the notes before it on where i print pictures of balloons to and i've learned nothing about displaying a picture or about gui's.I'm lost and have no clue what to do. Please Help :) Here is what I was assigned to do: Write the necessary Java source code. Write the Java source code necessary to build a solution for the following problem: You have been asked by the local first grade parents' group to create a software package that helps them to teach their children colors. To that end, you have decided to create a program called "Balloons" that allows the child to enter in the number of balloons and the color of each. Then, your program will draw that many balloons on the screen and color them the correct color. You should create a "draw balloon" method that draws the requested number of balloons on the screen. Each balloon should be colored the correct color. Initially, all of the balloons should be created as circles. Next, you should allow the child to select a shape for each balloon and draw the correct number of balloons with the correct shape and color. Before you create this program, create a formal storyboard for it. Rather than writing a new method for "draw balloon" when the shape changes, reuse the initial method.
answer count: 1
has answer: http://stackoverflow.com/a/26932150
accepted answer: http://stackoverflow.com/a/26932150
has comment: http://stackoverflow.com/comment/42409159

http://stackoverflow.com/q/26971767
type: UnansweredQuestion
tagged with: maven
tagged with: web-services
has comment: http://stackoverflow.com/comment/42479608
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42479446
has comment: http://stackoverflow.com/comment/42479545
has comment: http://stackoverflow.com/comment/42480054
has comment: http://stackoverflow.com/comment/42480205
score: 0
has title: Too many parameters error?
tagged with: axis
has comment: http://stackoverflow.com/comment/42479726
has body: I am generating classes from WSDL using axistools-maven-plugin. But the generated class has too many params as constructor argument and is giving below error. Too many parameters, parameter "myParam" is exceeding the limit of 255 words eligible for method parameters.
has comment: http://stackoverflow.com/comment/42479889
has comment: http://stackoverflow.com/comment/42489712
has comment: http://stackoverflow.com/comment/42479476

http://stackoverflow.com/a/26899818
has comment: http://stackoverflow.com/comment/42369820
has body: I recommend you to use REGEX_EXTRACT build-in command, this will be very easy instead of writing UDF. ld = LOAD 'input.txt' AS (date:chararray); loop = foreach ld generate REGEX_EXTRACT(date,'(Oct\\W(?:1[5-9]|2[0-3])\\W(?:(?:0?9|10):\\d{2}:\\d{2}|11:00:00))',1) as d:chararray; C = FILTER loop by d is not null; D = FOREACH C GENERATE $0; DUMP D; Output: (Oct 15 09:26:09) (Oct 23 10:26:09) Your Regex UDF also working fine for me. i just copied your input and java code and executed locally. It works perfectly. Please see the below output that i got from your UDF code. I guess you may need to check your classpath are properly set or not. (Oct 15 09:26:09) (none) (none) (Oct 23 10:26:09) (none) (none)
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26898622
answers question: http://stackoverflow.com/q/26898622
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/42428649
comment on: http://stackoverflow.com/a/26942333
type: Comment
has text: It should be easy to see if there is a leak or really a gigantic backstack: if an activity stays in memory after `onDestroy` (and garbage collection) you have a leak, otherwise android references it because it considers it still valid.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42365359
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26907068
has text: @RedBaron how many pages do you have?what is the question page,what is the answer page and where do you want to show the results.Mention everything in clear,
type: AnswerComment

http://stackoverflow.com/q/26938205
has comment: http://stackoverflow.com/comment/42423834
has comment: http://stackoverflow.com/comment/42495981
favorite count: 0
has comment: http://stackoverflow.com/comment/42496079
has answer: http://stackoverflow.com/a/27195123
has comment: http://stackoverflow.com/comment/42424407
has comment: http://stackoverflow.com/comment/42492243
has comment: http://stackoverflow.com/comment/42422175
has comment: http://stackoverflow.com/comment/42424095
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42496337
has comment: http://stackoverflow.com/comment/42873184
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/42495530
tagged with: gradle
has comment: http://stackoverflow.com/comment/42422098
type: Question
score: 3
has comment: http://stackoverflow.com/comment/42495919
has comment: http://stackoverflow.com/comment/42496055
has comment: http://stackoverflow.com/comment/42495842
accepted answer: http://stackoverflow.com/a/27195123
has title: Gradle generate Eclipse project EAR project
tagged with: eclipse
has body: I'm migrating a legacy project from ant to gradle (to use its dependency management and build features) and I'm facing a problem when generating the eclipse projects. The big problem today is because the project has some subprojects that are split into war and jar packages to deploy into a single ear. This is made by ant today. To use gradle I split the eclipse projects into separate jar and war projects. So I have the following structure: ProjectRoot -lib -Project1.jar -Project1.war -Project2.jar -Project3.war And here's my gradle file: apply plugin: 'ear' def jboss_home = '/home/augusto/Development/servers/jboss6X' def deploy_name = 'default' allprojects { repositories { mavenCentral() } apply plugin: 'eclipse' apply plugin: 'eclipse-wtp' } dependencies { deploy project(path: 'Project1.jar', configuration: 'archives') deploy project(path: 'Project1.war', configuration: 'archives') deploy project(path: 'Project2.jar', configuration: 'archives') deploy project(path: 'Project2.war', configuration: 'archives') earlib fileTree(dir: 'lib', include: '*.jar') } ear { libDirName = "lib" deploymentDescriptor { applicationName = "MyApp" initializeInOrder = true displayName = "MyApp" module("Project1.jar", "java") module("Project2.jar", "java") webModule("Project1.war", "/Project1") webModule("Project2.war", "/Project2") } } project('MyJarLib') { apply plugin: 'java' dependencies { compile files('../lib/ajar.jar') compile fileTree(dir: jboss_home + '/common/lib', include: '*.jar') compile fileTree(dir: jboss_home + '/client', include: '*.jar') compile fileTree(dir: jboss_home + '/lib', include: '*.jar') compile fileTree(dir: jboss_home + '/server/' + deploy_name + '/lib', include: '*.jar') } } project('Project1.jar') { apply plugin: 'java' dependencies { compile 'org.apache.poi:poi:3.2-FINAL', 'jdom:jdom:1.1' compile project(':MyJarLib.jar') } } project('Project1.war') { apply plugin: 'war' } project('Project2.jar') { apply plugin: 'java' dependencies { compile 'net.sf.jasper…
has comment: http://stackoverflow.com/comment/42424121
tagged with: ear
has comment: http://stackoverflow.com/comment/42495646
answer count: 1
has comment: http://stackoverflow.com/comment/42498245
downvote count: 0

http://stackoverflow.com/a/26842987
score: 0
has body: long n = i2.get(0); double x = n; double y = Double.longBitsToDouble(n); You need to get the data from the buffer. Use x above. The variant where the long in the LongBuffer actually is a binary double (quiote unlikely) is covered with y. In general search for LongBuffer and inspect the API from the javadoc.
type: Answer
answers question: http://stackoverflow.com/q/26842839

http://stackoverflow.com/a/74784885
type: Answer
has body: There is a catch 22 when using the Javascript API Client generator. This is caused by the fact that Wildfly/JBoss only loads a JAXRS application on demand. The JSAPIServlet must be configured to generate the client Javascript code. The client then includes this javascript script in the page. The browser then tries to fetch the client javascript which activates the JSAPI servlet. The JSAPI servlet then scans for any loaded JAXRS applications and finds none (because they are only loaded on demand). The JSAPI Servlet then returns error html code instead of the required javascript. The client code tries to use the Javascript API to make a call to the JAXRS application and cannot because the required client script is invalid. So the client cannot make a call to the JAXRS endpoint becuase it does not have the script and the JSAPIServlet will only generate the script if the JAXRS endpoint is loaded, hence the catch 22. An obvious solution would be to to use a @ApplicationPath annotation parameter to force a load-on-start similar to that on a @WebServlet(load-on-start=1), however this does not appear to be possible! There are three possible solutions that I know of to bypass this problem: Solution 1 After deployment immediately make a call to a JAXRS endpoint to force the loading of the application. This must be done before the client javascript is loaded. This is a bad idea for so many reasons. Solution 2 Do this all manually in the web.xml. Using the following web.xml to force the JAXRS application to load on startup: MyApplication org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher 1 javax.ws.rs.Application com.mydomain.api.MyJAXRSApplication MyApplication / However, things get more complicated now because when starting the application manually, it does not itself scan for any @Path annotated endpoints and these have to all be loaded manually in the MyApplication class as follows: @ApplicationPath("") public class MyJAXRSApplication extends Application { priv…
score: 0
answers question: http://stackoverflow.com/q/26892417

http://stackoverflow.com/comment/42299059
has text: well, yes.. _for ( variable initialization; condition; variable update )_ this is a definition for the for loop in C. In Pascal, I am missing the 'variable update' so I was trying to increment that _inside_ of the loop, which gives me the error "assignment to FOR-Loop variable" - which perfectly makes sense from the logical standpoint. But it's obviously not a way to go.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26864064

http://stackoverflow.com/comment/42505480
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26984431
has text: @GavinMcLean glad to help Gavin. Keep on coding bro, it's a great occupation or hobby

http://stackoverflow.com/a/44907522
has body: @PropertySources({ @PropertySource("file:/absolutepath/app.properties"),//IF you want to load from file system using absolute path @PropertySource("classpath:app.properties"), //IF you want to load from classpath @PropertySource("file:{environment_Variable}/app.properties"), //IF you want to load using envirment varibale })
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26927279

http://stackoverflow.com/comment/42490690
score: 0
type: Comment
type: QuestionComment
has text: @CommonsWare Dashclock does something like that though. Users just install another 'extension' app. The app itself is open source, so that might be a good place to start.
comment on: http://stackoverflow.com/q/26977827

http://stackoverflow.com/q/26955800
has comment: http://stackoverflow.com/comment/42452814
has comment: http://stackoverflow.com/comment/42452968
has body: I have a problem with the following issue: I have build an Android app which saves data into a SQL database (SQLite). I managed so the current date, time and the category is saved down and shown in a different menu. Somehow I am not able to get the value saved down and shown in the other layout. The data should come from an EditText: android:id="@+id/edit_betrag The SQL column is defined like: public static final String BUDGET_BETRAG = "betrag"; and then should be shown in textView_betrag in the class BudgetRechnerAdapter respectively the other layout. Can you please help me with this issue? Thanks a lot!!! public class BudgetRechnerOpenHandler extends SQLiteOpenHelper { private static final String TAG = BudgetRechnerOpenHandler.class .getSimpleName(); // Name und Version der Datenbank private static final String DATABASE_NAME = "budgetrechner.db"; private static final int DATABASE_VERSION = 1; // Name und Attribute der Tabelle "Budget" public static final String _ID = "_id"; public static final String TABELLE_NAME_BUDGET = "budget"; public static final String BUDGET_ZEIT = "zeitStempel"; public static final String BUDGET_AUSGABENART = "ausgabenArt"; public static final String BUDGET_BETRAG = "betrag"; // Konstanten für die Stimmungen public static final int BUDGET_ESSEN = 1; public static final int BUDGET_GETRAENK = 2; public static final int BUDGET_SONSTIGES = 3; // Tabelle Budget anlegen private static final String TABELLE_BUDGET_ERSTELLEN = "CREATE TABLE " + TABELLE_NAME_BUDGET + " (" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + BUDGET_ZEIT + " INTEGER, " + BUDGET_BETRAG + " INTEGER," + BUDGET_AUSGABENART + " INTEGER);"; // Tabelle Budget löschen private static final String TABELLE_BUDGET_DROP = "DROP TABLE IF EXISTS " + TABELLE_NAME_BUDGET; BudgetRechnerOpenHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(TABELLE_BUDGET_ERSTELLEN); } @Override public void onUpg…
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/42452744
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/42454944
type: Question
has title: Show SQL data in android layout
has comment: http://stackoverflow.com/comment/42451742
tagged with: database
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42452740
score: 0
has comment: http://stackoverflow.com/comment/42452940
has comment: http://stackoverflow.com/comment/42452765
has comment: http://stackoverflow.com/comment/42455943
tagged with: sqlite
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/26876405
has comment: http://stackoverflow.com/comment/42312775
has body: I want to programmatically locate the relative path of files from a method in a controller class in a spring mvc web application so that I can read the contents of those files into java. I use eclipse, but this will be bundled into a war file. The app needs to retrieve files from elsewhere, place those files in a folder, and then in this case read the files from a given folder into java. So the files should not be bundled in the war, but the code in the war needs to be able to read and write files from the hard drive using urls that are relative to the application root. My two questions are: 1.) So where should I place the files within my eclipse project? 2.) How can I change the code below so that the files are found? In my first attempt, relative to the root of the eclipse project, I placed the files in src/main/resources/xml and used the following code, but I am getting error messages indicating that the app cannot find the files because it is looking relative to the eclipse installation and not relative to the eclipse project: @RequestMapping(value = "/some/url", method = RequestMethod.GET) public String someMethodName(Map&lt;String, Object&gt; model) { String inputpath = "src\\main\\resources\\xml\\"; File folder = new File(inputpath); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { StreamSource inputStream = new StreamSource(listOfFiles[i].getName()); //do some stuff with the inputstream } } return "redirect:/someotherurl"; }
has comment: http://stackoverflow.com/comment/42311575
has comment: http://stackoverflow.com/comment/42312849
tagged with: eclipse
downvote count: 0
has comment: http://stackoverflow.com/comment/42311065
has title: locating resources in spring mvc app
favorite count: 0
has comment: http://stackoverflow.com/comment/42312301
tagged with: spring
has comment: http://stackoverflow.com/comment/42310743
tagged with: spring-mvc
answer count: 0
has comment: http://stackoverflow.com/comment/42312377
has comment: http://stackoverflow.com/comment/42312335
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/42310755
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/42457442
score: 2
comment on: http://stackoverflow.com/q/26959488
has text: this seems like internal server error. This link may help you http://stackoverflow.com/questions/18618745/web-api-post-method-returns-http-1-1-500-internal-server-error , if not then describe it
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/42415670
score: 0
type: AnswerComment
has text: @user1902288 That being said, now that you have understood correctly and you have removed your comment, do not use vulgar language or curses on this site. That is not acceptable.
comment on: http://stackoverflow.com/a/26935376
type: Comment

http://stackoverflow.com/comment/42467714
has text: You will need to declare the size. Arrays don't grow dynamically.
type: AnswerComment
comment on: http://stackoverflow.com/a/26961089
score: 0
type: Comment

http://stackoverflow.com/comment/42368507
type: Comment
type: QuestionComment
score: 0
has text: if your range was from 1 to 100000 instead of 1 to 100, would you use 1to10, 11to20, ..., 99991 to 100000? Think of how you can use arrays in this question, this way you wont need to bother with `if else`
comment on: http://stackoverflow.com/q/26908311

http://stackoverflow.com/comment/42443250
comment on: http://stackoverflow.com/q/26950197
has text: As the log says, you're missing the class `com.microsoft.sqlserver.jdbc.SQLServerDriver` on your classpath. Have you checked if it is on the classpath? Maybe you need to add it there - either manually or in your build script (Maven/Gradle/Ant).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26862952
score: 1
upvote count: 1
has body: Naming.rebind("MathServer", mathServer); Change that to Naming.rebind("//localhost:8080/MathServer", mathServer);
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26862641

http://stackoverflow.com/q/26863407
tagged with: aspectj-maven-plugin
tagged with: aspectj
has body: I try to use aspectj maven plugin for compile project with aspectj compiler and then I try to package classes into "war" file. Unfortunately, it doesn't work with following configuration (pom.xml): org.apache.maven.plugins maven-surefire-plugin 2.17 true com.liferay.maven.plugins liferay-maven-plugin ${liferay.maven.plugin.version} generate-sources ${liferay.auto.deploy.dir} ${liferay.app.server.deploy.dir} ${liferay.app.server.lib.global.dir} ${liferay.app.server.portal.dir} ${liferay.version} portlet maven-compiler-plugin 2.5 UTF-8 1.7 1.7 true true maven-resources-plugin 2.5 UTF-8 org.codehaus.mojo aspectj-maven-plugin 1.7 1.7 1.7 1.7 UTF-8 process-sources compile org.aspectj aspectjrt 1.7.4 jar After mvn clean install I see following exceptions: [INFO] --- aspectj-maven-plugin:1.7:compile (default) @ tvbs-portlet --- [INFO] Showing AJC message detail for messages of types: [error, warning, fail] [ERROR] Missing message: configure.incompatibleComplianceForSource in: org.aspectj.ajdt.ajc.messages <unknown source file>:<no line information> [ERROR] no sources specified <unknown source file>:<no line information> [ERROR] AspectJ Compiler 1.8.2 Usage: <options> .. AspectJ-specific options: -inpath use classes in dirs and jars/zips in as source Could anybody suggest me some solution?
has comment: http://stackoverflow.com/comment/58299315
has title: AspectJ Maven Plugin cannot compile my project
upvote count: 21
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/26864791
tagged with: maven
has answer: http://stackoverflow.com/a/41294561
possible better answer: http://stackoverflow.com/a/26863467
tagged with: jakarta-ee
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26863467
downvote count: 0
score: 21
tagged with: java
has answer: http://stackoverflow.com/a/26866775
accepted answer: http://stackoverflow.com/a/26866775
has answer: http://stackoverflow.com/a/26887224
type: Question

http://stackoverflow.com/q/26884369
has comment: http://stackoverflow.com/comment/42324446
tagged with: multiple-instances
possible better answer: http://stackoverflow.com/a/26884474
has body: I am now working with an application. In that there are lots of child JFrame objects there. Each time the button to show child frame is clicked a new instance of child frame is created and hence multiple copies of same child frame is created. How can I prevent multiple copies of child node?
accepted answer: http://stackoverflow.com/a/26884475
has title: How to close all child frames from parent frame?
favorite count: 0
tagged with: jframe
tagged with: swing
has answer: http://stackoverflow.com/a/26884475
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26884474
downvote count: 1
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/9554636
answer count: 2

http://stackoverflow.com/comment/42454524
type: Comment
has text: By the way, do you have any idea how to disable the rating bar after user selected okay? Because I tried with ratingBar.setIndicator(true) and it does not work
comment on: http://stackoverflow.com/a/26957690
score: 0
type: AnswerComment

http://stackoverflow.com/a/40422985
answers question: http://stackoverflow.com/q/26863650
score: 0
type: Answer
has body: DO like this ViewPager mviewPager=(ViewPage)findViewById(R.id.urcontainer); mviewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void OnPageSelected(int position) { int page_number=position; //this will give u the current page number } }); `

http://stackoverflow.com/a/26874532
score: 1
type: Answer
has body: That is not an error, it seems to be the value of instantiated object references. If you want to print what is inside, you either need to access something from the object to print, like object.getSomething(); // Assuming the getSomething() method prints something // useful from within the class or Add a toString() method to the class.
upvote count: 1
answers question: http://stackoverflow.com/q/26874487
has comment: http://stackoverflow.com/comment/42307306
accepted answer of: http://stackoverflow.com/q/26874487
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26851126
tagged with: user-interface
has body: I am attempting to write a slider that changes the value of a number in a box. I am trying to set the slider's y location to 0 and set the size of the slider to 200px wide and 30px high. I have already initialized the the slider instance, and the code for the numbered box is written correctly: NumberSlider ns = new NumberSlider(controller, "number", 0, 10, 5); ns.setSize(200, 100); ns.setLocation(400, 200); window.add(ns); When placing this in my view class I get the box with a number 5 in it. So now that I have the box, how can I use the JSlider so that it interacts with the numbered box? Here is the full constructor: public NumberSlider(Controller c, String s, int min, int max,int ini_val){ setLayout(null); slider_name = s; controller = c; Box box = new Box(); box.setLocation(min, max); box.setSize(40, 30); String text = String.valueOf(ini_val); box.setText(text); add(box); JSlider jslider = new JSlider(JSlider.HORIZONTAL, min, max, ini_val);
has comment: http://stackoverflow.com/comment/42264940
has comment: http://stackoverflow.com/comment/42265100
has comment: http://stackoverflow.com/comment/42266075
tagged with: jslider
has comment: http://stackoverflow.com/comment/42265034
answer count: 0
type: UnansweredQuestion
tagged with: java
has title: JSlider not showing
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/42266049
score: 0

http://stackoverflow.com/a/26919389
has comment: http://stackoverflow.com/comment/42388203
has comment: http://stackoverflow.com/comment/42387831
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/42387471
has comment: http://stackoverflow.com/comment/42387890
has comment: http://stackoverflow.com/comment/42387992
has body: You don't actually even need ReadFile class to read all lines from file. Java provides you Files utility class in java.nio.file package which has readAllLines(Path) method. Also i==6 as mentioned already in comments will let you handle only sixth line, but it will not handle 16th, 26th. To handle these cases you can either create two loops, like in gutenmorgenuhu's answer for (int questionNumber; ...) for (1..6 lines of each question) printLine or just check if last digit is 6. To get this last digit you can use modulo (reminder) operator % so you condition can be rewritten as if ( i % 10 == 6). So little simplified code which will handle problem from your question can look like List&lt;String&gt; lines = Files.readAllLines(Paths.get("input.txt")); // or in Java 7 // List&lt;String&gt; lines = Files.readAllLines(Paths.get("input.txt"),StandardCharsets.UTF_8); for (int i = 0; i &lt; lines.size(); i++) { System.out.println(lines.get(i)); if (i % 10 == 6) i = i + 3;// or +4 if you don't want to separate questions with empty line }
downvote count: 0
answers question: http://stackoverflow.com/q/26918856
has comment: http://stackoverflow.com/comment/42387810
has comment: http://stackoverflow.com/comment/42387665
has comment: http://stackoverflow.com/comment/42388043
has comment: http://stackoverflow.com/comment/42387781
has comment: http://stackoverflow.com/comment/42387618
type: Answer

http://stackoverflow.com/comment/42250737
type: Comment
type: QuestionComment
has text: And, _please_, give the complete method.
score: 0
comment on: http://stackoverflow.com/q/26843713

http://stackoverflow.com/comment/42494443
has text: thx. jdom2 is just great for that purpose.
comment on: http://stackoverflow.com/q/26978865
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26921761
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/42391425
answer count: 1
has comment: http://stackoverflow.com/comment/42391430
score: 0
tagged with: android
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42391736
has body: In my android game I have entire game scenes/ levels wrapped in a GameScene object. I was hoping that the GameScene object would garbage collect once the reference was replaced by new GameScene. Unfortunately I have bad memory leaks, where everytime change the level, the memory heap grows. This happens until the game crashes with memory full errors. I already used eclipse Mat and it warned me that there was a likely leak in GameScene. I fixed it so it doesn't show up on Mat anymore. Does anyone who is good at debugging in eclipse know how I can figure out which objects are not being garbage collected? I'm not even sure if GameScene is being garbage collected. The code below just gives a shorted example of how I am calling Engine to create and overwrite the current GameScene inside of the running GameScene to create the next level. class GameScene{ //lots of methods and objects... @Override public void onClick(float x, float y) { // TODO Auto-generated method stub Engine.destroyScene(); Engine.setScene(new GameScene(context, "chapters/classic/2/")); } } class SceneManager{ public Scene currentScene; public void destroyScene() { sceneLoaded = false; currentScene.destroyScene(); currentScene = null; } public void setScene(Scene scene) { currentScene = scene; } public void loadScene() { currentScene.loadScene(); sceneLoaded = true; } } class Engine{ public static void destroyScene(){ sceneManager.destroyScene(); resourceManager.deleteAllTextures(); } public static void setScene(Scene scene) { sceneManager.setScene(scene); } }
has answer: http://stackoverflow.com/a/26921913
has title: Game scene not garbage collecting

http://stackoverflow.com/a/26943625
has body: First you need to study what the static modifier is, since it is the source of the error you are asking for. https://stackoverflow.com/a/413904/3657704 I dont see why would you use static modifiers everywhere in your code, of course in a more advanced talk i would say that you try to accomplish something having a lot of static fields and methods in a class named "ThreadedSorter". Does it makes sense to you have a class method calling an instance variable? it probably wont find it since the classloader loads static fields and methods even were no instances of your object exist, yet. And of course radiodef answer is right, too.
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26943521
type: Answer

http://stackoverflow.com/comment/42329925
type: Comment
has text: I tested this in my servlet: http://localhost:8080/WebService/EventDetailServlet?getEventDetailByID&eventID=46 and it returns null. Do you have any ideas?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26886724

http://stackoverflow.com/comment/42377553
type: AnswerComment
comment on: http://stackoverflow.com/a/26914009
score: 0
type: Comment
has text: Do you know why the filename i pass is ignored?

http://stackoverflow.com/q/26893473
has answer: http://stackoverflow.com/a/26893529
tagged with: java
downvote count: 2
type: Question
has body: I did some more work on this program, but now I am stuck because the string array prints, but i cant for the life of me get the double array to print. Any help would be appreciated! import java.util.ArrayList; import java.util.Arrays; import java.lang.Double; import java.util.Scanner; public class inventoryTracker { private static Scanner sc; private static double itemCost; public static void main(String[] args) { System.out.println("Welcome to the Inventory tracker" + "\nThis program will accept the names and costs for 10 stocked items." + "\nThe program will then output a table with the names, costs and," + "\nprices of the items." + "\nPrices are calculated with a 30 percent markup on cost."); sc = new Scanner(System.in); String[] product = new String[10]; Double[] itemCost = new Double[10]; for (int i = 0; i &lt; itemCost.length; i++ ){ System.out.print("Enter the item cost :"); itemCost [i]= sc.nextDouble(); } for (int i = 0; i &lt; product.length; i++){ System.out.print("Enter the product name :"); product[i] = sc.next(); } System.out.println(Arrays.toString(product)); } }
has comment: http://stackoverflow.com/comment/42340638
score: -2
tagged with: parallel-arrays
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/42340955
has answer: http://stackoverflow.com/a/26893571
favorite count: 0
type: UnansweredQuestion
has title: double array won't print
has answer: http://stackoverflow.com/a/26893581

http://stackoverflow.com/q/26954512
tagged with: http
has title: JSON query String with special letters
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26954533
has body: I'm trying to send a HTTPPost to a web server using JSON arrays. Is there a problem with this implementation? sendData = "?type=1&registID=aaabbbccc&email=xxxxxxxx@gmail.com"; HttpPost post = new HttpPost(url + sendData); There may be some special letters such as _, -, @, . on both the ID part and the email part. I think this is causing the return of invalid results from the server. How can I fix this? ////// The returned results looks like this. Apache Tomcat/7.0.50 - Error report ....... HTTP Status 404 - ..........The requested resource is not available.....
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42448890
upvote count: 1
has answer: http://stackoverflow.com/a/26956145

http://stackoverflow.com/comment/42467547
type: Comment
type: QuestionComment
has text: Did you copy that file name? It looks like you're using directed quotes which the java compiler does not like. Replace with undirected ""
score: 0
comment on: http://stackoverflow.com/q/26963635

http://stackoverflow.com/comment/42414713
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26918374
has text: @Gas: Actually, that *was* it. You should post that as an answer. ;)

http://stackoverflow.com/comment/42302648
has text: Put the errors inside the question, please. And use the `{}` button to properly format them.
type: Comment
comment on: http://stackoverflow.com/q/26872167
score: 0
type: QuestionComment

http://stackoverflow.com/q/26948563
tagged with: java.util.scanner
answer count: 2
has answer: http://stackoverflow.com/a/26948618
upvote count: 1
has body: I have tried: String input = ""; FileReader reader = new FileReader(inputFileName); Scanner in= new Scanner(reader); input = in.nextLine(); This doesnt work as it only reads in the first line, so i change to: String input = ""; FileReader reader = new FileReader(inputFileName); Scanner in= new Scanner(reader); while(in.hasNextLine()){ input = input + in.nextLine(); } it doesnt work too..because my file is like a manual with several return line and it looks something like this: Hello world, You should code java frequently that's it! Regards, unknown? Note: i would like to stall everything including the whitespaces and the return feed and all chars into a String, is that possible? Thanks for all guidance provided
has comment: http://stackoverflow.com/comment/42438885
has title: How to read all the chars into a String from a textfile (using scanner)
possible better answer: http://stackoverflow.com/a/26948618
has comment: http://stackoverflow.com/comment/42438886
tagged with: java
has answer: http://stackoverflow.com/a/26948600
type: AnsweredQuestion
downvote count: 0
tagged with: string
score: 1
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/26948600
tagged with: filereader

http://stackoverflow.com/comment/42555323
type: AnswerComment
comment on: http://stackoverflow.com/a/26888480
score: 0
type: Comment
has text: can you give an example on the kind of loop i would use? Im kind of confused.

http://stackoverflow.com/q/26882839
tagged with: amazon-ec2
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/42322087
score: 0
has comment: http://stackoverflow.com/comment/42322338
has answer: http://stackoverflow.com/a/26884236
accepted answer: http://stackoverflow.com/a/27061660
tagged with: tcp
possible better answer: http://stackoverflow.com/a/26884236
has title: Unable to access the ec2 Geronimo port from outside
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
has body: I setup geronimo on ec2 cent os environment.It started successfully.It is running on port 8080.I am able to telnet on the server.But when i telnet outside the server, unable to connect to the server.Do i need to change any configuration ? when i ran netstat -an.I can see the following line. tcp 0 0 :::8080 :::* LISTEN Thanks and Regards.
has answer: http://stackoverflow.com/a/27061660

http://stackoverflow.com/a/26917912
answers question: http://stackoverflow.com/q/26917853
downvote count: 0
upvote count: 2
type: Answer
score: 2
has body: java.sql.ResultSet does not have a method getChars. You could use the getString method to retrieve a String and then extract the char from it: char item_id = rs.getString(1).charAt(0);

http://stackoverflow.com/comment/42664037
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27073265
has text: Didn't I check whether it exists with this? if (metadata.containsDirectory(ExifSubIFDDirectory.class))

http://stackoverflow.com/a/26925485
has body: You create an empty array : int array[] = new int[0]; and try to assign numbers to it : array[count] = in.nextInt(); It can't work. You must give it a positive length.
has comment: http://stackoverflow.com/comment/42398048
has comment: http://stackoverflow.com/comment/42397380
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26925453
has comment: http://stackoverflow.com/comment/42397498

http://stackoverflow.com/a/26947902
type: AcceptedAnswer
score: 0
has comment: http://stackoverflow.com/comment/42438449
accepted answer of: http://stackoverflow.com/q/26947136
type: Answer
has body: It's the distance to the hole that determines whether the golfer has to shoot again or not - so that should be in the while loop. I've added some comments in the code: String input = ""; int distance = 100; int numberOfHits = 0; int hit = 0; while (distance &gt; 0) { numberOfHits++;//increasing the nuber of hits input = JOptionPane.showInputDialog("distance to hole " + distance + " Which club (1-putting), 2-(pitching) or 3-iron"); switch (input) {//if you don't know switch you coukd use if-else case "1": Random roll = new Random(); hit = roll.nextInt(6);//a random int netween 0-5 JOptionPane.showMessageDialog(null, "you hit ..." + hit + "m"); distance -= hit;//sets the new distance to the old distance subtracted the hit distance = Math.abs(distance);//if distance is negative make it positive break; case "2": roll = new Random(); hit = roll.nextInt(31); JOptionPane.showMessageDialog(null, "you hit ..." + hit + "m"); distance -= hit; distance = Math.abs(distance); break; case "3": roll = new Random(); hit = roll.nextInt(151); JOptionPane.showMessageDialog(null, "you hit ..." + hit + "m"); distance -= hit; distance = Math.abs(distance); break; } } //when we are out of the loop the distance is zero JOptionPane.showMessageDialog(null, "Congratulations, you took " + numberOfHits + " shots.");
answers question: http://stackoverflow.com/q/26947136

http://stackoverflow.com/comment/42452875
type: Comment
comment on: http://stackoverflow.com/a/26956255
has text: @ProfessorChaos I just noticed that it was more complicated than it needed to be. I simplified the code a bit.
score: 0
type: AnswerComment

http://stackoverflow.com/a/26954076
has body: This will fix it: TestStopWatch class changes: public static void main(String[] args) { StopWatch watch = new StopWatch(); watch.start(); watch.stop(); System.out.println(watch.getElapsedTime()); } StopWatch class changes: public double getElapsedTime() { return endTime - startTime; }
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42448305
answers question: http://stackoverflow.com/q/26954045
downvote count: 0

http://stackoverflow.com/comment/42262347
comment on: http://stackoverflow.com/q/26849829
type: QuestionComment
type: Comment
has text: I don't understand the relationship between anything in your question and the question title. Which event listener are you wanting to remove? Also, if I understand the question correctly, you just want to make the text area editable under certain conditions. It's hard to answer the question without a little more information about what that condition is.
score: 0

http://stackoverflow.com/a/27210151
accepted answer of: http://stackoverflow.com/q/26952460
type: AcceptedAnswer
has body: For anyone wondering how I solved this, I tried varying the weights randomly between 0 and 1. This performed slightly better, but once I tried varying the weights between 1 and -1, the ANN was able to classify 85% of the data correctly.
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/26952460

http://stackoverflow.com/q/26900449
tagged with: logic
answer count: 1
has body: I'm writing code to determine the state of water depending on the temperature in celsius and altitude, how can I make it so at the end, if the altitude is more than 300, it takes 1 less degree celsius for the water to boil and the outcome can be determined depending on the input? import java.util.Scanner; public class WaterState { public static void main(String[] args) { boolean run = true; while(run) { Scanner scan = new Scanner(System.in); System.out.println("What is the temperature in degrees Celsius?"); double temp = scan.nextDouble(); System.out.println("What is the height above Sea level? in exact meters"); double altitude = scan.nextDouble(); int freezingPoint = 0; double alternateAltitude = temp - (altitude * 0.001); double boilingPoint = 100; int baseAltitude = 300; if ((temp &lt;= freezingPoint) &amp;&amp; (altitude &lt;= baseAltitude)) { System.out.println("Water is frozen"); } else if ((temp &gt; freezingPoint) &amp;&amp; (altitude &lt;= baseAltitude)) { System.out.println("Water is liquid"); } else if ((temp &gt;= boilingPoint) &amp;&amp; (altitude &lt;= baseAltitude)) { System.out.println("Water is gaseus"); } else if ((altitudeChange &gt; ) { System.out.println("Water is boiling, but at a lower temperature because of the altitude"); } } } }
has comment: http://stackoverflow.com/comment/42353596
has answer: http://stackoverflow.com/a/26900597
favorite count: 0
tagged with: java.util.scanner
has title: I'm writing code to determine the state of water with if statements
type: UnansweredQuestion
downvote count: 1
has comment: http://stackoverflow.com/comment/42353617
has comment: http://stackoverflow.com/comment/42353661
tagged with: if-statement
has comment: http://stackoverflow.com/comment/42353624
tagged with: java
score: -1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/42353501
tagged with: temperature

http://stackoverflow.com/comment/42543583
has text: @JimEvans I've added a simple test and html that fails. I've also removed the exceptions part, because they were not relevant.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26987288

http://stackoverflow.com/a/26925255
accepted answer of: http://stackoverflow.com/q/26916128
type: AcceptedAnswer
type: Answer
has body: You have to wait for the "exec" channel to complete/close before you can safely run the rename on the "sftp" channel. For implementation, see Sending commands to server via JSch shell channel.
answers question: http://stackoverflow.com/q/26916128
score: 0

http://stackoverflow.com/q/26915949
answer count: 1
favorite count: 0
downvote count: 3
has answer: http://stackoverflow.com/a/27301455
accepted answer: http://stackoverflow.com/a/27301455
has comment: http://stackoverflow.com/comment/42380839
has comment: http://stackoverflow.com/comment/42380618
tagged with: joptionpane
tagged with: multithreading
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42380846
tagged with: biginteger
has comment: http://stackoverflow.com/comment/42380539
has title: Multi-threading same code at the same time
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/42381160
has body: I want my program to test two BigIntegers at the same time. As of now my code is testing one at a time. Since I want the code to be the same for both runs, is there a simple synchronized statement that I would be able to use to implement this? public static void main(String[] args) { String input = JOptionPane.showInputDialog("Enter number "); int number = Integer.parseInt(input); BigInteger num = new BigInteger(input); String output = num + " is" + (IsPrime(num) ? " " : " not ") + "a prime number."; JOptionPane.showMessageDialog(null, output); } public static boolean IsPrime(BigInteger num) { if (num.mod(new BigInteger("2")).compareTo(BigInteger.ZERO) == 0) { return false; for (BigInteger i = new BigInteger("3"); i.multiply(i).compareTo(num) &lt;= 0; i = i.add(new BigInteger("2"))) { if (num.mod(i).compareTo(BigInteger.ZERO) == 0) { return false; } } return true; } }
type: Question
upvote count: 1

http://stackoverflow.com/comment/42325886
score: 0
comment on: http://stackoverflow.com/q/26869564
has text: Why are you including `y+=` in the watch? Wouldn't it be safer to watch this: `(float)runaci.getAttribute(TextAttribute.SIZE);` and thereby avoid side effects when debugging
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42532414
has text: Ok, I'll buy that. Kepping meaningful code out of the testsuite is as good as a solution as any! Thanks!
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26940034

http://stackoverflow.com/comment/42482310
score: 0
has text: This fixed that error indeed. Now I get the same error as above in the printscreen, when I open the ShowPhoto.java class
type: Comment
comment on: http://stackoverflow.com/a/26972230
type: AnswerComment

http://stackoverflow.com/comment/78385987
type: QuestionComment
comment on: http://stackoverflow.com/q/26886121
has text: @Sam you need to accept an answer or provide comments if not satisfied with the answers
score: 0
type: Comment

http://stackoverflow.com/a/26978775
has comment: http://stackoverflow.com/comment/42492176
answers question: http://stackoverflow.com/q/26978639
has comment: http://stackoverflow.com/comment/42492052
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/42492113
accepted answer of: http://stackoverflow.com/q/26978639
score: 2
has body: Creating Views programmatically will not at all make your honorable goal of creating an app that looks good on all screen sizes easier. In fact it will make your life miserable. It is error-prone, cumbersome and per se not responsive to screen sizes. There are situations where you need to create Views programmatically, for instance if the the number or type of Views is dependent on data that you don't know beforehand, but generally creating your layouts with the XML layout files is the way to go. The nice thing about them is that you can provide different layouts for different screen sizes, which is hard to achive programmatically. Google has lots of documentation on the subject. If you really want or need to create Views programmatically, just check their constructors in the docs and the methods they provide to control their looks and behaviour. SO will also provide hints and examples. Good luck!
upvote count: 2

http://stackoverflow.com/comment/42428124
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26942249
has text: No, 'fundsDouble' will hold the string version of 'funds', my running total variable. 'funds' is the running total variable, and it works fine. It's 'fundsDouble' that is the culprit, and I don't know why it's not working.
score: 0

http://stackoverflow.com/q/26922568
upvote count: 1
has answer: http://stackoverflow.com/a/32254234
answer count: 1
favorite count: 0
has title: Stop Hibernate from trying to re-create indexes on every startup
tagged with: exception
type: UnansweredQuestion
downvote count: 0
has body: I have a schema auto-update on startup turned on. Everything goes smooth but one thing: on every startup I get the following exception for every index in my schema (and there's like a hundred of those). Apparently Hibernate either fails to detect that the index is already there or does not try to detect this at all, how do I fix this? It spoils the log file and makes it hard to notice if something really went wrong. 03:35:45,553 WARN [AnnotationSessionFactoryBean:1119] Unsuccessful schema statement: create index statusIndex on Application (status) org.postgresql.util.PSQLException: ERROR: relation "statusindex" already exists at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:302) at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.executeSchemaStatement(LocalSessionFactoryBean.java:1115) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.executeSchemaScript(LocalSessionFactoryBean.java:1087) at org.springframework.orm.hibernate3.LocalSessionFactoryBean$1.doInHibernate(LocalSessionFactoryBean.java:942) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:339) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.updateDatabaseSchema(LocalSessionFactoryBean.java:935) at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterSessionFactoryC…
type: Question
tagged with: indexing
score: 1
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/42347592
type: Comment
has text: Thanks for the pointers, I've followed your suggestions.
type: QuestionComment
comment on: http://stackoverflow.com/q/26896668
score: 1

http://stackoverflow.com/q/26836299
has comment: http://stackoverflow.com/comment/42266434
has comment: http://stackoverflow.com/comment/42266413
has comment: http://stackoverflow.com/comment/42238397
has comment: http://stackoverflow.com/comment/42304041
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/31056066
has comment: http://stackoverflow.com/comment/42264063
has comment: http://stackoverflow.com/comment/42238449
has comment: http://stackoverflow.com/comment/42238459
type: Question
tagged with: animation
has title: How do I make an animation run just once in java?
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/31056066
has body: So I am using the framework from a book on how to program games in java and it has an animation class like so: package com.vincent.framework.animation; import java.awt.Graphics; public class Animation { private Frame[] frames; private double[] frameEndTimes; private int currentFrameIndex = 0; private double totalDuration; private double currentTime; public Animation(Frame... frames) { this.frames = frames; frameEndTimes = new double[frames.length]; for (int i = 0; i &lt; frames.length; i++) { Frame f = frames[i]; totalDuration += f.getDuration(); frameEndTimes[i] = totalDuration; } } public synchronized void update(float increment) { currentTime += increment; if (currentTime &gt; totalDuration) { wrapAnimation(); } while (currentTime &gt; frameEndTimes[currentFrameIndex]) { currentFrameIndex++; } } private synchronized void wrapAnimation() { currentFrameIndex = 0; currentTime %= totalDuration; } public synchronized void render(Graphics g, int x, int y) { g.drawImage(frames[currentFrameIndex].getImage(), x, y, null); } public synchronized void render(Graphics g, int x, int y, int width, int height) { g.drawImage(frames[currentFrameIndex].getImage(), x, y, width, height, null); } } That is fine if you want the animation to repeat over and over, but how can I make an animation stop when it gets to the last frame? I have tried having an if statement to check if it has reached the last stage, but it would skip frames for some reason. Thanks for any help!
has comment: http://stackoverflow.com/comment/42266584

http://stackoverflow.com/comment/42401239
type: Comment
type: QuestionComment
score: 2
has text: Post some code and explain what is *VehicleRoutingExample*. We are programer, not wizard.
comment on: http://stackoverflow.com/q/26927462

http://stackoverflow.com/comment/42432092
score: 0
type: Comment
has text: `I want to change it before I run the application, not afterwards` Sorry i dont really understand you...you can freely change the value of variable (hardcoding) right?
type: AnswerComment
comment on: http://stackoverflow.com/a/26944567

http://stackoverflow.com/q/26832694
accepted answer: http://stackoverflow.com/a/26832926
downvote count: 0
answer count: 1
tagged with: database
has comment: http://stackoverflow.com/comment/42231895
tagged with: jtable
favorite count: 0
tagged with: netbeans
has answer: http://stackoverflow.com/a/26832926
has title: How to retrieve multiple row from database in java
has body: I need to insert different result into the row of my JTable. I search my record by using purchaseID which is the pID, it will find 2 result for that particular purchaseID. The problem is when I insert it into row, it just duplicate the result of the first one. EG : P0001 have 2 purchase details and when I insert it into row, I have 2 same row. Is there any way for me to insert into row one by one ? PS. I've been coding since morning, brain is not functioning well. UI: else if(e.getSource() == jbtRetrieve) { String pID = jTF3.getText(); Purchase purchase = purcControl.selectRecord(pID); if (purchase != null) { String pdCountStr = purchase.getPurchaseDetailsID(); String pdCountStr2 = pdCountStr.substring(2,5); int pdCount = Integer.parseInt(pdCountStr2); for(int g = 0; g&lt;pdCount;g++){ //g =1 tableModel.addRow(new Object[]{ purchase.getPurchaseDetailsID(),purchase.getStockID(),purchase.getPrice(),purchase.getQuantity()}); }} DA : public Purchase getRecord(String pID){ String queryStr = "SELECT PD.PURCHASEDETAILID,PD.PURCHASEID,PD.STOCKID,PD.ORDERQTY,S.STOCKPRICE FROM "+tableName+" PD, STOCKS S WHERE PD.STOCKID = S.STOCKID AND PurchaseID = ?"; Purchase purchase = null; System.out.println("asd"); try{ stmt = conn.prepareStatement(queryStr); stmt.setString(1,pID); ResultSet rs = stmt.executeQuery(); if(rs.next()){ purchase = new Purchase(pID, rs.getString("purchaseID"),rs.getString("stockID"),rs.getDouble("stockprice"),rs.getInt("orderqty")); } } catch (SQLException ex){ JOptionPane.showMessageDialog(null,ex.getMessage(),"ERROR",JOptionPane.ERROR_MESSAGE); } return purchase; } Domain: public Purchase(String purchaseDetailsID,String purchaseID,String stockID,double price,int quantity) { this.purchaseDetailsID = purchaseDetailsID; this.purchaseID = purchaseID; this.stockID = stockID; this.price = price; this.quantity = quantity; } public void setPurchaseID(String u){ this.purchaseID = u; } public String getPurchaseID(){ return purchaseID; } public String getPurchaseDetai…
upvote count: 1
has comment: http://stackoverflow.com/comment/42232005
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/q/26859011
score: 1
tagged with: java
has body: My program is as follows: private void removeElementsFromSecond(int[] arr1, int[] arr2) { List list1 = Arrays.asList(arr1); Set&lt;Integer&gt; set1 = new LinkedHashSet&lt;Integer&gt;(list1); List list2 = Arrays.asList(arr2); Set&lt;Integer&gt; set2 = new LinkedHashSet&lt;Integer&gt;(list2); set2.removeAll(set1); Iterator itr = set2.iterator(); while (itr.hasNext()) { System.out.println(itr.next()); } } And the inputs are: int[] arr1 = {1,2,3,4,5}; int[] arr2 = {0,1,2,3,4}; But the output is displayed as [I@45bab50a I came across this link while surfing http://www.java-examples.com/iterate-through-elements-java-hashset-example I guess I am doing more or less similar stuff here. Can anyone please help me to display the proper values? Thanks in advance
tagged with: set
upvote count: 1
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/26859304
tagged with: arrays
tagged with: hashset
has answer: http://stackoverflow.com/a/26859550
has answer: http://stackoverflow.com/a/26859067
downvote count: 0
favorite count: 0
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26859256
has answer: http://stackoverflow.com/a/26859040
has title: How to display the elements in a Set that has integer values in Java

http://stackoverflow.com/a/26975002
accepted answer of: http://stackoverflow.com/q/26974609
answers question: http://stackoverflow.com/q/26974609
type: Answer
has body: There is a varStatus attribute in the forEach tag that you can use for this purpose. e.g., &lt;tr style = "height:30px;padding:4px"&gt; &lt;c:forEach var = "item" items = "${obj.allusers}" varStatus="loopStatus"&gt; &lt;c:if test="${loopStatus.index &lt; 2}"&gt; &lt;td&gt;&lt;div align = "center"&gt;${item}&lt;/div&gt;&lt;td&gt; &lt;/c:if&gt; &lt;/c:forEach&gt; &lt;/tr&gt; The loopStatus variable here can give you the 'index' of the current iteration.
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/26883642
has body: I don't really understand why you need a recursive function for that (unless it's for learning purposes), but btw, here is what you should do : 1) The function will have 2 parameters : the current position + the dimension 2) If (position == dimension) then stop. 3) In the function, if (position == 0), create the array. 4) In all cases, create array[position] as a new HashMap 5) Call back the function with parameters (position+1, dimension) Hope this helps
answers question: http://stackoverflow.com/q/26883474
has comment: http://stackoverflow.com/comment/42322718
has comment: http://stackoverflow.com/comment/42325120
has comment: http://stackoverflow.com/comment/42324946
has comment: http://stackoverflow.com/comment/42324797
has comment: http://stackoverflow.com/comment/42324982
score: 0
has comment: http://stackoverflow.com/comment/42323045
type: Answer

http://stackoverflow.com/comment/42267440
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26851050
has text: If you run the report from iReport, it fills the fields in the detail?

http://stackoverflow.com/comment/42303513
type: Comment
type: QuestionComment
has text: What is `val data` ? Is that supposed to be JSON?
score: 0
comment on: http://stackoverflow.com/q/26847199

http://stackoverflow.com/q/26952677
answer count: 2
has answer: http://stackoverflow.com/a/26953467
downvote count: 0
has title: How to compare objects in a generic LinkedList
favorite count: 0
has answer: http://stackoverflow.com/a/26954052
tagged with: generics
tagged with: singly-linked-list
type: AnsweredQuestion
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/26954052
score: 1
has body: How do you compare objects in a generic Linked List? I wrote my linked list from scratch. I have a class called Country that reads from a csv file and stores the name of country with its cellular stat data for a particular year. It reads dat from the year 1960 to 2012. My program works fine as i am able to print out the list. But when i search the list to match a country name that was printed out in the console. It says it wasn't found. I am new to generics, and i feel there something wrong as i tried to override the equals method in the class Country to compare the names. But my equals method in class Country is not been called. I tried debugging the equals method to see if it was ever called by placing a print out statement but it was never called. My guess is because of using the generics. Please i need some help to solve this issue. This is one issue i am having with the application as my contains method is not comparing the country names at all. class linked list public class LinkedList&lt;T&gt; { private Node&lt;T&gt; first; public LinkedList() { this.first = null; } //returns true if list is empty public boolean isEmpty() { return (first==null); } //adds the node to the end of the list public void add(T obj) { Node&lt;T&gt; newNode = new Node&lt;T&gt;(obj); if(this.isEmpty()) { newNode.setNode(first); first = newNode; } else { Node&lt;T&gt; current = first; while(current.getNext()!=null) { current = current.getNext(); } current.setNode(newNode); } } public String toString() { String result =""; if(this.isEmpty()) { result += "Cannot print an empty list"; return result; } else { Node&lt;T&gt; current = first; while(current!=null) { result +=current.getObj(); current = current.getNext(); } return result; } } //searches for the countryName and returns the country if found public T contains(T obj) { if(this.isEmpty()) { return null; } else { Node&lt;T&gt; current = first; while(current!=null) { if(current.getObj().equals(obj)) { return current.getObj(); } current…
tagged with: java
possible better answer: http://stackoverflow.com/a/26953467

http://stackoverflow.com/comment/42248308
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/26842327
type: Comment
has text: Explaining *why* there is a problem is our first priority here. Not just handing out the solution. Also, please fix up the formatting!

http://stackoverflow.com/a/26899075
has body: You can use the latest JDK8. jdk can work in compliance, eg produce Java 6 compatible byte code. Also note the SDK supports Java 7 since build tools 19. Some language features only can be used on API 4.4 and up though.
type: Answer
answers question: http://stackoverflow.com/q/26898989
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/42320488
score: 0
comment on: http://stackoverflow.com/q/26881826
type: Comment
has text: @badjr yes thanks for asking I forgot to mention that the code I posted is just the last part of my main class. My whole package for the assignment consists of about 6 classes, most of which was given to us by the site, In.java being one of them. This is the link to that code: http://algs4.cs.princeton.edu/stdlib/In.java.html, it's kind of long but I can paste it if it helps
type: QuestionComment

http://stackoverflow.com/q/26912744
has answer: http://stackoverflow.com/a/26913249
tagged with: java
has body: after watching various tutorials and doing some reading I understand how to use constructor arguments in spring. no issue there. my issue is can someone explain or point me to some material where it explains WHY they are used. what I mean by that, surely with syntax like this: , a hardcoded value is poor practice? i dont want an any articles on spring concerning how to do it. i just need a simple answer to explain why hardcoding is seemingly okay here OR better solutions. I am aware of the @Resource annotation which gets rid of the need for lines such as but I have always been taught hardcoding is bad idea and pulling from a DB for example is a better solution
type: Question
score: 0
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42375257
tagged with: constructorargument
tagged with: annotations
has title: unsure of concept of constructor args in spring beans
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/comment/42459526
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26952343
has text: Ok, update your first post with all you latest code. Add a edit section with your lastest update. By the way, I strongly recommand to separate your `SecurityUser` and `User`. `SecurityUser` should not extends your `User` but just implements `UserDetails`. Otherwise, you will be able to call the `UserService.create` method on a `SecurityUser` or to create `SecurityUser` from a other one. This 2 case should happend and, IMHO, this relation is not correct. Remove this inheritence in your code and maybe you will see what's wrong in your code.

http://stackoverflow.com/q/26972920
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/26973177
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/26973204
type: Question
has answer: http://stackoverflow.com/a/26973204
accepted answer: http://stackoverflow.com/a/26973177
downvote count: 0
tagged with: button
has body: I tried everything but unable to disable that save button. i wrote it at the end of my onCreate. Actually i wanted if user edits some notes and selects category from spinner it will automatically get enabled and i achieved it. But i want that first when user is on this page button should be disabled. When user dose his work it will enable. But how should i disable this save button. Here is my OfflinePBDetails.java class package passbookManager; import java.io.FileInputStream; import java.util.ArrayList; import java.util.Date; import java.util.Properties; import logs.TraceLog; import mainApplication.*; import forbes.mPassbook.R; import databaseClasses.DBAccountStatement; import databaseClasses.DBCategoryMaster; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.content.Intent; import android.database.Cursor; import android.graphics.Color; import android.graphics.Typeface; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.os.StrictMode; import android.text.Editable; import android.text.TextWatcher; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnKeyListener; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import android.os.Build; public class OfflinePBDetails extends Activity implements OnItemSelectedListener { TextView tvDate; TextView tvAmount; TextView tvBalance; TextView tvParticular; TextView tvTitleAmount; EditText etNotes; Spinner sp…
answer count: 3
has answer: http://stackoverflow.com/a/27015514
tagged with: android
has title: unable to disable button in android
favorite count: 0

http://stackoverflow.com/a/26877742
score: 0
answers question: http://stackoverflow.com/q/26877524
has body: As previously mentioned, to fix your String conversion issue, you're assignment line should be: ValidArray[validArraycount] = convertedInput; To fix your average problem, your code should look like this: //calculates sum of all values in array of ValidArray (of grades) for(double d : ValidArray){ sum += d; // &lt;-------- changed from sum += sum; } //avergae of valid number array double average = (sum/ValidArray.length);
type: Answer

http://stackoverflow.com/comment/42355152
type: AnswerComment
score: 0
type: Comment
has text: The section that will be of the most value to you is "[Working with Manifest Files: The Basics](https://docs.oracle.com/javase/tutorial/deployment/jar/manifestindex.html)". @ebullient No problem. What you had was a good start, so I didn't want to post another full answer. :)
comment on: http://stackoverflow.com/a/26901415

jackson
tags question: http://stackoverflow.com/q/26837401
tags question: http://stackoverflow.com/q/26938250
tags question: http://stackoverflow.com/q/26898003
tags question: http://stackoverflow.com/q/26884345
tags question: http://stackoverflow.com/q/26840861
tags question: http://stackoverflow.com/q/26925058
tags question: http://stackoverflow.com/q/26842063
tags question: http://stackoverflow.com/q/26989004
tags question: http://stackoverflow.com/q/26942142
tags question: http://stackoverflow.com/q/26935170
type: Tag
tags question: http://stackoverflow.com/q/26879286
tags question: http://stackoverflow.com/q/26975611
tags question: http://stackoverflow.com/q/26970584
tag name: jackson
tags question: http://stackoverflow.com/q/26885494
tags question: http://stackoverflow.com/q/26934861
tags question: http://stackoverflow.com/q/26877814
tags question: http://stackoverflow.com/q/26945580
tags question: http://stackoverflow.com/q/26958816
tags question: http://stackoverflow.com/q/26858605
tags question: http://stackoverflow.com/q/26861883
tags question: http://stackoverflow.com/q/26967466
tags question: http://stackoverflow.com/q/26959816
tags question: http://stackoverflow.com/q/26860358
tags question: http://stackoverflow.com/q/26984208
tags question: http://stackoverflow.com/q/26934757
tags question: http://stackoverflow.com/q/26832757

http://stackoverflow.com/comment/42267999
type: QuestionComment
score: 0
has text: Can you post your XML code?
comment on: http://stackoverflow.com/q/26852071
type: Comment

http://stackoverflow.com/a/40355284
answers question: http://stackoverflow.com/q/26875910
type: Answer
has body: After re-installing Android Studio(v.2.2.2) (Ubuntu system) I had problems with plugins (File->Settings->Plugins) like in: Problems found loading Plugins in Android Studio So I switched off plugins and forgot to switch on them. After that many build errors occurred. One of them: android.support.v4.widget.DrawerLayout Cannot be instantiated When I restared Android Studio and switched on all plugins again all errors are disappeared.
score: 0

http://stackoverflow.com/comment/42371785
comment on: http://stackoverflow.com/a/26907956
type: AnswerComment
has text: Then you should implement InputProcessor and add your code inside touchDown or clicked, so that your input vector coordinates are deleted when player releases his/hers finger and the coordinates update when player presses again.
score: 0
type: Comment

http://stackoverflow.com/comment/42452211
comment on: http://stackoverflow.com/a/26955561
has text: Thanks. This also helped -http://stackoverflow.com/questions/3606679/how-can-i-run-hadoop-run-with-a-java-class
type: AnswerComment
score: 0
type: Comment

otto
tag name: otto
tags question: http://stackoverflow.com/q/26956009
type: Tag

http://stackoverflow.com/a/26857433
type: Answer
has body: Why does your multiplicationTable function have an int[][] return type, when you return null? Would be better to just make it a void function, if you don't plan on having it return the array. Anyway, since all the function does in print to the screen, the function is over complicated. Could be made much simpler, something like this: public static void multiplicationTable(int x, int y) { for (int i = 1; i &lt;= x; i++) { for (int j = 1; j &lt;= y; j++) System.out.print(i * j); System.out.println(); } } But if you want it left as is, your ArrayIndexOutOfBounds exception is likely occuring here: for (int i = 1; i &lt; x + 1; i++) { for (int j = 1; j &lt; y + 1; j++) { System.out.print(myArray[i][j] + " "); } System.out.println(); } Because x and y are the size of the array, making your loop go to i &lt; x + 1 and i &lt; y + 1 will throw the exception, because it is trying to access a non-existing index. If you change it to i &lt; x and i &lt; y it shouldn't throw the exception: for (int i = 1; i &lt; x; i++) { for (int j = 1; j &lt; y; j++) { System.out.print(myArray[i][j] + " "); } System.out.println(); } However, even that will not give you the desired output, as it skips the first element of the array, because array indexes start at 0, not 1, meaning the multiplications for 1 will be missing from your table.
answers question: http://stackoverflow.com/q/26857156
score: 0

http://stackoverflow.com/q/26919270
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/42387387
favorite count: 0
has title: java returns VM error after upgrade in centos 6.5
upvote count: 1
accepted answer: http://stackoverflow.com/a/26919337
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42387241
tagged with: java
has comment: http://stackoverflow.com/comment/42387299
type: Question
has body: I want to upgrade my jdk on a centos server, after some simple searches i found some solutions. from this link you can see that the instructions are simple: jdk 7 installation guide for centos -install your jdk from rpm package or from source -do some alternatives -check the practical version (java -version) and i go easy with the first two steps but in check version step i get this error: Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object i have also checked alternatives --config java and simbolic links. i have also tried which command to find out what java is actually running and this was the link directoins. /usr/bin/java -&gt; /etc/alternatives/java -&gt; /usr/java/jdk-1.8.0_40/bin/java the weird point is when i run /usr/bin/java -version it is OK and it returns the version but when i run java without any prefix i got that error. so what is the problem?
tagged with: centos
has answer: http://stackoverflow.com/a/26919337
tagged with: linux
has comment: http://stackoverflow.com/comment/42387444

http://stackoverflow.com/q/26844544
has answer: http://stackoverflow.com/a/26844640
tagged with: runnable
downvote count: 1
favorite count: 0
answer count: 5
tagged with: multithreading
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26844934
accepted answer: http://stackoverflow.com/a/26844934
tagged with: java
has answer: http://stackoverflow.com/a/26845467
has answer: http://stackoverflow.com/a/26845080
upvote count: 1
has answer: http://stackoverflow.com/a/26844636
has title: Difference between the thread creation phenomenas and starting them
possible better answer: http://stackoverflow.com/a/26844640
has body: What is the Difference between the two thread creations in the code below: public class MyThread extends Thread { int a=0; public void run() { System.out.println("Some Thread"); } public static void main(String[] args) { MyThread m=new MyThread(); Thread t=new Thread(m); m.start(); //what is difference between this t.start(); //and this } } Both are giving me the same output.
score: 0

http://stackoverflow.com/q/26890048
type: Question
duplicate of: http://stackoverflow.com/q/138511
accepted answer: http://stackoverflow.com/a/26890090
has title: Troubleshooting java app
score: 0
has comment: http://stackoverflow.com/comment/42335319
has comment: http://stackoverflow.com/comment/42335243
answer count: 1
has body: I looked through several postings, but didn't see anything that related to this specifically. If there is a thread, would you please post a link? I have written a java app. It has a basic gui that gathers user preferences, then downloads files from the web based on those preferences. It works just fine in eclipse. It works just fine when I export into a .jar file on the same machine it was developed on. However, when I try to load it on a different machine, it brings up the gui and gathers information, then just hangs. It's irritating because I cannot troubleshoot the problem. I'm sure I'm not the first person to have this problem, so I equally sure there are tools out there to help me, but since I've taught myself up to this point, I've not come across any. Does anyone have any recommendations about what I might try, please?
has comment: http://stackoverflow.com/comment/42334626
has answer: http://stackoverflow.com/a/26890090
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/138511
has comment: http://stackoverflow.com/comment/42334279

http://stackoverflow.com/q/26928425
upvote count: 7
tagged with: autowired
type: Question
type: AnsweredQuestion
tagged with: jersey
score: 7
has title: None or multiple beans found in Spring context for type class ...myPackageHere..., skipping the type
answer count: 2
accepted answer: http://stackoverflow.com/a/31125745
downvote count: 0
favorite count: 0
has body: My Jersey Java classes looks like this: @Component ...class...MyComponent...extends myParent And in the parent class: ...abstract class myParent... @Autowired SomeBean myAutowiredBean I get some strange warnings when my server starts about: Nov 14, 2014 10:41:23 AM org.glassfish.jersey.server.spring.SpringComponentProvider bind SEVERE: None or multiple beans found in Spring context for type class ...myPackageAndClassHere..., skipping the type. Despite the warning message everything works as intended. Every class extending the parent has this warning. Has this to do with the abstract nature of the parent class ? I found this page where someone else has a similar issue, is this a jersey/spring problem ? I use Jersey 2.11 and Spring 3.2.3.
has answer: http://stackoverflow.com/a/69395291
tagged with: spring
possible better answer: http://stackoverflow.com/a/69395291
tagged with: java
has answer: http://stackoverflow.com/a/31125745

http://stackoverflow.com/q/26985183
has body: I'm trying to make Jersey supports GSON and for this I have read that I need to implement a Custom MessageBodyWriter and MessageBodyReader. Now my problem is that I couldn't find any clear definition of these 2 interfaces. From the doc : public interface MessageBodyWriter&lt;T&gt; Contract for a provider that supports the conversion of a Java type to a stream. To add a MessageBodyWriter implementation, annotate the implementation class with @Provider. A MessageBodyWriter implementation may be annotated with Produces to restrict the media types for which it will be considered suitable. and public interface MessageBodyReader&lt;T&gt; Contract for a provider that supports the conversion of a stream to a Java type. A MessageBodyReader implementation may be annotated with Consumes to restrict the media types for which it will be considered suitable. Providers implementing MessageBodyReader contract must be either programmatically registered in a JAX-RS runtime or must be annotated with @Provider annotation to be automatically discovered by the JAX-RS runtime during a provider scanning phase. Can anyone explain me what does concretly means ? And why do I need to implement them in the case of GSON support for example ? Thank you.
upvote count: 1
accepted answer: http://stackoverflow.com/a/26985702
type: AnsweredQuestion
tagged with: java
tagged with: gson
type: Question
has title: MessageBody Writer / Reader
tagged with: jersey
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26985702
tagged with: rest
tagged with: jax-rs

http://stackoverflow.com/q/26874488
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26874695
has answer: http://stackoverflow.com/a/26874695
tagged with: css
type: AnsweredQuestion
tagged with: java
tagged with: javafx
tagged with: stylesheet
has body: JavaFX has a method that is added to the controller: public void initialize(URL url, ResourceBundle rb) This seems to run before any of the controls are added to the scene, because when I add this to it: @Override public void initialize(URL url, ResourceBundle rb){ String treeItemCss = getClass().getResource("/media/css/TreeItem.css").getPath(); main.getScene().getStylesheets().add(treeItemCss); } The CSS: .tree-cell{ -fx-indent: 100; -fx-underline: true; } I get an error from this method: getStylesheets(). But if I move that to an OnAction and execute that action I get no errors. So my question is, is there a method that runs after all the controls are added to the scene, or a good way to add css to items that are created from a user action, such as a button click?
has title: JavaFX loading a stylesheet

http://stackoverflow.com/q/26870177
has comment: http://stackoverflow.com/comment/42300201
has comment: http://stackoverflow.com/comment/42299136
has comment: http://stackoverflow.com/comment/42299091
has comment: http://stackoverflow.com/comment/42299748
has comment: http://stackoverflow.com/comment/42300135
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: spring
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/42299318
has title: jUnit testing @RequestParam, but my test doesn't give any value to it
tagged with: java
has body: How can I test requested parameters which are coming from HTML to Spring controller? @RequestMapping(value = "foo", method = RequestMethod.POST) public String Foo(@RequestParam(value="bar", required=false) String bar{ if(bar==null || bar.length()==0){ return "error"; } return "success"; } I don't understand why this isn't working? @Test public void testFoo() throws Exception { mockMvc.perform(post("/foo") .param("bar", "this is not null")) .andExpect(view().name("success")); } I get: java.lang.AssertionError: View name expected:"success" but was:"error" So I want that my controller test skips the validation part and goes to "success", but somehow my test isn't giving value to my bar variable. How to make this work?
tagged with: junit

http://stackoverflow.com/comment/42397186
comment on: http://stackoverflow.com/a/26878137
type: AnswerComment
has text: And maybe you need to fix your sources list. Did you modify it a few months back when Heartbleed was a thing? Those libraries (and some others) should be listed if you do `ldd $(which openssl)`. Also try (as root) `dpkg -l | grep libssl`.
score: 0
type: Comment

http://stackoverflow.com/comment/42400163
type: AnswerComment
type: Comment
score: 2
has text: but it shows diff in external tool (ex, Git Extensions) as empty changed file and I can't commit this file.
comment on: http://stackoverflow.com/a/26926922

http://stackoverflow.com/comment/66851606
type: AnswerComment
type: Comment
has text: @IgorGanapolsky Yeah, haven't noticed any downsides for years. Check link in answer for some details.
comment on: http://stackoverflow.com/a/37674375
score: 0

http://stackoverflow.com/a/26880803
has body: int sum = 0; Scanner s = new Scanner (new File("patch.txt")); while (s.hasNextLine()){ String [] str = s.nextLine().split("\r"); for (int i = 0; i &lt; str.length; i++){ if(!str[i].trim().isEmpty){ sum+=Integer.parseInt(str[i]); } } } s.close(); System.out.print(sum); //the result is 15 Try this. Edited above code.
answers question: http://stackoverflow.com/q/26880584
has comment: http://stackoverflow.com/comment/42317891
score: 0
type: Answer

http://stackoverflow.com/a/26954052
answers question: http://stackoverflow.com/q/26952677
type: Answer
accepted answer of: http://stackoverflow.com/q/26952677
score: 0
type: AcceptedAnswer
has body: Answering in new response so I can quote code. back @LALA. This particular problem is not generics, it's how to override the key method, equals(Object) defined in java.lang.Object. To override a method from the base class you have to get the signature spot on. Easy to mess up, somewhere (java 1.4??) java added the method annotation @Override. This tells the compiler (and anyone reading the code ... including you tomorrow) that "This method is intended to override a method from the base class (or interface); if it is not please throw a compile-time-error because I have f-ed up. Following this guideline, you would have typed: //overrides the equals method and returns country name if found @Overrides public boolean equals(Country obj) ... The compiler would jump in and save you here, noting that it does NOT override anything. Correct would be: //overrides the equals method and returns country name if found @Overrides public boolean equals(Object obj) ... I would like to add... you have committed a major-java-developer-sin. You have [attempted to] write equals(), but you have not also overridden hashCode() (again specifying @Override is even more vital here (I personally often forget to capitalize the 'C').) Seriously, never write one of these 2 methods w/o the other. As an assignment for this answer, read the following carefully: https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object) https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()

http://stackoverflow.com/comment/42419232
type: QuestionComment
has text: @hagubear That my friend, might not be true. It says `An abstract representation of file and directory pathnames.` on Doc:https://docs.oracle.com/javase/7/docs/api/java/io/File.html
score: 0
comment on: http://stackoverflow.com/q/26937409
type: Comment

http://stackoverflow.com/comment/42488540
type: Comment
has text: @jhamon casting is not the issue.
comment on: http://stackoverflow.com/q/26976929
score: 0
type: QuestionComment

http://stackoverflow.com/comment/42468558
type: QuestionComment
has text: Won't let me because it's too big. It's basically a long list of unordered names.
comment on: http://stackoverflow.com/q/26965509
score: 0
type: Comment

http://stackoverflow.com/q/26911562
accepted answer: http://stackoverflow.com/a/26948742
has comment: http://stackoverflow.com/comment/42404779
type: Question
tagged with: jpa
has comment: http://stackoverflow.com/comment/42405443
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/42399615
has answer: http://stackoverflow.com/a/26948742
has title: Failed to integrate Hibernate object with Javax DI
tagged with: maven
has body: I am trying to set up demo maven project from scratch but I am having hard time injecting hibernate object into REST controller. So far I have following dependencies Maven Spring Boot Jersey 2.7 I have also added hibernate and postgresql driver dependencies and also I am using java configuration for data source initialization. I am able to start the server but as soon as I visit end point application fails with following exception: org.glassfish.hk2.api.UnsatisfiedDependencyException: There was no object available for injection at Injectee(requiredType=ProductDao,parent=ProductsResource,qualifiers={}),position=0,optional=false,self=false,unqualified=null,106121749) at org.jvnet.hk2.internal.ThreeThirtyResolver.resolve(ThreeThirtyResolver.java:74) at org.jvnet.hk2.internal.ClazzCreator.resolve(ClazzCreator.java:232) at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:249) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:414) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.glassfish.jersey.process.internal.RequestScope.findOrCreate(RequestScope.java:160) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:621) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606) at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:173) at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185) at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:103) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:128) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:131) at org.glassfish.jersey.server.…
type: AnsweredQuestion
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/42395974
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/26922866
answers question: http://stackoverflow.com/q/26921011
type: Answer
has body: I would also recommend checking out this guy's github for a good example of a fork bomb. Even though he uses an activity to launch it you could modify it to run in a service.
score: 0

http://stackoverflow.com/a/26878573
answers question: http://stackoverflow.com/q/26878404
score: 0
has body: validArrayCount already holds the number of elements that are entered. Instead of printing vArrayLen for the number of valid grades entered, print out validArrayCount: System.out.println("The number of valid grades entered is " + validArrayCount); To get the average, you can divide by validArrayCount instead of ValidArray.length: double average = (sum/validArrayCount); Also, you have to add the array indices when printing the array backwards: // for printing array backwards for (int i = validArrayCount-1; i&gt;=0; i--){ System.out.print(ValidArray[i] + " "); } System.out.println(); //For inserting a new line after printing all array elements
type: Answer

http://stackoverflow.com/a/26919894
type: Answer
has body: Scopes of type members and shadowing is a hard place for a compiler. There was/are number of bugs related to this - mostly about nested/inner/anonymous types. I can't find the one that is exactly about that issue but I know some that can be related to it. Here is the one with a case very similiar to this (type variable instead of enclosing type). Concerning what specification says about shadowing there is also an issue. It has references to JLS and describes what is not ideal.
answers question: http://stackoverflow.com/q/26913341
score: 0

http://stackoverflow.com/a/26899222
upvote count: 2
score: 2
has body: The percent sign for (13%) is being interpreted as a placeholder. It's looking for characters after the % for details about how to format a variable there, and ) isn't valid. You meant to have a literal % in the output, not interpreted as a placeholder. It must escaped with another % sign. Try: System.out.printf( &quot;\n\nThe total bill for your group is $%.2f before taxes. The HST (13%%) will be $%.2f.&quot;, totalBill, amountOfTax); See the Formatter javadocs for details: The format specifiers which do not correspond to arguments have the following syntax: %[flags][width]conversion And '%' percent The result is a literal '%' ('\u0025')
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/26899191
answers question: http://stackoverflow.com/q/26899191

http://stackoverflow.com/q/26979036
has comment: http://stackoverflow.com/comment/42492803
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42492598
has title: Google-style cards (issue)
upvote count: 1
has answer: http://stackoverflow.com/a/26979558
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/26979558
favorite count: 0
tagged with: android
has body: I'm just a novice who's JUST started learning to make android apps using tutorials etc... I just found some code to make Google-style cards, and I wrote the code but for some reason it seems to have errors. In my static, it can't "convert from object to Typeface", it's calling it a mismatch. Also, it cannot resolve "commandText" (myListItem.descText = (TextView) convertView.findViewById(R.id.commandText);) Any help possible? Thanks much, here is the code: ArrayListAdapter.java- import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import android.content.Context; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class NowArrayAdapter extends ArrayAdapter&lt;String&gt; { private Context context; private ArrayList&lt;String&gt; values; private Typeface typeface; private static Hashtable fontCache = new Hashtable(); private LayoutInflater inflater; public class CustomListItem { TextView descText; } public NowArrayAdapter(Context context, int resource, ArrayList&lt;String&gt; commandsList) { //TODO Auto-generated constructor stub super(context, R.layout.list_item, commandsList); this.context = context; values = new ArrayList&lt;String&gt;(); values.addAll(commandsList); typeface = getTypeface(this.context, "fonts/Roboto-Light.ttf"); inflater = LayoutInflater.from(this.context); } static Typeface getTypeface(Context context, String font) { Typeface typeface = fontCache.get(font); if (typeface == null) { typeface = Typeface.createFromAsset(context.getAssets(), font); fontCache.put(font, typeface); } return typeface; } public View getView(int position, View convertView, ViewGroup parent) { CustomListItem myListItem; String myText = getItem(position); if(convertView == null) { convertView = inflater.inflate(R.layout.list_item, parent, false); myListItem = new CustomListItem(); myListItem.descText = (T…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42492616

http://stackoverflow.com/comment/136820335
type: AnswerComment
type: Comment
has text: In my case I had to `grep jvm` but thanks for the nice answer.
score: 1
comment on: http://stackoverflow.com/a/46458253

http://stackoverflow.com/comment/42382505
type: Comment
type: QuestionComment
has text: By default it creates a *new* profile to run Firefox every time it starts a FF instance. This is normal.
comment on: http://stackoverflow.com/q/26913518
score: 0

http://stackoverflow.com/q/26905802
score: 1
tagged with: java
type: Question
has body: I have many modules in my project, In every module i have text box. I want to validate the input(alphabet). For this i have to write a common method. Need some examples. Thanks in advance.
accepted answer: http://stackoverflow.com/a/26906043
has title: Validate the string length in SWT Text
upvote count: 1
has answer: http://stackoverflow.com/a/26906043
answer count: 1
favorite count: 0
tagged with: swt
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/44784590
has body: I came across the same issue. I tried adding the server in "Server Runtime" but unfortunately that didn't work for me. What worked for me is, I added javax.servlet-api-3.0.1.jar file in build path. On the other hand If It's a Maven project add dependency for this jar file. This would definitely work.
type: Answer
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26936848

http://stackoverflow.com/comment/42474429
score: 0
type: AnswerComment
has text: The issue is that my image is of 640x480 , but i am not able to make it larger than a certain size.But the above poster has given a code which scales it further down.My issue is that the image is already small.
type: Comment
comment on: http://stackoverflow.com/a/26969052

http://stackoverflow.com/a/26938911
has comment: http://stackoverflow.com/comment/42422590
has body: Your code has some fundamental flaws. Both the Teacher and Student classes include synchronized (this) and wait() and notifyAll(), but based on the way you're using them I think you don't really understand that each of these constructs acts only on the specific instance in question. For instance, when a Student thread enters wait, it will remain in that state until some other thread calls notify() or notifyAll() on that instance. Very specifically x.notifyAll() doesn't wake up every thread that is doing any kind of waiting. It only wakes up something that has previously done x.wait(), where x is the exact same object. In order to do this kind of cross thread synchronization, there needs to be a shared object on which all threads act. Since the Table object is shared by all the instances, that seems like the obvious candidate. So for a first pass I would replace all wait() with tab.wait() and notifyAll() with tab.notifyAll() and drop the synchronized(this). This will likely get you closer to the functionality you're trying to achieve.
answers question: http://stackoverflow.com/q/26938758
accepted answer of: http://stackoverflow.com/q/26938758
type: AcceptedAnswer
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/42422892

http://stackoverflow.com/q/26971062
has comment: http://stackoverflow.com/comment/42478467
score: 0
tagged with: java
answer count: 0
type: UnansweredQuestion
has body: private void DishFormWeekNoWeek1RbKeyTyped(java.awt.event.KeyEvent evt) { // TODO add your handling code here: char character = evt.getKeyChar(); //System.out.print("Number:"+number + "character:"+character); if(character == KeyEvent.VK_1){ System.out.print("character:"+character); DishFormWeekNoWeek1Rb.setSelected(true); DishFormWeekNoWeek1Rb.requestFocus(true); }else if(character == KeyEvent.VK_2){ System.out.print("character:"+character); DishFormWeekNoWeek2Rb.setSelected(true); DishFormWeekNoWeek2Rb.requestFocus(true); }else if(character == KeyEvent.VK_3){ System.out.print("character:"+character); DishFormWeekNoWeek3Rb.setSelected(true); DishFormWeekNoWeek3Rb.requestFocus(true); }else if(character == KeyEvent.VK_4){ System.out.print("character:"+character); DishFormWeekNoWeek4Rb.setSelected(true); DishFormWeekNoWeek4Rb.requestFocus(true); } } Radio button adding short cut key private void formKeyPressed(java.awt.event.KeyEvent evt) { // TODO add your handling code here: char character = evt.getKeyChar(); //System.out.print("Number:"+number + "character:"+character); if(character == KeyEvent.VK_1){ System.out.print("character:"+character); DishFormWeekNoWeek1Rb.setSelected(true); DishFormWeekNoWeek1Rb.requestFocus(true); }else if(character == KeyEvent.VK_2){ System.out.print("character:"+character); DishFormWeekNoWeek2Rb.setSelected(true); DishFormWeekNoWeek2Rb.requestFocus(true); }else if(character == KeyEvent.VK_3){ System.out.print("character:"+character); DishFormWeekNoWeek3Rb.setSelected(true); DishFormWeekNoWeek3Rb.requestFocus(true); }else if(character == KeyEvent.VK_4){ System.out.print("character:"+character); DishFormWeekNoWeek4Rb.setSelected(true); DishFormWeekNoWeek4Rb.requestFocus(true); } } I have same code for adding short cut key in radio button and in form itself but in the form itself it does not fire...How to write it in a way that it will fire whenever i press the number even when i dont select the button..Basically i want to have a short key …
has comment: http://stackoverflow.com/comment/42478680
has comment: http://stackoverflow.com/comment/42478158
type: Question
has title: on pressed event in radio button compare in form itself
tagged with: jradiobutton
tagged with: swing
has comment: http://stackoverflow.com/comment/42479484
tagged with: keyevent
has comment: http://stackoverflow.com/comment/42478748
has comment: http://stackoverflow.com/comment/42504739

http://stackoverflow.com/q/26855566
tagged with: eclipse
has answer: http://stackoverflow.com/a/27135946
score: 0
answer count: 1
has body: I'm working in a web project that uses a XText grammar but every time I run it on Apache Tomcat I find the same error java.lang.ClassNotFoundException: co.edu.uniandes.enar.picture.Model at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1324) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1177) at co.edu.uniandes.picture.webpicture.servlet.util.UploadDownloadFileServlet.doPost(UploadDownloadFileServlet.java:75) at javax.servlet.http.HttpServlet.service(HttpServlet.java:644) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) ... I already did the steps mentioned in http://www.eclipse.org/forums/index.php/t/489925/ to generate the Jar file but again it does not work Thanks in advance
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: emf
tagged with: apache
has title: How to run mwe.utils.StandaloneSetup in server

http://stackoverflow.com/comment/42317521
comment on: http://stackoverflow.com/q/26880126
has text: @energizer it jsut craetesa new table cart_cartitem joining both the tables primary key column still foreign key is not updated here is the changes u suggested
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42376399
score: 1
type: Comment
type: QuestionComment
has text: Add a breakpoint at the start of doGet and a watch on gameRatingsThisWeek. To do this right click the variable while on debug mode and click on "Add Watch". Alternatively just so a sysout on the list (but try the debugger first).
comment on: http://stackoverflow.com/q/26912276

http://stackoverflow.com/comment/42348255
type: QuestionComment
comment on: http://stackoverflow.com/q/26897498
score: 2
has text: Range is `a-z`, union of ranges is `[a-zA-Z]` which in Java can also be written as `[a-z[A-Z]]` or `[[a-z][A-Z]]`.
type: Comment

http://stackoverflow.com/a/26900772
downvote count: 0
type: Answer
has body: Nope. The goto statement exists in C and C++, which Java is vaguely similar to, but it's generally considered very bad practice to use. It makes code difficult to read and debug. Here are some correct ways to solve this problem with more structured programming: do { ... } while (input == 0); private void doTheThing() { // please use a better name! ... if (input == 0) doTheThing(); // recursion not recommended; see alternate // method below } // alternate method: do { doTheThing(); } while (input == 0);
score: 2
answers question: http://stackoverflow.com/q/26900743
upvote count: 2

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/26960845
tags question: http://stackoverflow.com/q/26847282
tags question: http://stackoverflow.com/q/26842637
tags question: http://stackoverflow.com/q/26852882
tags question: http://stackoverflow.com/q/26890603
tags question: http://stackoverflow.com/q/26854151
tags question: http://stackoverflow.com/q/26845885
tags question: http://stackoverflow.com/q/26952078

http://stackoverflow.com/comment/42268998
type: Comment
comment on: http://stackoverflow.com/a/26852779
type: AnswerComment
has text: You said this is a "single check" - but that is a single _logical_ check (interpreted by humans). To confirm that, I have changed `object == null` to `object == ""` (which make no sense, but kills the logic) and the answer is the same. Moreover, I then took one more step and inlined everything and that returned CC == 1, which is clearly wrong. Thank you!
score: 0

http://stackoverflow.com/a/26874589
type: Answer
answers question: http://stackoverflow.com/q/26874152
score: 0
has body: So you want to do something in your activity based on what you receive in the onReceive of the BroadcastReceiver? Here is something that I did before: You can use LocalBroadcast. See LocalBroadcast Manager. For how to implement is, there is a great example on how to use LocalBroadcastManager?. LocalBroadcast Manager is a helper to register for and send broadcasts of Intents to local objects within your process. The data you are broadcasting won't leave your app, so don't need to worry about leaking private data.` Your activity registers for this local broadcast. From the NetworkChangeReceiver you send a LocalBroadcast from within the onReceive (saying that hey, I received a message. Show it activity). Then inside your Activity you can listen to the broadcast. This way if the activity is in the forefront/is active, it will receive the broadcast otherwise it won't. So, whenever you receive that local broadcast, you may do the desired action if activity is open. If you want to do for the whole app, then you can make all your activities extend an abstract activity. And inside this abstract activity class you can register it for this 'LocalBroadcast'. Other way is to register for LocalBroadcast inside all your activities (but then you'll have to manage how you'll show the message only once). This Broadcast is private to your app. So its secure as well. Hope it helps. Same thing can be done from within the Service as well. This is just one of the ways to do it.

http://stackoverflow.com/q/26903849
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/42359269
has comment: http://stackoverflow.com/comment/42359167
type: Question
has comment: http://stackoverflow.com/comment/42359455
has answer: http://stackoverflow.com/a/26905816
has comment: http://stackoverflow.com/comment/42359306
has comment: http://stackoverflow.com/comment/42359164
has comment: http://stackoverflow.com/comment/42363591
has title: How to restart java program if JVM crashes
has comment: http://stackoverflow.com/comment/42359520
has comment: http://stackoverflow.com/comment/42359352
has comment: http://stackoverflow.com/comment/42359544
has comment: http://stackoverflow.com/comment/42359077
has comment: http://stackoverflow.com/comment/42362695
downvote count: 2
answer count: 1
tagged with: jvm
favorite count: 0
upvote count: 3
has body: I am working on a very low configuration machine , where JVM crashes sometimes. The java application name is application.jar, which plays HD Video from local streaming servers. This application is running on a embeded win7 touch computer, which is hanged in a lounge. Some time the heap size exceeds and the error is out of memory the the JVM shuts down. I want to restart my application.jar whenever JVM crashes. It is possible. Then how? Thanks. Edit: wrapping with try catch does not work as jvm crashed. I also have used -Xms512m -Xmx1024m while running the jar file. the crash frequency is got lower but still it remains.
has comment: http://stackoverflow.com/comment/42359245

http://stackoverflow.com/comment/42372537
score: 0
comment on: http://stackoverflow.com/q/26891371
type: Comment
type: QuestionComment
has text: A "concrete problem" in Stackoverflow's context is a problem where you have some code to show with specific implementation problems. Your comment here has transformed your question into "is there a library for..." or "are there any suggestions to do something very general." See [this.](http://stackoverflow.com/help/on-topic)

http://stackoverflow.com/comment/42485836
score: 0
type: Comment
has text: Because your "answer" initially was a SWAG and likely to be misleading, and in fact was wrong.
comment on: http://stackoverflow.com/a/26975241
type: AnswerComment

http://stackoverflow.com/q/26835377
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/26835523
has answer: http://stackoverflow.com/a/26835523
score: 0
has answer: http://stackoverflow.com/a/26835500
has body: I am trying update the text of an index in my ListView when text is typed into a TextField, but I don't know how to access the item to update the text. I know the index of the item, but I just cant seem to figure out how to update the text.. @FXML ListView connections; public ObservableList names = FXCollections.observableArrayList(); @FXML public void onInputChanged(KeyEvent event){ TextField fld = (TextField) event.getTarget(); if(fld.getId().equals("txtName") &amp;&amp; index &gt; -1){ } }
has title: Update text in a ListView
has comment: http://stackoverflow.com/comment/42236853
type: AnsweredQuestion
tagged with: java
tagged with: javafx
accepted answer: http://stackoverflow.com/a/26835500

http://stackoverflow.com/a/26925992
score: 1
accepted answer of: http://stackoverflow.com/q/26925891
answers question: http://stackoverflow.com/q/26925891
upvote count: 1
has body: You can use the &lt;c:if&gt; tag, and put that comparison: http://www.tutorialspoint.com/jsp/jstl_core_if_tag.htm
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/26976237
answers question: http://stackoverflow.com/q/26957647
has body: The solution was to complete the migration to Spring by using Spring transaction management and remove all our self(hibernate) managed transactions.
score: 0
type: Answer

http://stackoverflow.com/comment/42435077
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26945948
has text: @BlazeTama check out the logcat !
type: Comment

http://stackoverflow.com/comment/42474162
score: 0
comment on: http://stackoverflow.com/a/26968373
type: AnswerComment
type: Comment
has text: i am using this code in jsp .10,10,2014 are hard coded value.I placed my value there as Date da = ag.getCreatedOn(); Calendar x = new GregorianCalendar(da.getYear(), da.getMonth() - 1, da.getDay()); But it gives da.getyear getmonth,getday deprecatad

eclipse-rcp
tags question: http://stackoverflow.com/q/26841285
tags question: http://stackoverflow.com/q/26904378
type: Tag
tags question: http://stackoverflow.com/q/26868927
tags question: http://stackoverflow.com/q/26929694
tags question: http://stackoverflow.com/q/26889530
tags question: http://stackoverflow.com/q/26848719
tags question: http://stackoverflow.com/q/26909856
tags question: http://stackoverflow.com/q/26904760
tags question: http://stackoverflow.com/q/26889642
tags question: http://stackoverflow.com/q/26924184
tags question: http://stackoverflow.com/q/26912078
tags question: http://stackoverflow.com/q/26906983
tag name: eclipse-rcp
tags question: http://stackoverflow.com/q/26842920
tags question: http://stackoverflow.com/q/26960601

http://stackoverflow.com/comment/42470787
comment on: http://stackoverflow.com/q/26966889
has text: see http://stackoverflow.com/questions/402330/is-it-possible-to-add-to-classpath-dynamically-in-java
score: 0
type: Comment
type: QuestionComment

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/26849323
tags question: http://stackoverflow.com/q/26981264
type: Tag
tags question: http://stackoverflow.com/q/26875043
tags question: http://stackoverflow.com/q/26833524
tags question: http://stackoverflow.com/q/26867840
tags question: http://stackoverflow.com/q/26939774
tags question: http://stackoverflow.com/q/26895014
tags question: http://stackoverflow.com/q/26920906
tags question: http://stackoverflow.com/q/26922991
tags question: http://stackoverflow.com/q/26887779

http://stackoverflow.com/q/26914339
accepted answer: http://stackoverflow.com/a/26914498
type: AnsweredQuestion
downvote count: 2
type: Question
has body: how can i end a client program in java if there is no user input for 2 minutes? please help am using threading to create multiple clients Each client program should end if there is no input from command line(not using GUI)
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/26914498
upvote count: 0
has comment: http://stackoverflow.com/comment/42377812
answer count: 1
has title: Client Java Time Delay User Input
favorite count: 0

http://stackoverflow.com/comment/42449746
comment on: http://stackoverflow.com/q/26954910
score: 0
type: Comment
type: QuestionComment
has text: No question is stupid. Everyone learns only by asking questions, silly or not. Keep learning.

http://stackoverflow.com/comment/42290303
has text: in `resources` folder
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26864953
score: 0

http://stackoverflow.com/q/26872774
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/42303939
score: 1
has body: Inside one of my fragments I want to display a Google Maps service. But i get a StrictMode error: 1899-1903/com.android.calendar E/StrictMode﹕ A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. java.lang.Throwable: Explicit termination method 'close' not called I have downloaded Google Play Services, Repository and Google API in the SDK. I have set up the dependencies in my Android Studio gradle build: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:support-v4:21.0.0' compile 'com.android.support:appcompat-v7:21.0.+' compile 'com.google.android.gms:play-services:6.1.+' } My manifest settings look like this: ... &lt;permission android:name="org.example.mapapp.permission.MAPS_RECEIVE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="org.example.mapapp.permission.MAPS_RECIEVE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt; &lt;uses-feature android:glEsVersion="0x00020000" android:required="true" /&gt; ... &lt;application&gt; ... &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /&gt; &lt;meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="myApiKey" /&gt; ... Inside my Fragment i set it up like this: public class MapFragment extends Fragment { static final LatLng HAMBURG = new LatLng(53.558, 9.927); static final LatLng KIEL = new LatLng(53.551, 9.993); private static GoogleMap map; @O…
upvote count: 1
has title: StrictMode error with Google Maps v2 @ Android fragment
type: Question
has comment: http://stackoverflow.com/comment/42304130
tagged with: java
tagged with: android-maps-v2
tagged with: google-play-services
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/26873014

http://stackoverflow.com/a/26947933
score: 1
type: Answer
upvote count: 1
has body: Add a style class to the pane ("image-container", for example), then in the css do .imageView{ -fx-image: url("image/normal.png"); } .image-container:pressed .imageView { -fx-image: url("/image/press.png"); }
answers question: http://stackoverflow.com/q/26947741
accepted answer of: http://stackoverflow.com/q/26947741
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/42508945
score: 0
has text: Thanks for all the info. I will look at other aspects of the code. It may be something completely unrelated. Thanks again.
comment on: http://stackoverflow.com/q/26988287
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26933480
has comment: http://stackoverflow.com/comment/42437054
has comment: http://stackoverflow.com/comment/42437113
upvote count: 2
answers question: http://stackoverflow.com/q/26931791
has body: I cant understand how can I run krasa-jaxb-tools, I found another solution. It is hibernate-validator dependencies: javax.validation validation-api 1.1.0.Final javax.el javax.el-api 2.2.4 org.glassfish.web javax.el 2.2.4 and java code: ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); Validator validator = factory.getValidator(); x = validator.validate(bean).size(); // x=0 good; x!=0 bad it is not beautiful but it is works
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/42335220
score: 0
type: Comment
has text: Thanks. This is what i was assuming was happening from the comments i made in my edit.
comment on: http://stackoverflow.com/a/26890551
type: AnswerComment

http://stackoverflow.com/q/26977784
favorite count: 0
has answer: http://stackoverflow.com/a/26978028
tagged with: delete-file
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42490649
has comment: http://stackoverflow.com/comment/42490529
has answer: http://stackoverflow.com/a/26978678
accepted answer: http://stackoverflow.com/a/26978376
upvote count: 1
tagged with: last-modified
has answer: http://stackoverflow.com/a/26979115
has title: Delete all files not modified in last ten days
type: Question
tagged with: java
has body: I have a folder where I keep log files and I have a job scheduled to run each day to delete old logs. What's a good way to delete old log files? Currently, I loop through the directory to read files File[] listOfFiles = srcFolder.listFiles(fileNameFilter); // this makes an array of files which match a filter I created for(int i=listOfFiles.length-1; i&gt;0; i--){ // leave at least one file // listOfFiles[i].lastModified() - in last ten days? if( what condition ?){ try { listOfFiles[i].delete(); } catch(Exception e){ } } } I'm thinking if(listOfFiles[i].lastModified() &lt; tenDaysAgoMS) // where tenDaysAgoMS is the milliseconds ten days ago, but how to implement?
has comment: http://stackoverflow.com/comment/42490619
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/26978376
possible better answer: http://stackoverflow.com/a/26978028

http://stackoverflow.com/comment/42458811
score: 0
has text: @NewbCoder1 Should be `Random.getRandom().nextInt(100)+1`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26960158

http://stackoverflow.com/comment/42297726
has text: @RafaelGuillen thank you. My problem (and what I wish to know more) is how can I pass an object as a parameter in a soap message without using any tools other than jax-ws and jaxb
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26844581

http://stackoverflow.com/comment/42276412
has text: jmoreno was just a simple representation but very similar to what I was working with. Have it all figured out now though. Thanks
comment on: http://stackoverflow.com/q/26856897
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26950251
tagged with: java
has comment: http://stackoverflow.com/comment/42450341
type: Question
accepted answer: http://stackoverflow.com/a/26951508
answer count: 2
has title: android cipher doesn't decrypt first 16 bytes / characters of encrypted data
downvote count: 0
has body: I am working on a file encryption/decryption app. I am using a simple .txt file for testing. When I select the file from within the app and choose to encrypt, the entire file data is encrypted. However, when I decrypt only part of the file data gets decrypted. For some reason the first 16 bytes/characters doesn't get decrypted. test_file.txt contents: "This sentence is used to check file encryption/decryption results." encryption result: "¾mÁSTÐÿT:Y­„"O¤]ÞPÕµß~ëqrÈb×ßq²¨†ldµJ,O|56\e^-’@þûÝû" decryption result: "£ÿÒÜÑàh]VÄþ„- used to check file encryption/decryption results." There aren't any errors in the logcat. What am I doing wrong? Method to encrypt file: public void encryptFile(String password, String filePath) { byte[] encryptedFileData = null; byte[] fileData = null; try { fileData = readFile(filePath);//method provided below // 64 bit salt for testing only byte[] salt = "goodsalt".getBytes("UTF-8"); SecretKey key = generateKey(password.toCharArray(), salt);//method provided below byte[] keyData = key.getEncoded(); SecretKeySpec sKeySpec = new SecretKeySpec(keyData, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, sKeySpec); encryptedFileData = cipher.doFinal(fileData); saveData(encryptedFileData, filePath);//method provided below } catch (Exception e) { e.printStackTrace(); } } Method to read file content: public byte[] readFile(String filePath) { byte[] fileData; File file = new File(filePath); int size = (int) file.length(); fileData = new byte[size]; try { BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(file)); inputStream.read(fileData); inputStream.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return fileData; } Method to generate secret key: private SecretKey generateKey(char[] password, byte[] salt) throws NoSuchAlgorithmException, InvalidKeySpecException { // Number of PBKDF2 hardening rounds to use. L…
favorite count: 0
has answer: http://stackoverflow.com/a/26951841
has answer: http://stackoverflow.com/a/26951508
tagged with: encryption
tagged with: android
score: 6
upvote count: 6
tagged with: aes
possible better answer: http://stackoverflow.com/a/26951841
type: AnsweredQuestion

http://stackoverflow.com/q/26981119
has title: How to run code (change text of text view) itself if activity is created (visible)?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26981314
type: Question
has body: I searched a lot and tried it with handler but nothing worked.. I want an activity with a text view (remove text in on create) and if its visible I want to set text to this view and after some times again and again and again.. Do I really need an interaction from user like button to start this??
answer count: 2
upvote count: 1
tagged with: android-activity
possible better answer: http://stackoverflow.com/a/26981314
favorite count: 0
has answer: http://stackoverflow.com/a/26981256
accepted answer: http://stackoverflow.com/a/26981256
tagged with: android

http://stackoverflow.com/comment/42310734
comment on: http://stackoverflow.com/q/26876594
score: 0
type: Comment
type: QuestionComment
has text: i've edited it don't know if it's better now in this way

http://stackoverflow.com/q/26882288
possible better answer: http://stackoverflow.com/a/26882810
accepted answer: http://stackoverflow.com/a/26882422
has title: How to check if byte array contents form a double number and not a String Java?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26882810
has answer: http://stackoverflow.com/a/26882422
type: Question
has comment: http://stackoverflow.com/comment/42320507
has comment: http://stackoverflow.com/comment/42320489
answer count: 2
has body: I have byte array which usually have contents which from Double number as explained below: //runs and prints 1.0 byte[] byteArrayValExpected = { 63, -16, 0, 0, 0, 0, 0, 0 }; System.out.println(ByteBuffer.wrap(byteArrayValExpected).getDouble()); //fails because byte array contents forms string "None" byte[] byteArrayValUnexpected = { 78, 111, 110, 101 }; System.out.println(ByteBuffer.wrap(byteArrayValUnexpected).getDouble()); My question is: how do I find that byte buffer elements form a double number and it is not a string like "None" as shown above?
score: 0

http://stackoverflow.com/q/26976793
has title: printing out specific letters from chosen items from an array (Java)
has comment: http://stackoverflow.com/comment/42488515
favorite count: 0
type: UnansweredQuestion
answer count: 4
linked to: http://stackoverflow.com/q/8172420
has answer: http://stackoverflow.com/a/26976991
has answer: http://stackoverflow.com/a/26977132
score: 1
tagged with: java
has body: I'm very, VERY new to Java so apologies if this is something very obvious that I just fail to see. I'm doing a course on Java at my uni and we've just started to cover arrays. There was a simple exercise we were assigned: Write a program that creates an array (names) with the names Bob, Ann &amp; Tom. The program should go through the array and print out the first letter of each name as a word ("BAT"). We are given a way to do it using a for loop and this method works: String [] names = {"Bob", "Ann", "Tom"}; String initials = ""; for (int i = 0; i &lt; names.length; i++) { initials = initials + names[i].charAt(0); } System.out.print(initials); But I wanted to do it in another way, using char.At() method: System.out.print(names[0].charAt(0) + names[1].charAt(0) + names[2].charAt(0) + "\n"); However, instead of "BAT", the output is 215. Can anyone explain why this is happening and what's wrong with my code? Many, many thanks! ==== EDIT: I have now tried the four solutions that chsdk, jgr208, Pier-Alexandre Bouchard and Gorfield suggested, however none of them works. I still end up with 215. I've also tried methods of converting chars to strings mentioned in this thread; I still end up with 215. This got me thinking maybe there is something wrong with my declaration of the array? Any suggestions? Code details of what I've tried below. String [] names = {"Bob", "Ann", "Tom"}; String initials = ""; initials = initials + names[0].charAt(0); initials = initials + names[1].charAt(0); initials = initials + names[2].charAt(0); System.out.print(initials); = 215 String [] names = {"Bob", "Ann", "Tom"}; String a = names[0].charAt(0) + ""; String b = names[1].charAt(0) + ""; String c = names[2].charAt(0) + ""; System.out.print("" + a + "" + b + "" + c + ""); = 215 String [] names = {"Bob", "Ann", "Tom"}; String a = new Character(names[0].charAt(0)).toString(); String b = new Character(names[1].charAt(0)).toString(); String c = new Character(names[2].charAt(0)).toString(); System…
upvote count: 1
has answer: http://stackoverflow.com/a/26977001
type: Question
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/42534899
has answer: http://stackoverflow.com/a/26976958

http://stackoverflow.com/comment/42463336
type: QuestionComment
comment on: http://stackoverflow.com/q/26962519
has text: Post the definition of `ContractDataFactoryImpl`. Do all the methods of `DB` throw `RemoteException` or `IOException`?
type: Comment
score: 0

http://stackoverflow.com/a/26949910
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42475641
has body: Any project that has been around for 8+ years changes and evolves; the information you've found is out-of-date and you will find updated projects for Red5 here: https://github.com/Red5 For the server itself, go here: https://github.com/Red5/red5-server Ant and Ivy have not been used with the server portion of the project for several years now and what you will need to know now to proceed with the latest stuff is Maven.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26946778
has comment: http://stackoverflow.com/comment/42481715
accepted answer of: http://stackoverflow.com/q/26946778
upvote count: 2

http://stackoverflow.com/comment/42233101
has text: Because you are using a `double`? Try using an integral type.
comment on: http://stackoverflow.com/q/26833363
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26987343
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/26989800
accepted answer: http://stackoverflow.com/a/26989800
type: Question
has title: GSON to server in url format?
answer count: 1
score: 0
has body: I have converted my java objects to json format. InetAddress address = InetAddress.getByName("D****"); String ipAddress= address.getHostAddress(); Gson gson = new Gson(); String json = gson.toJson(ipAddress); System.out.println(); I need to get the json value to server url format, eg: localhost:8080/json so that I can get that value from the ajax url. How can I achieve this?
tagged with: spring-mvc

http://stackoverflow.com/comment/42334434
score: 0
type: Comment
type: QuestionComment
has text: Isn't that the right answer? Are you asking how come you're formatting it incorrectly?
comment on: http://stackoverflow.com/q/26890203

http://stackoverflow.com/a/47327608
type: Answer
has body: re-install java jdk to solve the problem
score: -1
answers question: http://stackoverflow.com/q/26952674
downvote count: 2
upvote count: 1

http://stackoverflow.com/a/26842724
has comment: http://stackoverflow.com/comment/42253711
has body: If you don't want / can't manipulate the query to order the enums while fetching, remember that all enums implement the Comparable interface. You can override the compareTo() method and do the sorting direclty from your java code. To get specific: public enum MyEnum{ a1(1,"act1"), a2(2,"act2"), a3(3,"act3"), b1(4,"bob1"), c1(10,"cake1"), c2(11,"cake2"); private number; private name; public MyEnum(Integer number, String name){ this.number = number; this.name = name; } //getters and setters @Override public int compareTo(MyEnum otherEnum){ return this.getName().compareTo(otherEnum.getName()); } } As soon as you have your List&lt;MyEnum&gt; myList fetched from the DB, you only have to call: Collections.sort(myList); to get your enums sorted via name.
type: Answer
has comment: http://stackoverflow.com/comment/42253985
has comment: http://stackoverflow.com/comment/42253613
answers question: http://stackoverflow.com/q/26842447
has comment: http://stackoverflow.com/comment/42273813
score: 0

http://stackoverflow.com/a/26959901
score: 0
has comment: http://stackoverflow.com/comment/42458646
answers question: http://stackoverflow.com/q/26959566
type: Answer
has body: this solution will find a pattern, no matter where it is in the string: public static void main(String[] args) { String strA = "uioABCDqwert"; String strB = "yxcvABCDwrk"; StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; strA.length(); i++) { for (int j = 0; j &lt; strB.length(); j++) { if (strA.charAt(i) == strB.charAt(j)) { sb.append(strB.charAt(j)); i++; } } if (sb.length() &gt; 0) break; } System.out.println(sb.toString()); } this should give you an idea how it could be done

http://stackoverflow.com/q/26950520
type: Question
has comment: http://stackoverflow.com/comment/42442289
score: 0
has body: I have used predicates before to filter collections as follows: package com.byhiras.predicate; import com.byhiras.domain.Bid; import com.byhiras.domain.User; import com.google.common.base.Predicate; /** * List of predicates pertinent to User */ public class UserPredicate { /** * Is a bid made by a particular user? * * @param usr * @return */ public static Predicate&lt;Bid&gt; isBidByUser(User usr) { return p -&gt; p.getUser().getName().equals(usr.getName()); } } For the above I used Java 8 and the latest Guava library. However I'm working on an assignment where I am restricted to Java 6 and version 13.0.1 of Guava with zero chance of getting them to update their maven repo. I am struggling to get a similar type of predicate done in Java 6 as the use of lambda expressions is not allowed. I would appreciate any help to port this code to Java 6. Thanks
answer count: 1
has comment: http://stackoverflow.com/comment/42442353
has comment: http://stackoverflow.com/comment/42442354
has answer: http://stackoverflow.com/a/26950579
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42442344
tagged with: java
has title: Filtering using predicates
accepted answer: http://stackoverflow.com/a/26950579

http://stackoverflow.com/comment/42466039
score: 0
type: AnswerComment
has text: @odus yes this statement `System.out.println(list);` will do that, so iterate as you are doing just above and print `System.out.println(list[i]);`
type: Comment
comment on: http://stackoverflow.com/a/26963970

http://stackoverflow.com/q/26929676
has comment: http://stackoverflow.com/comment/42405050
has answer: http://stackoverflow.com/a/26929901
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/42404811
has comment: http://stackoverflow.com/comment/42405061
has title: How to optimize declaration of many variables? [Java]
tagged with: optimization
has comment: http://stackoverflow.com/comment/42415647
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/42405354
has comment: http://stackoverflow.com/comment/42404943
has answer: http://stackoverflow.com/a/26969614
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26930673
has body: At the moment I am using this: d_y1 = Double.parseDouble(s_y1); d_y2 = Double.parseDouble(s_y2); d_y3 = Double.parseDouble(s_y3); d_y4 = Double.parseDouble(s_y4); d_y5 = Double.parseDouble(s_y5); d_y6 = Double.parseDouble(s_y6); d_x1 = Double.parseDouble(s_x1); d_x2 = Double.parseDouble(s_x2); d_x3 = Double.parseDouble(s_x3); d_x4 = Double.parseDouble(s_x4); d_x5 = Double.parseDouble(s_x5); d_x6 = Double.parseDouble(s_x6); And I thought about something like this, but it wont work: Any advice? String[] s_Werte = {s_x1, s_x2, s_x3, s_x4, s_x5, s_x6,s_y1, s_y2, s_y3, s_y4, s_y5, s_y6}; double[] d_Werte = {d_x1, d_x2, d_x3, d_x4, d_x5, d_x6,d_y1, d_y2, d_y3, d_y4, d_y5, d_y6}; for (i = 0; i &lt; d_Werte.length; i++){ d_Werte[i] = Double.parseDouble(s_Werte[i]); }
has comment: http://stackoverflow.com/comment/42405099
has comment: http://stackoverflow.com/comment/42404839
tagged with: java

http://stackoverflow.com/comment/42510957
type: Comment
comment on: http://stackoverflow.com/a/26989581
type: AnswerComment
has text: I don't class names in the log.. I see details about how many total objects were collected, but I don't find the break to classes
score: 0

http://stackoverflow.com/a/30600986
type: Answer
has comment: http://stackoverflow.com/comment/49359903
answers question: http://stackoverflow.com/q/26895163
has comment: http://stackoverflow.com/comment/49316800
score: 0
upvote count: 1
downvote count: 1
has body: I had all the same symptoms on a raspberry pi2, I however was not able to fix with the solution from the op user259861. Here is what worked for me: I grabbed the jar file from under the 'Other' heading at http://jdownloader.org/download/offline mkdir /tmp/jd2 cd /tmp/jd2 wget http://installer.jdownloader.org/JDownloader.jar sudo java -Djava.awt.headless=true -jar JDownloader.jar cd libs/ sudo jar xf sevenzipjbindingLinuxArmVersion.jar sudo cp Linux-armpi/lib7-Zip-JBinding.so /usr/share/filebot/ filebot -script "fn:sysinfo" |grep 7-Zip The output of the filebot sysinfo function should now be: 7-Zip-JBinding: OK

http://stackoverflow.com/a/35480968
upvote count: 16
downvote count: 0
has body: I faced similar issue while working with rest-assured 2.7 version. I tried setting both the contentType and also accept to application/json but it didn't work. Adding carriage feed and new line characters at the end as the following worked for me. RestAssured.given().contentType("application/json\r\n") The API seems to be missing to add new line characters after Content-Type header due to which the server is not able to differentiate between the media type and the rest of the request content and hence throwing the error 415 - "Unsupported media type".
answers question: http://stackoverflow.com/q/26976624
type: Answer
score: 16

http://stackoverflow.com/comment/42272918
type: Comment
type: QuestionComment
score: 0
has text: What if you decompress the library jar so that the binary files are on the same level as your classes ? Build your project by hand
comment on: http://stackoverflow.com/q/26854659

http://stackoverflow.com/a/26926582
upvote count: 3
answers question: http://stackoverflow.com/q/26926484
has body: It all depends on which Matcher method you use: matches(): true if, and only if, the entire region sequence matches this matcher's pattern find(): true if, and only if, a subsequence of the input sequence matches this matcher's pattern Example: String input = "manifest"; Matcher m1 = Pattern.compile("ni").matcher(input); System.out.println(m1.matches()); // false System.out.println(m1.find()); // true Matcher m2 = Pattern.compile(".*ni.*").matcher(input); System.out.println(m2.matches()); // true System.out.println(m2.find()); // false Also, find() allows you to iterate over the matches: while (m2.find()) { String groupX = m2.group(x); }
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26926484
type: Answer
score: 3

http://stackoverflow.com/q/26853598
favorite count: 0
has comment: http://stackoverflow.com/comment/42270071
tagged with: swing
has body: So let's start with some background this is for a first year collage project. the GUI is built so one class, the interface-handler calls all the JPanels and puts them in the right place. This is for structure and so it's easy to maintain. the problem is the panel holding the menu does't show it's components after it's added. i'll include some image's so it's easier to understand. The panel in question is called MenuPanel. so here is the login button which currently only clears the contentpanel and then adds the menupanel. Login page where the button is located and here is the menu panel empty here is the menu panel all empty the code The interface handler you can see me messing around with the .repaint() method in the menu method already. public class InterfaceHandler { private static InterfaceHandler singleton; /** * Checks if there is already a instance running of InterfaceHandler if so * return the instance if not create a instance. * * @return Instance */ public static InterfaceHandler instance() { if (singleton == null) { singleton = new InterfaceHandler(); } return singleton; } private ContentPanel contentPanel; private LoginPanel loginPanel; private MainFrame mainFrame; private MainPanel mainPanel; private MenuPanel menuPanel; /** * Initializes default Interface */ public InterfaceHandler() { initComponents(); } /** * Initializes GUI Components that will be needed now or in the future. */ public void initComponents() { mainFrame = new MainFrame(); mainPanel = new MainPanel(); contentPanel = new ContentPanel(); loginPanel = new LoginPanel(); menuPanel = new MenuPanel(); contentPanel.setBounds(100, 100, 860, 700); menuPanel.setBounds(10, 10, 80, 400); loginPanel.setBounds(280, 250, 300, 200); mainFrame.add(mainPanel); mainPanel.add(contentPanel); mainFrame.setVisible(true); contentPanel.add(loginPanel); } /** * Clears the ContentPanel of all components */ public void clear() { System.out.println("Clear Ran"); contentPanel.removeAll(); contentPanel.repaint(); } …
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/26854007
upvote count: 3
tagged with: java
has title: JPanel not showing Components
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26853673
tagged with: jpanel
linked to: http://stackoverflow.com/q/859493
possible better answer: http://stackoverflow.com/a/26853673
downvote count: 0
has answer: http://stackoverflow.com/a/26854007

http://stackoverflow.com/a/26946055
has comment: http://stackoverflow.com/comment/42443227
has comment: http://stackoverflow.com/comment/123049890
type: Answer
answers question: http://stackoverflow.com/q/26945281
upvote count: 16
accepted answer of: http://stackoverflow.com/q/26945281
score: 16
has comment: http://stackoverflow.com/comment/123054062
has body: For Xml, if you have all the dependencies that come with Jersey, it should work out the box for the client API. You might not have added all of them. I see you aren't using Maven, which I would strongly advise doing. But I'll provide both way to handle this. XML Maven: Only dependencies you'll nee to get the client up and running (with JAXB xml support) org.glassfish.jersey.core jersey-client 2.13 Doesn't get much simpler :-) Non-Maven: So using a Maven project, I added the above dependency, and these are all the transitive dependencies it pulled in. In your non Maven project, you will need to manually add all these jars. If you go to the Jersey Hompage, go to Downloads, and download the "Jersey JAX-RS 2.0 RI bundle. You should find all these dependencies in there. You should add all the ones needed, into your project Note: Netbeans already comes with the Jersey 2.0 (JAX-RS RI) library. You could instead simply add that library to your project. Just right click on the [Libraries] node in your project, and select [Add Library]. You should see the Jersey in the dialog. This solution is probably the easiest, but it will import all the Jersey dependencies, more than is required for the client API JSON JSON requires another dependency: Maven: org.glassfish.jersey.media jersey-media-json-jackson 2.13 Non-Maven Have a look at this post for an image and further explanation. Just having these dependencies on the classpath should work, without any special configuration. UPDATE In newer versions of the Jersey client, jersey-media-jaxb is not pulled in anymore and you will need to manually add it for XML/JAXB support.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26880333
tagged with: swing
type: Question
has body: I am working in the java swings application and in the application we have the front menu that contain the list of the other button and the drop down menus. in the application we have the various events that are associated to one another and leads to the opening of the various frames. i want to get the list of the parents through which the particular page is open as i am right now using parent-of-parent but that will give me reference to the two level above the hierarchy but not the entire list. please help...
tagged with: java
linked to: http://stackoverflow.com/q/9554636
has comment: http://stackoverflow.com/comment/42318548
has comment: http://stackoverflow.com/comment/42316938
has title: how to get the list of parents in hierarchy
answer count: 0
has comment: http://stackoverflow.com/comment/42317881
type: UnansweredQuestion
score: 0

http://stackoverflow.com/comment/130681732
type: Comment
has text: @barneypitt This was 8 years ago. These days I am not so keen on mocks, and only use them when strictly necessary. But I stand by the suggestion of dependency injection as the best solution to this problem.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26845718

http://stackoverflow.com/comment/42240930
comment on: http://stackoverflow.com/q/26836774
type: QuestionComment
type: Comment
has text: Try connecting with `psql` using the same options you used in PgJDBC. `psql` understands JDBC URLs, so `psql 'jdbc:postgresql://127.0.0.1:5432/dbname'`.
score: 1

http://stackoverflow.com/comment/42419629
has text: What can a developer say about his API usage around the world? Having one person think for everybody is risky, the other way around, then it is the client's responsibility. As my case is an example of, there is always always exceptions to the rule. Proper documentation is the only rule we should abide to. But in this field of cryptography, I am a newbie. So I'm not confident enough to say that you're wrong =) Just expressing my thoughts. Thank you blaze for your feedback!
comment on: http://stackoverflow.com/a/26921724
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/26895632
has title: Can't call hasOwnProperty on Java List with Nashorn
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/26896895
has answer: http://stackoverflow.com/a/26896895
favorite count: 0
has body: I've got an application that executes a lot of javascript server side and I'm trying to convert from Rhino to Nashorn but I am running into trouble with my scripts. Using Rhino I would always convert whatever arguments I had for a function into a JSON string but that's really slow. With Nashorn I'm trying to just pass in the arguments as Java objects but they don't seem to inherit functions from Javascript's Object type. Here is a sample method that illustrates my problem where hasOwnProperty is not available on my array: public String printArrayValues() throws ScriptException, NoSuchMethodException { String script = "function printArrayValues(objArray) {\n" + " var result = '';\n" + " for(var obj in objArray) {\n" + " if(objArray.hasOwnProperty(obj)) {\n" + " result = result + ' ' + objArray[obj];\n" + " }\n" + " }\n" + " return result;\n" + "}"; List&lt;String&gt; data = Arrays.asList(new String[]{ "one", "two", "three"}); ScriptEngine scriptEngine = new NashornScriptEngineFactory().getScriptEngine(); scriptEngine.eval(script); String result = (String) ((Invocable) scriptEngine).invokeFunction("printArrayValues", data); } Here the call to invokeFunction throws an exception: javax.script.ScriptException: TypeError: [one, two, three] has no such function "hasOwnProperty" in &lt;eval&gt; at line number 4 If I call the same function in a browser, I get what I would expect: &gt; printArrayValues(["one", "two", "three"]); &gt; " one two three" Is there some way I can accomplish this so I really can use these Java objects without turning them into a JSON string and then eval'ing it into a Javascript object?
type: Question
score: 3
accepted answer: http://stackoverflow.com/a/26896042
upvote count: 3
answer count: 2
tagged with: java-8
tagged with: nashorn
tagged with: java
has answer: http://stackoverflow.com/a/26896042

http://stackoverflow.com/comment/42429626
type: Comment
comment on: http://stackoverflow.com/a/26902092
score: 0
type: AnswerComment
has text: Oh, this is read-only. I need to update this file. http://stackoverflow.com/questions/10562904/is-asset-folder-read-only

http://stackoverflow.com/q/26951040
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42443180
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/42443448
tagged with: java
has comment: http://stackoverflow.com/comment/42443355
linked to: http://stackoverflow.com/q/26642378
has comment: http://stackoverflow.com/comment/42443523
type: Question
has answer: http://stackoverflow.com/a/28151428
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/42443239
has body: Today I upgraded to API 21, the biggest mistake in this month. So I spent the whole day trying to get an action bar icon. I´m using eclipse with sdk and everthing is updated. The problem is the following: Before API 21, I added an icon with android.app.ActionBar bar = getActionBar(); bar.setIcon(getResources().getDrawable(R.drawable.ic_launcher)); That worked fine, all the time... But now, unfortunately, this lines cause a Nullpointer Exception... (Attach 1) So I can get the actionbar only with: final ActionBar actionBar = getSupportActionBar(); and thats the breaking point.. This actionBar doesnt set the icon, the method setIcon isnt working at all. So, to find a solution, I have completely re installed Eclipse and the sdk and started a new android Project. In this new Project there is also no ActionBar Icon, and the code above also not works. This leads me to the assumption, that this is some new API 21 bug. Below i posted some additional informations: Imports: import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import android.widget.CompoundButton.OnCheckedChangeListener; Sty…
has title: ActionBar not showing Icon in API 21
favorite count: 0
has comment: http://stackoverflow.com/comment/42443124
upvote count: 2

http://stackoverflow.com/a/29409778
has body: Here we go! With this code the user will only be shown the dialog once. It also shows a complete solution for adding widgets programmatically. As I will be updating this on my github, look here for the latest version, https://github.com/DagW/FragmentHomescreen/blob/master/app/src/main/java/se/dw/fragmenthomescreen/widget/WidgetFragment.java. But for archiving purposes here is the way I do it now. /** * checkToAddWidget * &lt;p/&gt; * At the creation of WidgetFragment, * add a default widget so that the homescreen is not empty * shows how to add widgets programmatically */ private void checkToAddWidget () { MainActivity m = (MainActivity) getActivity(); AppWidgetManager manager = m.getAppWidgetManager(); AppWidgetHost host = m.getAppWidgetHost(); List&lt;AppWidgetProviderInfo&gt; widgetList = manager.getInstalledProviders(); AppWidgetProviderInfo searchProvider = null; AppWidgetProviderInfo search2Provider = null; AppWidgetProviderInfo clockProvider = null; for ( AppWidgetProviderInfo info : widgetList ) { Log.d(TAG, info.provider.getPackageName() + " " + info.provider.getClassName()); if ( info.provider.getClassName().equals("com.google.android.googlequicksearchbox.SearchWidgetProvider") ) { searchProvider = info; break; } if ( info.provider.getClassName().equals("com.android.alarmclock.AnalogAppWidgetProvider") ) { clockProvider = info; } if ( info.provider.getClassName().equals("com.android.alarmclock.DigitalAppWidgetProvider") ) { clockProvider = info; } if ( info.provider.getClassName().equals("com.android.quicksearchbox.SearchWidgetProvider") ) { search2Provider = info; } } if ( searchProvider != null || search2Provider != null || clockProvider != null ) { AppWidgetProviderInfo provider = null; if ( searchProvider != null ) { provider = searchProvider; } else if ( clockProvider != null ) { provider = clockProvider; } else { provider = search2Provider; } addProvider(m, host, manager, provider); } } public void addProvider (MainActivity m, AppWidgetHost host, App…
has comment: http://stackoverflow.com/comment/82304748
score: 3
has comment: http://stackoverflow.com/comment/85488535
has comment: http://stackoverflow.com/comment/82304825
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26847824
upvote count: 3

http://stackoverflow.com/comment/42346108
has text: The Window class which can be seen at: http://www.gwtproject.org/javadoc/latest/com/google/gwt/user/client/Window.html#prompt(java.lang.String, java.lang.String)
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26895906

http://stackoverflow.com/comment/107768409
type: Comment
score: 0
has text: @Terry Carter That's such a valuable piece of info I think it should be made into an answer... using IntelliJ and I was just beginning to assume this all had to be typed manually!
type: AnswerComment
comment on: http://stackoverflow.com/a/38958936

http://stackoverflow.com/comment/42547160
has text: ok i will try to export the project as jar file and run it on command prompt. Yes corpus contains 4 million records. Do you have any idea how can i run this on Spark for speeding up the process.
comment on: http://stackoverflow.com/q/26987362
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/26848407
has comment: http://stackoverflow.com/comment/42304134
accepted answer of: http://stackoverflow.com/q/26847717
score: 0
answers question: http://stackoverflow.com/q/26847717
type: Answer
has body: In order to display a SpannableString, you need to pass also the flag like this: textView.setText(spannableString, TextView.BufferType.SPANNABLE); I prefer personally to create utility functions to color some parts of the given String. For example, suppose you want a function for highlighting one single character and coloring the others in a different color. You could implement something like: // this function colors the k-th character of String s in blue and the rest in red, and returns the SpannableString public static SpannableString highlight(String s, int k) { SpannableString ss = new SpannableString(s); ss.setSpan(new ForegroundColorSpan(Color.BLUE), 0, k, 0); ss.setSpan(new ForegroundColorSpan(Color.RED), k, k + 1, 0); ss.setSpan(new ForegroundColorSpan(Color.BLUE), k + 1, s.length(), 0); return ss; } EDIT: well, I saw that the problem was that your method applyLetterSpacing was simply ignoring the old spans. So, the first solution that pops in my mind is to save the spans when calling setText and applying them when calling to applyLetterSpacing. You can see the idea here http://pastebin.com/p4Hig8Pj although as I said in my comment, the use of customized shader in onDraw and onLayout makes the coloring effect totally unexpected. Hope it helped.
has comment: http://stackoverflow.com/comment/42343165
has comment: http://stackoverflow.com/comment/42311390
type: AcceptedAnswer

http://stackoverflow.com/comment/42354909
type: AnswerComment
type: Comment
has text: @DavidWallace Is there an algorithm for modular exponentiation with decimal exponents?
comment on: http://stackoverflow.com/a/26901065
score: 0

http://stackoverflow.com/a/26937734
has comment: http://stackoverflow.com/comment/42422148
has comment: http://stackoverflow.com/comment/42422014
has comment: http://stackoverflow.com/comment/42420679
has comment: http://stackoverflow.com/comment/42421624
has comment: http://stackoverflow.com/comment/42420137
has comment: http://stackoverflow.com/comment/42421371
type: AcceptedAnswer
has body: You can still add the environmental variables even if the bin folder doesn't exist yet. Just make sure you restart your command prompt after you added the new environmental variables, for them to be picked up. As for building the source in Windows, looking at the readme, their make.bat seems to be missing. You can create an issue in github to notify them. Meanwhile, you can use something like MinGW to run make on Windows. After installing MinGW, you may have to execute copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe if make.exe didn't get created during the installation. Then you should be able to build the project by executing make from your jshop2 root folder.
score: 0
has comment: http://stackoverflow.com/comment/42422129
type: Answer
has comment: http://stackoverflow.com/comment/42420300
accepted answer of: http://stackoverflow.com/q/26937431
answers question: http://stackoverflow.com/q/26937431

http://stackoverflow.com/comment/42476533
type: QuestionComment
has text: No, I can't. But I don't need to download any file from server side, in server side only are information about the file to take from hard disk of client (url where is stored in hard disk, name, extension, bytes), so with this, I need to create new Upload item that contains the path to file only if you apply the template. Then when you submit your form, this go to be stored in db.
comment on: http://stackoverflow.com/q/26969228
score: 0
type: Comment

http://stackoverflow.com/a/30361664
score: 4
answers question: http://stackoverflow.com/q/26986932
type: Answer
has comment: http://stackoverflow.com/comment/73395020
has body: I faced this issue before. I deleted x.ttf and then undid the deletion, tried to run with no lock. So my fix was just to delete it and downloaded the font again and pasted it to fonts/ folder and every thing worked fine.
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/43542747
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/26875951
has text: Nope. It is not safe. yes, `T` is known to be a subtype of `Sentence<T>`, but `Sentence<T>` is not known to be a subtype of `T`.
type: Comment

http://stackoverflow.com/comment/42343704
type: QuestionComment
comment on: http://stackoverflow.com/q/26891271
score: 0
type: Comment
has text: As it is now, no. Unless `values` is a class level variable, and your `swap` method is in the same class, then maybe it would work. But if it's not, then you're swap method is performing actions that are changing the array in the parameters but not the array that you're working with, if that makes sense.

http://stackoverflow.com/comment/42252330
score: 0
has text: There was an extraneous Ticket profile in the pom file. See if that makes a difference.
comment on: http://stackoverflow.com/a/26844061
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/42235699
has text: @AndrewThompson: I think that he's trying to add the grid into a GUI created by NetBeans Matisse GUI builder, that in essence he wants to modify the layout after it's been created. I think that his best solution is to chuck the NetBeans derived code, to read the layout manager tutorials, and to hand code the GUI himself.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/26832615
type: Comment

http://stackoverflow.com/a/26906923
has body: Both styles have their own advantages. The first one is shorter and (maybe) easier to read, but the second one is easier to debug: if(condition &amp;&amp; i == 0) { str = "The value is 0"; // You can put breakpoint here }
answers question: http://stackoverflow.com/q/26906530
score: 0
type: Answer

http://stackoverflow.com/comment/42325245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26884424
has text: @John, do you already have the code to check if the player has 2s or 3s etc.?
score: 0

http://stackoverflow.com/a/26878474
has body: You are already doing it, also ValidArray is a terrible name. You forgot to use the array index in your for loop and the number you are using for that is validArraycount - // Prints number of valid values entered System.out.println("The number of valid grades entered is " + validArraycount); // for printing array backwards for (int i = validArraycount-1; i&gt;=0; i--){ System.out.print(ValidArray[i] + " "); // &lt;-- don't forget the index. } System.out.println(); // &lt;-- next line. double sum = 0; // sum the values in array of ValidArray (of grades) for(double d : ValidArray){ sum += d; } // Average. Sum / the count double average = (sum / validArraycount); System.out.println("Average: " + average);
answers question: http://stackoverflow.com/q/26878404
score: 0
has comment: http://stackoverflow.com/comment/42315339
has comment: http://stackoverflow.com/comment/42315553
has comment: http://stackoverflow.com/comment/42315014
has comment: http://stackoverflow.com/comment/42315381
has comment: http://stackoverflow.com/comment/42314098
type: Answer
has comment: http://stackoverflow.com/comment/42314194
has comment: http://stackoverflow.com/comment/42315488
has comment: http://stackoverflow.com/comment/42315878

required
tag name: required
tags question: http://stackoverflow.com/q/26940726
type: Tag

http://stackoverflow.com/comment/42482600
comment on: http://stackoverflow.com/q/26965810
score: 0
type: Comment
type: QuestionComment
has text: Yes, most likely it does not matter, it just helps to get a handy object to analyze. (And you surely won't want to embed that CRL in real life documents either...)

http://stackoverflow.com/comment/42376859
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26913447
has text: When I do this I get an error that says : `Error creating bean with name 'dataSource'`

http://stackoverflow.com/a/26860215
has comment: http://stackoverflow.com/comment/42281270
has comment: http://stackoverflow.com/comment/42281195
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42281050
has body: Use File.createTempFile(). File tempFile = File.createTempFile("prefix-", "-suffix"); //File tempFile = File.createTempFile("MyAppName-", ".tmp"); tempFile.deleteOnExit(); Will create a file in the temp dir, like: prefix-6340763779352094442-suffix
type: Answer
score: 232
accepted answer of: http://stackoverflow.com/q/26860167
has comment: http://stackoverflow.com/comment/78296982
has comment: http://stackoverflow.com/comment/131741113
answers question: http://stackoverflow.com/q/26860167
downvote count: 1
upvote count: 233
has comment: http://stackoverflow.com/comment/78245026
has comment: http://stackoverflow.com/comment/42281238

http://stackoverflow.com/comment/42399923
type: AnswerComment
type: Comment
has text: Jaskey,thank you.by the time run method completes,isalive of the thread object is false.can i call getData method even if isalive is false?
comment on: http://stackoverflow.com/a/26926721
score: 0

http://stackoverflow.com/comment/42253189
has text: 3... b is castable to I but not B . Is that correct?
comment on: http://stackoverflow.com/a/26844686
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42429401
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26942999
has text: Goodpoint I know 3 random points don't necessarily make a triangle but I don't really know how to do it otherwise and this is supposed to be a basic java program tutorial. Do you have any suggestions?
score: 0

http://stackoverflow.com/a/26876930
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/26876611
has body: One way is to use nashorn javascript engine. Write a java script validation function for each predicate, and store it in a java script file. function pred1(a,b) { if(a&gt;7 &amp;&amp; b&lt;15) return true; else return false; } Create and load the predicate file. You need to mention all the predicate file paths in a configuration file, and lookup their paths from the configuration file. Properties property = new Properties(); property.load(configuration file path goes here); Sample configuration file property: predicatefileList:test1.js,... Get the property, String[] filePaths = ((String)property.get("predicatefileList")).split(","); Initialize and use the script engine. ScriptEngineManager factory = new ScriptEngineManager(); ScriptEngine engine = factory.getEngineByName("nashorn"); // use filePaths here instead of the file name. ScriptObjectMirror s = (ScriptObjectMirror)engine.eval("load(\"test1.js" + "\");"); For each map in the list, call the predicate function by passing the arguments to the predicate function: list.forEach(map-&gt;{ System.out.println(s.call(map.get("a"), m.get("b"))); });
answers question: http://stackoverflow.com/q/26876611
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/26986466
type: Question
has body: I've recently discovered programming and on the suggestion of a friend decided to try my hand at making my first project a mad lib game. I've ran into a rather frustrating "cannot find symbol - variable whatever" when i try to compile. I've pasted my code below in the hopes that someone can give me some feedback for what I'm doing wrong. Be nice! I'm totally new at this lol import java.util.Scanner; public class MadLib { private static Scanner in = new Scanner(System.in); public static void main(String[] args) { System.out.println("What is your name &gt;"); String name = in.nextLine(); System.out.println("What is your favourite colour &gt;"); String colour = in.nextLine(); System.out.println("Name an animal &gt;"); String animal = in.nextLine(); System.out.println("Give a number &gt;"); int nm = in.nextInt(); madlib(name); } public static void madlib(String name) { System.out.print("Hi, my name is " + name + "!"); System.out.print("Let me tell you a story, one day I was walking down the street,"); System.out.print("and I saw a wild " + animal + " on the sidewalk! It was a very odd shade of " + colour + "."); System.out.print("It was scary!!"); } }
has answer: http://stackoverflow.com/a/26986499
tagged with: java
has answer: http://stackoverflow.com/a/26986527
downvote count: 4
has comment: http://stackoverflow.com/comment/42506066
upvote count: 0
has answer: http://stackoverflow.com/a/26986572
favorite count: 0
has answer: http://stackoverflow.com/a/26986509
has title: cannot find symbol - variable whatever
answer count: 4
type: UnansweredQuestion
score: -4

http://stackoverflow.com/q/26984642
tagged with: ant
linked to: http://stackoverflow.com/q/6733684
upvote count: 2
has answer: http://stackoverflow.com/a/49394664
has title: How to generate apk file from Java program using gradle API? If possible, how to install it to the emulator as well?
has body: I am developing a Java program that can build Android apk files, then install it to an emulator, then running tests. The code is listed below: /* * Generate APK through ANT API Method */ public static void generateApkThroughAnt(String buildXMLPath) { File antBuildFile = new File(buildXMLPath); Project p = new Project(); p.setUserProperty("ant.file", antBuildFile.getAbsolutePath()); ByteArrayOutputStream os = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(os); DefaultLogger consoleLogger = new DefaultLogger(); consoleLogger.setErrorPrintStream(System.err); consoleLogger.setOutputPrintStream(ps); consoleLogger.setMessageOutputLevel(Project.MSG_INFO); p.addBuildListener(consoleLogger); BuildException ex = null; try { p.fireBuildStarted(); p.init(); ProjectHelper helper = ProjectHelper.getProjectHelper(); p.addReference("ant.projectHelper", helper); helper.parse(p, antBuildFile); p.executeTarget("clean"); p.executeTarget("debug"); // build a new apk file //p.executeTarget("test"); // run test against project //p.executeTarget("installd"); //install new apk file to vd try { // test for capturing output results String output = os.toString("UTF8"); System.out.println("this is captured output: "+ output); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } catch (BuildException e) { ex = e; } finally { p.fireBuildFinished(ex); } } So far, with Apache Ant, my program is able to do the above tasks without problems. Thanks to the answers in this post Run ant from Java However, more and more Android open source apps are using gradle now. I am wondering if it's possible to achieve the above similar tasks with gradle? Does gradle have similar API that I can use? Thanks!
has comment: http://stackoverflow.com/comment/42502988
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/40974277
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/40974277
downvote count: 0
possible better answer: http://stackoverflow.com/a/49394664
tagged with: java
tagged with: gradle
type: Question
answer count: 2

http://stackoverflow.com/comment/42359552
comment on: http://stackoverflow.com/q/26857976
type: QuestionComment
has text: I added **immediate="true"**, it worked.
score: 0
type: Comment

http://stackoverflow.com/q/26950769
score: -1
has answer: http://stackoverflow.com/a/26951166
has body: I am trying to do a little program on Eclipse. The program goes like this: when I click for the 1st time on thr Panel on the frame, a line has to be drawn regarding the Y position of my mouse listener.The line takes all the width of the panel. On the 2nd click, another line has to be drawn, again regarding the Y position of where I clicked. After, I'll put a little circle between the 2 lines and make a little animation with it. But now, I have a problem. When I click on the panel, a line is drawn, but if i click another time, the first line disappears and the 2nd line takes it place... This is the code of the painComponent and my mousr listener. What is wrong with it ? public Lines() { addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { posY=e.getY(); posX=e.getX(); nbClic=e.getClickCount(); repaint(); } }); setBackground(Color.black); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(Color.blue); if(nbClic&gt;=1){ line1=new Line2D.Double(0, posY, getWidth(), posY); g2d.draw(line1); repaint(); } if(nbClic&gt;=2){ g2d.setColor(Color.YELLOW); line2=new Line2D.Double(0, posY, getWidth(), posY); g2d.draw(line2); } repaint(); }
downvote count: 1
answer count: 1
tagged with: graphics
tagged with: 2d
has title: Drawing lines in java (Graphics 2D)
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26951166
type: AnsweredQuestion
upvote count: 0
favorite count: 0
type: Question

http://stackoverflow.com/comment/42497363
comment on: http://stackoverflow.com/q/26975977
has text: I posted the whole code i have as a reference. I'm very aware of syntax errors; the syntax errors are there because i was experimenting with different approaches to do what i wanted done, and never removed them completley.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42373371
type: AnswerComment
has text: ok, i change num_proyect_act = 200; but i still get that expection, thanks for your patience...
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26911646

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/26963635
tags question: http://stackoverflow.com/q/26845647
tags question: http://stackoverflow.com/q/26940426
tags question: http://stackoverflow.com/q/26988287
type: Tag
tags question: http://stackoverflow.com/q/26932596
tags question: http://stackoverflow.com/q/26888655

http://stackoverflow.com/q/26924373
type: AnsweredQuestion
score: 2
has body: I have the following code in my program that converts the given date into different date formats. public static final List &lt; SimpleDateFormat &gt; dateFormats = new ArrayList &lt; SimpleDateFormat &gt; () { { add(new SimpleDateFormat("M/dd/yyyy")); add(new SimpleDateFormat("dd.M.yyyy")); add(new SimpleDateFormat("dd.MMM.yyyy")); add(new SimpleDateFormat("dd-MMM-yyyy")); add(new SimpleDateFormat("yyyy-MM-dd")); add(new SimpleDateFormat("M/dd/yyyy HH:mm")); add(new SimpleDateFormat("dd.M.yyyy HH:mm")); add(new SimpleDateFormat("dd.MMM.yyyy HH:mm")); add(new SimpleDateFormat("dd-MMM-yyyy HH:mm")); add(new SimpleDateFormat("yyyy-MM-dd HH:mm")); } }; public static Date convertToDate(String input) { Date date = null; if (null == input) { return null; } for (SimpleDateFormat format: dateFormats) { try { format.setLenient(false); date = format.parse(input); } catch (ParseException e) {} if (date != null) { break; } } return date; } But on running the above code once the date format is changed, the time is getting reseted to zero. Whats the issue here??
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/26924434
type: Question
tagged with: simpledateformat
accepted answer: http://stackoverflow.com/a/26924568
upvote count: 2
has answer: http://stackoverflow.com/a/26924466
answer count: 3
has answer: http://stackoverflow.com/a/26924568
possible better answer: http://stackoverflow.com/a/26924434
favorite count: 0
has title: SimpleDateFormat not working properly
tagged with: datetime

http://stackoverflow.com/comment/42478089
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26971049
has text: Exactly. We had a similar problem, where we were loading multiple tabs of data, but it was unlikely that, on a day to day bases, that many of the users would need most of that data. We choose to implement a lazy loading approach to the problem, only physically loading the data for the tabs as they were needed, caching the results until either a key filter element changed or the user refreshed the data for the tab...

http://stackoverflow.com/a/26998211
has body: I think it would be useful to express it explicitly: TokenizerWrapper and delegate don't share attribute set. So even the indexing of the first document seems correct, it's not, nothing goes to the indexer. In order to make a meaningful delegating one needs to mirror (completely or partially) attributes of the delegate in the TokenizerWrapper, like @mindas does in setTerm(). Or maybe I'm wrong, and there're some "magical machinery" which would allow to reuse delegate.attributes as TokenizerWrapper.attributes?
score: 0
answers question: http://stackoverflow.com/q/26990061
type: Answer

http://stackoverflow.com/a/26958734
type: Answer
has body: This code should work: import java.util.Scanner; public class test { public static void menu() { System.out.print("Select one of the option below\n" + " 1 - Enter a new number\n" + " 2 - Show the sum of the last two number\n" + " 3 - Show the current number as pluses\n" + " 4 - Show the current number as centred pluses\n"); //I cleaned this up a little bit so it looks a little better } public static void main(String[] args) { int no1 = 0; //since we are only dealing with the last two digits, we don't need an array but two different number variables int no2 = 0; int sum = 0; int count1 = 0; // counts the number of times case 1 is executed int option; Scanner input = new Scanner(System.in); do { menu(); option = input.nextInt(); switch (option) { case 1: count1 += 1; //counts the number of case 1 executed System.out.print("Please enter a number between 0 and 20 : "); if (count1 % 2 == 0) //if count1 is even, the input will be stored in no1... no1 = input.nextInt(); else no2 = input.nextInt();//...else it will be stored in no2 sum = no1 + no2; // this is the sum of the last two numbers entered break; case 2: System.out.println("The Sum of the Numbers is : " + sum); break; // don;t forget to break the case so the default won't be reached if option = 2 default: System.out.print("Invalid option"); } } while (option != 5); } }
answers question: http://stackoverflow.com/q/26956242
score: 0

http://stackoverflow.com/comment/42486202
comment on: http://stackoverflow.com/a/26974174
type: Comment
has text: Did you test this out? Still doesn't work for me. Does it have anything to do with the placement of the Hibernate suite? 'Cause with GF3 you could choose whether you want Hibernate with it or not. GF4 doesn't have that.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42455875
type: Comment
comment on: http://stackoverflow.com/a/26958395
has text: you need to cast it as a String if(params[0] instanceof String) eventCommentModel = eventCtrl.getEventCommentByID((String) params[0]);
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42362899
type: QuestionComment
has text: Thanks for answer, but i will have doubts until i see it in official documentation. Can you provide links?
comment on: http://stackoverflow.com/q/26906102
score: 0
type: Comment

http://stackoverflow.com/comment/42450264
type: AnswerComment
has text: now i get this error : java.sql.SQLException: Invalid column name
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26949993

http://stackoverflow.com/comment/42401177
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26913341
has text: It’s irrelevant how little the overhead is. After all, this anti-pattern saves only a single writing of a variable name and a dot in the source code here (but adds four additional curly brackets, reducing the “advantage” even more). Given this hilariously little advantage, even the slightest overhead (and there is one) is unacceptable.

http://stackoverflow.com/comment/42440298
type: Comment
has text: Thanks for your answer, I found that to be the best way to go about it!
comment on: http://stackoverflow.com/a/26949295
score: 1
type: AnswerComment

http://stackoverflow.com/comment/42469946
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26966430
has text: the way you used it tells the compiler it is static.

http://stackoverflow.com/q/26987336
score: -1
has title: ElasticSearch field mapping
has answer: http://stackoverflow.com/a/26991845
answer count: 1
downvote count: 1
tagged with: elasticsearch
favorite count: 0
type: UnansweredQuestion
tagged with: node.js
upvote count: 0
tagged with: java
type: Question
has body: In mt node app i am using Elastic-search as back-end. In that i have created an "Template" using the following query. { "template" : "*", "settings" : { "index.number_of_shards" : 3, "index.number_of_replicas" : 1 }, "mappings" : { "_default_" : { "_source" : { "enabled" : true, "compress" : true }, "_all" : { "enabled" : false }, "properties" : { "xx": { "type": "string", "index": "not_analyzed" }, "yy": { "type": "integer", "index": "not_analyzed" }, "zz": { "type": "integer", "index": "not_analyzed" }, "aa": { "type": "integer", "index": "not_analyzed" }, "locaiton": { "type": "geo_point", "index": "not_analyzed" } } } } } I have created an index name "Temp" so the above template will apply for that. Its working fine. But i want the filed name to be exact as the mapping: Consider my data is as follows: curl -XPOST "192.168.1.107:9200/temp/place" -d'{ "xx" : "asdfg", "yy":34, "zz":67, "aa":78, "locaiton":'78.80, 10.89' }' It working: But consider: curl -XPOST "192.168.1.107:9200/temp/place" -d'{ "xx" : "asdfg", "yyyyyyyyyy":34,------------------------&gt; changing the field name is also accepting. "zz":67, "aa":78, "locaiton":'78.80, 10.89' }' I want an error message here. Is it possible in Elasticsearch. Please share your ideas. Thanks in advance.

http://stackoverflow.com/a/26924861
answers question: http://stackoverflow.com/q/26924372
type: Answer
has body: Maven Directory structure is always added in the class path. if you are using eclipse just got to Run as->maven build.(make sure you have maven plugin installed) otherwise you can directly use the mvn clean , mvn install command for building the project in maven.
score: 0

http://stackoverflow.com/comment/42300689
type: Comment
comment on: http://stackoverflow.com/q/26870860
has text: json = sb.toString(); this thing since its an string you can print it in log we want this response.
score: 0
type: QuestionComment

http://stackoverflow.com/a/26938327
has comment: http://stackoverflow.com/comment/42455483
has comment: http://stackoverflow.com/comment/42421833
answers question: http://stackoverflow.com/q/26938123
has body: Whoever is teaching you is giving you some bad habits that will make Java programming (and OOP generally) hard for you. You need better encapsulation. Something along the lines of class Light { ... public void startCurrent(){...}; public void stopCurrent(){...}; public boolean isOn(); } class Switch { Ligh target; public Switch(Ligh target) {...} public clickOn(){target.startCurrent();} public clickOff(){target.stopCurrent();} } // now wire it all together public static void main(String argv) { Light light = new Light(); Switch switch = new Switch(light); System.out.println("Light is on: " + light.isOn()); switch.clickOn(); System.out.println("Light is on: " + light.isOn()); switch.clickOff(); System.out.println("Light is on: " + light.isOn()); } This is more object-oriented, no need to have any global variables.
score: 1
upvote count: 2
has comment: http://stackoverflow.com/comment/42423429
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/42421965
has comment: http://stackoverflow.com/comment/42422135

http://stackoverflow.com/comment/42312446
type: QuestionComment
has text: I actually added a bunch of print statements and deleted them to post this. But for instance I had it print i at the beginning and end and it prints that it equals 0 at top and bottom twice before incrementing i.
type: Comment
comment on: http://stackoverflow.com/q/26877611
score: 0

http://stackoverflow.com/a/26883434
has comment: http://stackoverflow.com/comment/42322593
has body: Maybe this thread is of help and you can gain some ideas from it: How to use Java to print on a network printer?
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26882676
has comment: http://stackoverflow.com/comment/42322815

http://stackoverflow.com/a/26929969
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/26917111
downvote count: 0
has body: Just tossing this in here because I wanted to see what I could come up with ([^,]+\[[^\],]*,[^\],]*\]|[^,]+)
type: Answer

http://stackoverflow.com/a/26850741
type: Answer
has comment: http://stackoverflow.com/comment/53266923
answers question: http://stackoverflow.com/q/26850672
score: 7
upvote count: 7
has body: You installed the JDK yourself so it won't be in /System. Try looking in /Library/Java/... You'll need to add this new runtime to your path to get it to work on the command line.
accepted answer of: http://stackoverflow.com/q/26850672
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/26833693
has comment: http://stackoverflow.com/comment/42233820
has answer: http://stackoverflow.com/a/54120981
has answer: http://stackoverflow.com/a/26833760
type: Question
tagged with: iterator
score: 0
has answer: http://stackoverflow.com/a/26833785
has comment: http://stackoverflow.com/comment/42233802
answer count: 4
has comment: http://stackoverflow.com/comment/42233730
has comment: http://stackoverflow.com/comment/42233772
has body: I'm doing an assignment and within my class, I have a Set in order to read multiple authors for my Book class. I'm trying to figure out how to properly implement the toString. Would I do the toString as normal and then implement the Iterator such as this: public String toString(){ Iterator itr = set.iterator(); while(itr.hasNext()){ Object element = itr.next(); } Return "Book, ISBN:" + isbn +", Author:" + element } Does that make any sense?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26833735
has title: Set Iterator toString - JAVA
tagged with: tostring
tagged with: java
tagged with: set

http://stackoverflow.com/comment/88393729
type: AnswerComment
comment on: http://stackoverflow.com/a/27097798
type: Comment
has text: `file` is actually a `String` containing the name of the file to be uploaded which is available in the Classpath. Not a `java.io.File`. Obviously the code works for many.
score: 2

http://stackoverflow.com/q/26978083
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26978220
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42490961
has comment: http://stackoverflow.com/comment/42490726
has comment: http://stackoverflow.com/comment/42491020
score: 0
accepted answer: http://stackoverflow.com/a/26978220
has title: Android Multidimensional array
answer count: 1
has body: I have searched found a few answers but I am not quite sure I understand them. I want a multidimensional array or the equivalent of say string[0][1][1]. Here is what I have: public List&lt;List&lt;List&lt;String&gt;&gt;&gt; loadCompleteExercises(String workout) { List&lt;List&lt;List&lt;String&gt;&gt;&gt; listExercises = new ArrayList&lt;List&lt;List&lt;String&gt;&gt;&gt;(); List&lt;String&gt; complete_time = new ArrayList&lt;String&gt;(); List&lt;String&gt; rest_time = new ArrayList&lt;String&gt;(); db = dbHelper.getReadableDatabase(); Cursor c = db.rawQuery("SELECT complete_time, rest_time FROM tbl_exercises WHERE workout = '"+workout+"';", null); c.moveToFirst(); while(!c.isAfterLast()) { try { if(c.isNull(c.getColumnIndex("exercise"))) { complete_time.add("00:00:05"); rest_time.add("00:00:00"); }else { complete_time.add(c.getString(c.getColumnIndex("complete_time"))); rest_time.add(c.getString(c.getColumnIndex("rest_time"))); } }catch (NullPointerException e) { Log.d("GET EXERCISES ERROR: ", e.toString()); } c.moveToNext(); } //listExercises.add(); return listExercises; } --- I want to add complete_time and rest_time to listExercises so that I can say do the following listExercises.get(i).get(j) to yield the below 1 "00:00:05" "00:00:00" 2 "00:10:00" "00:10:00" ... n "xx:xx:xx" "xx:xx:xx"
has comment: http://stackoverflow.com/comment/42490924
tagged with: multidimensional-array

http://stackoverflow.com/a/26986191
has comment: http://stackoverflow.com/comment/42505593
answers question: http://stackoverflow.com/q/26986156
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26986156
has body: JAVA check this.. import java.net.InetAddress; public class GetIPAddress { public static void main(String[] args) { try { InetAddress thisIp = InetAddress.getLocalHost(); System.out.println("IP:" + thisIp.getHostAddress()); } catch (Exception e) { e.printStackTrace(); } } } Another JAVA sample Code InetAddress Address = InetAddress.getLocalHost(); System.out.println(Address); Address = InetAddress.getByName("google.com"); System.out.println(Address); For JS Try this javaScript code it might help you. Superuser http://jsfiddle.net/
type: Answer
has comment: http://stackoverflow.com/comment/42506465
has comment: http://stackoverflow.com/comment/42506045
has comment: http://stackoverflow.com/comment/42511205
has comment: http://stackoverflow.com/comment/42505857

http://stackoverflow.com/a/26963945
score: 2
has body: When you say String op_1_to_digit = null; you can't immediately call op_1_to_digit.length() like for(int n=0; n&lt;op_1_to_digit.length(); n++) because that String is null.
downvote count: 0
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/26963920

http://stackoverflow.com/q/26894501
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26894618
score: 1
tagged with: java
tagged with: file
upvote count: 1
tagged with: objectinputstream
type: Question
tagged with: data-structures
has body: Below is the code I use to read and write HashMaps too and from a file. I'm wondering, is there anyway I can re-factor this code so that any data structure can be read in and wrote out? Rather than creating a new class for each data structure? I appreciate any help offered! public class FileHandler { static ObjectOutputStream oos; static ObjectInputStream ois; public static void writeOut(HashMap p, File selection) throws FileNotFoundException, IOException { oos = new ObjectOutputStream(new FileOutputStream(selection)); oos.writeObject(p); oos.close(); } public static HashMap&lt;String, Object&gt; readIn(File selection) throws FileNotFoundException, IOException, ClassNotFoundException { HashMap&lt;String, Object&gt; temp = null; ois = new ObjectInputStream(new FileInputStream(selection)); temp = (HashMap&lt;String, Object&gt;) ois.readObject(); ois.close(); return temp; } }
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/26894616
favorite count: 0
tagged with: objectoutputstream
has title: Read and Write any data structure to and from a file?
possible better answer: http://stackoverflow.com/a/26894616
has answer: http://stackoverflow.com/a/26894618

http://stackoverflow.com/comment/42446518
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26952988
has text: What are `two` and `three`? What do you expect to happen?

http://stackoverflow.com/a/32122700
upvote count: 4
answers question: http://stackoverflow.com/q/26976624
downvote count: 0
score: 4
type: Answer
has body: Give a try given().contentType(ContentType.JSON).body(inputPayLoad.toString)

http://stackoverflow.com/comment/42288806
comment on: http://stackoverflow.com/q/26864685
score: 0
has text: You could create your format string with `String.format()` :-)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42371651
score: 0
has text: What is the CAMERAREQUEST value?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26908462

http://stackoverflow.com/comment/42491580
type: Comment
has text: You should use `&&` instead of `||`.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26978522

http://stackoverflow.com/q/26958118
has answer: http://stackoverflow.com/a/26959197
accepted answer: http://stackoverflow.com/a/26959349
favorite count: 0
has comment: http://stackoverflow.com/comment/42472005
has comment: http://stackoverflow.com/comment/42455186
has comment: http://stackoverflow.com/comment/42455259
has answer: http://stackoverflow.com/a/39115020
has answer: http://stackoverflow.com/a/26958225
answer count: 5
has comment: http://stackoverflow.com/comment/42455219
has comment: http://stackoverflow.com/comment/42455967
score: 11
has answer: http://stackoverflow.com/a/26961374
has comment: http://stackoverflow.com/comment/42464327
downvote count: 1
has comment: http://stackoverflow.com/comment/42455170
has comment: http://stackoverflow.com/comment/42469217
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/26958225
tagged with: algorithm
linked to: http://stackoverflow.com/q/6553970
has body: I had an interview and there was the following question: Find unique numbers from sorted array in less than O(n) time. Ex: 1 1 1 5 5 5 9 10 10 Output: 1 5 9 10 I gave the solution but that was of O(n). Edit: Sorted array size is approx 20 billion and unique numbers are approx 1000.
has comment: http://stackoverflow.com/comment/42455136
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26959349
upvote count: 12
has comment: http://stackoverflow.com/comment/42455123
has title: Finding unique numbers from sorted array in less than O(n)
tagged with: time-complexity
has comment: http://stackoverflow.com/comment/42455152

http://stackoverflow.com/q/26984597
accepted answer: http://stackoverflow.com/a/26984692
has comment: http://stackoverflow.com/comment/42503430
tagged with: java
has comment: http://stackoverflow.com/comment/42502926
tagged with: loops
has comment: http://stackoverflow.com/comment/42503618
has comment: http://stackoverflow.com/comment/42502973
type: Question
has body: My assignment is to write a program that lets the user play the game of Rock, Paper, Scissors against the computer. Instructions: The main method should have two nested loops, where the outer loop will allow the user to play the game as often as desired and the inner loop will play the game as long as there is a tie. Call the method isValidChoice() in a while loop in the userChoice() method to verify that the choice that user enters must be “rock”, “paper”, or “scissors”. If invalid string is input, isValidChoice()will return false and the program should ask for new input until the valid input is given. Situation: The program runs fine when the user enters a valid input. However once its not a valid input, there is a small problem. Result: Enter rock, paper, or scissors: rocky Invalid input, enter rock, paper, or scissors: roc Invalid input, enter rock, paper, or scissors: rock The computer's choice was paper The user's choice was rocky Play again? (y/n) As you can see, the program recognizes the invalid inputs. The user finally enter a valid input the third time. However, it displays user's first choice "rocky" which is invalid. Therefore the program can't display who wins. Question I need your help. I want my program to run like this: When the user enters multiple invalid inputs, but once a valid input is entered, my program should still be able to display the user's valid input and display the winner. import java.util.Scanner; import java.util.Random; public class RockPaperScissorsGame { public static void main (String[] args) { Scanner keyboard = new Scanner(System.in); String computer, user; char keepPlaying; do { computer = computerChoice(); user = userChoice(); System.out.println("The computer's choice was " + computer); System.out.println("The user's choice was " + user); determineWinner(computer, user); while (computer.equals(user)) { computer = computerChoice(); user = userChoice(); System.out.println("The computer's choice was " + computer); System.out.pr…
has answer: http://stackoverflow.com/a/53026753
tagged with: nested-loops
has comment: http://stackoverflow.com/comment/42502967
possible better answer: http://stackoverflow.com/a/41200608
has comment: http://stackoverflow.com/comment/42503641
has answer: http://stackoverflow.com/a/41200608
has comment: http://stackoverflow.com/comment/42502943
has title: Rock, Paper, Scissors Java Game
tagged with: while-loop
answer count: 3
downvote count: 0
favorite count: 0
upvote count: 2
has answer: http://stackoverflow.com/a/26984692
linked to: http://stackoverflow.com/q/40480
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/42441925
type: QuestionComment
comment on: http://stackoverflow.com/q/26949249
score: 1
has text: P.S. microblogging data (twitter?) usually is so crappy that it's no wonder when the analysis tools don't work very well.
type: Comment

http://stackoverflow.com/comment/42493283
type: Comment
score: 0
has text: That code looks like it runs in linear time. Are you sure it's O(n log n)?
type: QuestionComment
comment on: http://stackoverflow.com/q/26979299

http://stackoverflow.com/q/26967020
favorite count: 0
has comment: http://stackoverflow.com/comment/42471038
has body: Is there any way we can fire a ComponentListener programatically? For an example, have a look at the below code snap. private class DisplayAllRevenue extends ComponentAdapter { @Override public void componentShown(ComponentEvent e) { } } allRevenueJScrollPane.addComponentListener(new DisplayAllRevenue()); I have created a ComponentListener and attached it into a JScrollPane. Now I need to fire this manually using my own code too. How can I do it? I need to fire this code once JComboBox event has occured. That means, user selects year or something and this code is then fired... There are lot of ComponentListeners I need to fire based on this. These are all heavy database calls which will feed data into different screens, therefore, I am not gonna use the entire set of code inside ItemStateChanged
has answer: http://stackoverflow.com/a/26967267
tagged with: componentlistener
upvote count: 1
tagged with: swing
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/42471106
has comment: http://stackoverflow.com/comment/42471094
type: Question
accepted answer: http://stackoverflow.com/a/26967267
answer count: 1
tagged with: user-interface
has comment: http://stackoverflow.com/comment/42471059
score: 0
has comment: http://stackoverflow.com/comment/42471069
has title: How can you fire ComponentListener programatically?
has comment: http://stackoverflow.com/comment/42471143
tagged with: events
has comment: http://stackoverflow.com/comment/42471216

http://stackoverflow.com/comment/42343742
comment on: http://stackoverflow.com/a/26851599
has text: @SashaO Have you checked also all the directories? Maybe `/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home` or something below or above is a symlink.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/68463647
has body: Late to the party, but I was facing a similar issue and wanted to share my approach: Instead of using Instance.select (which requires the TypeLiteral that can only be constructed during compile time), I simply iterated over all instances (using streams) and then checked for each instance if they "fit" using reflection: @Inject @Any Instance<Handler<?>> instances; //... Handler<?> handler = this.instances.stream() .filter(it -> this.fits(it, handledClass)) .findAny().orElse(null); The implementation of the fits method is a bit - awkward - so to say (Note: Depending on the CDI implementation, it might need some adjustments!). Also, depending on the use case, a simple equality check might not be enough if the handlers should also support subclasses (instead, one could use Class.isAssignableFrom instead)! private boolean fits(Class<?> clazz, Class<?> target) { if (clazz == null) return false; Type[] genericInterfaces = clazz.getGenericInterfaces(); boolean match = Arrays.stream(genericInterfaces) .filter(it -> it instanceof ParameterizedType) .map(it -> (ParameterizedType) it) .filter(it -> it.getRawType() == Handler.class) .anyMatch(it -> ((Class<?>) it.getActualTypeArguments()[0]) == target); if (match) return true; if (this.fits(clazz.getSuperclass(), target)) return true; if (Arrays.stream(clazz.getInterfaces()).anyMatch(it -> this.fits(it, target))) return true; return false; } Note that the recursion is required because handler.getClass() will return the class of the CDI client proxy which unfortunately does not implement the interfaces of the base type in a generic way. Also, if we have the following construct, FooHandlerImpl.class.getGenericInterfaces() won't return Handler<Foo> unfortunately. So we need to traverse the hierarchy ourselves: public interface FooHandler extends Handler<Foo> { } public class FooHandlerImpl implements FooHandler { } It might be a good idea to cache the results maybe.
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/26933284
has comment: http://stackoverflow.com/comment/130605079
downvote count: 0

http://stackoverflow.com/comment/42448676
has text: The program will run but it will give an exception of NullPointerException and it doesn't delete the first character ,adasd will still be ,asdasd
score: 0
comment on: http://stackoverflow.com/q/26954205
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42271772
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26854645
has text: `==` compares the memory (pointer) location of the objects where as `equals` is used to compare the quality of the physical contents of the object, so the two objects could have different memory locations, but are equal (based on the contract of their `equals`)
score: 0

http://stackoverflow.com/comment/42455266
has text: At first glance i do not see any pattern matching. Perhaps seeing some members of the classes would help. So in this case, expecting no more info, most likely it is either no pattern or perhaps fascade.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26958073

http://stackoverflow.com/comment/42442863
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26948296
type: AnswerComment
has text: @denishaskin You're welcome. There's also a bit unconventional namespace URIs and for some reason duplication of schemas `..._for_atis` or `..._for_im` - this will lead to almost identical packages of classes (not very good for development). Apart from that these schemas are quite good.

http://stackoverflow.com/q/26865038
tagged with: java
tagged with: database
has title: Android SQLite database sharing across activities
answer count: 2
tagged with: sqlite
downvote count: 0
tagged with: sqliteopenhelper
has answer: http://stackoverflow.com/a/26865085
favorite count: 0
has body: Background info: new to Android, not to Java. I am writing an app that sends its own messages separately from the default Android sms app. Since my app is not the default, I can't write to Android's provider.sms.outbox, which is absolutely fine. To work around this, I am creating a SQLite database to store my app's outgoing messages (in message objects). I am struggling to find a good, detailed explanation/tutorial on how to create a SQLite database that is available across all of my activities. I only have 2 activities; one that reads the database, and one that reads/writes the database. I know that I need to create a subclass of the SQLiteOpenHelper, and I have: public class dbHelper extends SQLiteOpenHelper { //Database Info private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "outgoingMsgs.db"; public static final String TABLE_MESSAGES = "messages"; //Table Info public static final String COLUMN_ID = "id"; public static final String COLUMN_SEND_TO_NAME = "send_to_name"; public static final String COLUMN_SEND_TO_NUM = "send_to_num"; public static final String COLUMN_BODY = "msg_body"; public dbHelper(Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } //table creation... @Override public void onCreate(SQLiteDatabase db) { String CREATE_MESSAGES_TABLE = "CREATE TABLE " + TABLE_MESSAGES + "(" + COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_SEND_TO_NAME + " TEXT," + COLUMN_SEND_TO_NUM + " TEXT," + COLUMN_BODY + " TEXT" + ")"; db.execSQL(CREATE_MESSAGES_TABLE); } //database version upgrade... destroys old and recreates @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_MESSAGES); onCreate(db); } //adds single record public void addRecord(myMessage msg){ SQLiteDatabase dbase = this.getWritableDatabase(); ContentValues vals = new ContentValues(); //fill vals with appropriate content vals.put(COLUMN_SEND_TO_NAME, msg.get_name()); vals.…
tagged with: android
possible better answer: http://stackoverflow.com/a/26865104
has answer: http://stackoverflow.com/a/26865104
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/26865085
upvote count: 1
type: Question

http://stackoverflow.com/comment/42339453
type: QuestionComment
type: Comment
has text: @blackbelt what's he's doing with the + is correct. He's getting the current text of the edittext, and then concatenating the number that has been pressed onto the end of the string in the edittext. He's not doing it as a calculation
score: 0
comment on: http://stackoverflow.com/q/26892724

http://stackoverflow.com/q/26949689
answer count: 0
tagged with: java
has title: Finding largest contour - OpenCV - Java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/66376775
has comment: http://stackoverflow.com/comment/42441086
has comment: http://stackoverflow.com/comment/42441239
has comment: http://stackoverflow.com/comment/42440953
has comment: http://stackoverflow.com/comment/42440981
score: 0
tagged with: contour
has body: I am trying to find the largest countour in an image after performing some per-processing steps such as: 1) GrayScale 2) Threshold - binarization 3) Canny Then code for finding contour: List contours = new ArrayList(); Imgproc.findContours(img_gray, contours, new Mat(), Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE); double maxArea = -1; int maxAreaIdx = -1; MatOfPoint temp_contour = contours.get(0); //the largest is at the index 0 for starting point MatOfPoint2f approxCurve = new MatOfPoint2f(); MatOfPoint largest_contour = contours.get(0); //largest_contour.ge List&lt;MatOfPoint&gt; largest_contours = new ArrayList&lt;MatOfPoint&gt;(); //Imgproc.drawContours(imgSource,contours, -1, new Scalar(0, 255, 0), 1); for (int idx = 0; idx &lt; contours.size(); idx++) { temp_contour = contours.get(idx); double contourarea = Imgproc.contourArea(temp_contour); //compare this contour to the previous largest contour found if (contourarea &gt; maxArea) { //check if this contour is a square MatOfPoint2f new_mat = new MatOfPoint2f( temp_contour.toArray() ); int contourSize = (int)temp_contour.total(); MatOfPoint2f approxCurve_temp = new MatOfPoint2f(); Imgproc.approxPolyDP(new_mat, approxCurve_temp, contourSize*0.05, true); if (approxCurve_temp.total() == 4) { maxArea = contourarea; maxAreaIdx = idx; approxCurve=approxCurve_temp; largest_contour = temp_contour; } } } Imgproc.cvtColor(img_gray, img_gray, Imgproc.COLOR_BayerBG2RGB); Mat sourceImage =Highgui.imread(filePath + filename); double[] temp_double; temp_double = approxCurve.get(0,0); Point p1 = new Point(temp_double[0], temp_double[1]); //Core.circle(imgSource,p1,55,new Scalar(0,0,255)); //Imgproc.warpAffine(sourceImage, dummy, rotImage,sourceImage.size()); temp_double = approxCurve.get(1,0); Point p2 = new Point(temp_double[0], temp_double[1]); // Core.circle(imgSource,p2,150,new Scalar(255,255,255)); temp_double = approxCurve.get(2,0); Point p3 = new Point(temp_double[0], temp_double[1]); //Core.circle(imgSource,p3,200,n…
favorite count: 0
type: UnansweredQuestion
tagged with: corner-detection
tagged with: opencv

http://stackoverflow.com/comment/42483985
type: QuestionComment
has text: Can you explain what's the desired behavior? I don't know R.
comment on: http://stackoverflow.com/q/26974448
score: 8
type: Comment

http://stackoverflow.com/comment/42384052
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26917708
has text: That's what I would have thought except that it doesn't work. It acts as if it were set to 0. Probably to to acceleration of the object cancelling it out.

http://stackoverflow.com/comment/42468889
comment on: http://stackoverflow.com/a/26965531
type: Comment
has text: Seriously? You're teaching a beginner to use the ternary operator for this?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42346494
type: Comment
has text: same log what is at your line location 46 in mainactivity.
comment on: http://stackoverflow.com/a/26895028
type: AnswerComment
score: 0

http://stackoverflow.com/q/26955183
answer count: 1
favorite count: 0
has title: libGDX Disposing textures in static class
tagged with: android
downvote count: 0
type: Question
type: AnsweredQuestion
tagged with: libgdx
score: 1
tagged with: java
has body: i am storing textures for my game in a static class. They are loaded from a manager and into a static array in this class. each screen has a dispose method but where should i call dispose on the textures. does libGDX only dispose on application exit and thus I should dispose the textures in every screen?
has answer: http://stackoverflow.com/a/26956864
accepted answer: http://stackoverflow.com/a/26956864
upvote count: 1

http://stackoverflow.com/comment/42449844
score: 0
type: Comment
type: QuestionComment
has text: Can you brief little bit more? What's your expected result and current result? Would be easy for us to help you if you post this result diagrammatically.
comment on: http://stackoverflow.com/q/26955056

http://stackoverflow.com/comment/42472979
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26967917
score: 0
has text: are you defining `button10` in your `citation.xml` layout?

http://stackoverflow.com/a/26948912
has comment: http://stackoverflow.com/comment/42439801
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26948509
has comment: http://stackoverflow.com/comment/42441110
score: 2
accepted answer of: http://stackoverflow.com/q/26948509
upvote count: 2
has body: I would definitely recommend that you use the LinkedList class from the java.util package instead of implementing your own. If you use Java's LinkedList, then it will have the method T get(int index) which will return the element at the specified index. Then all you have to do is map your objects properties to the correct column. class MyObj { public String name; public double price; } class MyTableModel extends AbstractTableModel { private List&lt;MyObj&gt; contents; public MyTableModel(List&lt;MyObj&gt; contents){ this.contents = contents; } @Override public int getRowCount(){ return this.contents.size(); } @Override public int getColumnCount(){ return 2; } @Override public Object getValueAt(int row, int column){ MyObj myObj = contents.get(row); //map column index to property return (column == 0)? myObj.name : myObj.price; } } This does not require a LinkedList specifically. All of the required methods are defined in the List Interface, which the LinkedList class of course implements. If you must use your own LinkedList implementation, then you should also implement the List interface. This will allow your implementation to be used wherever a List is required. Then you will be programming to an interface, not an implementation.

http://stackoverflow.com/q/26862293
has comment: http://stackoverflow.com/comment/42284928
upvote count: 1
has answer: http://stackoverflow.com/a/26862503
type: AnsweredQuestion
has body: i have a pop up which contains edit text..how can i prevent the softkeyboard from showing up on displaying of pop up's because my pop up is moving up as soon as it is displayed. getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); i used this line in the activity in which a pop up is displayed on button click. please help...! android:windowSoftInputMode="stateHidden" i also used this line in manifest. but of no use. public class MainActivity extends Activity implements OnClickListener { AlertDialog dialog; View checkBoxView ; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.des_button).setOnClickListener(this); //checkBoxView = View.inflate(this, R.layout.popup_description, null); } @Override public void onClick(View v) { final Dialog dialog = new Dialog(this); dialog.getWindow().getAttributes().windowAnimations = R.style.dialog_animation; // dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); dialog.setContentView(R.layout.popup_description); getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); Button btn_Start = (Button) dialog.findViewById(R.id.ok); btn_Start.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); Button cancel = (Button) dialog.findViewById(R.id.cancel); cancel.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { dialog.dismiss(); } }); dialog.show(); } @Override public void onDestroy() { if (dialog!=null) { if (dialog.isShowing()) { dialog.dismiss(); }
score: 1
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has title: prevent softkeyboard from showing up in popup's which contain edittext?
accepted answer: http://stackoverflow.com/a/26862503

http://stackoverflow.com/comment/42291642
type: QuestionComment
comment on: http://stackoverflow.com/q/26866152
score: 0
has text: Can't say just from the code. Maybe... try using Integer instead of int. List works better with objects rather than primitives.
type: Comment

http://stackoverflow.com/a/39614154
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/26988638
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/90074197
has body: I solved same problems for WebSphere 7 and Eclipse Neon. Just run eclipse with ibm jdk 8 (type in google "ibm jdk 8 download"). My eclipse ini is -vm ..\ibm_sdk80\jre\bin\javaw.exe -vmargs -XX:+UseG1GC -XX:+UseStringDeduplication -Xms256m -Xmx1024m -XX:MaxPermSize=320m -Dcom.ibm.ws.management.event.max_polling_interval=1000 -Dcom.ibm.websphere.thinclient=true Best regards, Sergey Batsura

http://stackoverflow.com/a/26944410
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26944282
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26944282
has body: You could do it something like this. public byte[] toBytes(boolean[] input) { byte[] toReturn = new byte[input.length / 8]; for (int entry = 0; entry &lt; toReturn.length; entry++) { for (int bit = 0; bit &lt; 8; bit++) { if (input[entry * 8 + bit]) { toReturn[entry] |= (128 &gt;&gt; bit); } } } return toReturn; } This relies on the fact that toReturn will be initialised with all zeroes. Then for each true that we encounter in input, we set the appropriate bit within the appropriate entry in toReturn.
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/a/26892142
has comment: http://stackoverflow.com/comment/42373807
has comment: http://stackoverflow.com/comment/42340263
has comment: http://stackoverflow.com/comment/42338778
score: 0
has body: As you have stated in the comments: String s=tf.getText(); is the source of your nullpointer exception. There are a number of possibilities why this is happening. Without seeing your actual classes it is impossible to give you a definite answer. It is possible this method gets executed before tf is assigned. It is possible that your class is attached to a completely different instance of printer (which has tf = null). You're leaving out important details in your question as you're requestion an example to read text field: here you go. import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class TestButton extends JFrame { private JTextField textField; private JButton button; private JTextField outField; public TestButton() { Dimension dimension = new Dimension(400,400); setSize(dimension); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); setLayout(new FlowLayout()); this.textField = new JTextField(10); this.button = new JButton("doStuff"); this.outField = new JTextField(10); add(textField); add(button); add(outField); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { outField.setText(textField.getText()); textField.setText(""); } }); pack(); setVisible(true); } public static void main(String[] argv) { EventQueue.invokeLater(new Runnable() { @Override public void run() { TestButton testButton = new TestButton(); } }); } } I think your issue is related to you creating a new instance of your printable inside your inner class. if the outer class is a printable, that means it will be constructed with new instance variables. you might need to pass this to it In the above code you list: JTextField tf; //Global variable however if this is not a public static final , it is not a global variable. (this would not be an ideal way to expose this variable, but just saying) if tf is an instance variable, then I think I see your problem. you pass…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26890151
has comment: http://stackoverflow.com/comment/42338454
answers question: http://stackoverflow.com/q/26890151
type: Answer
has comment: http://stackoverflow.com/comment/42338422
has comment: http://stackoverflow.com/comment/42369185
has comment: http://stackoverflow.com/comment/42352045
has comment: http://stackoverflow.com/comment/42338301
has comment: http://stackoverflow.com/comment/42338570

series
tag name: series
type: Tag
tags question: http://stackoverflow.com/q/26922596
tags question: http://stackoverflow.com/q/26869659

http://stackoverflow.com/a/26909616
has body: My colleague sorted out the problem. Basically, dependencies conflict. Here is the functionnal dependencies' list : javax.servlet servlet-api 2.5 provided org.glassfish.jersey.containers jersey-container-servlet 2.13 org.glassfish.jersey.core jersey-client 2.13 org.glassfish.jersey.media jersey-media-json-jackson 2.13 javax.servlet servlet-api com.fasterxml.jackson.core jackson-core ${jackson-2-version} com.fasterxml.jackson.core jackson-annotations ${jackson-2-version} com.fasterxml.jackson.jaxrs jackson-jaxrs-json-provider ${jackson-2-version} com.fasterxml.jackson.core jackson-databind ${jackson-2-version} com.netflix.astyanax astyanax-core 1.56.48 com.netflix.astyanax astyanax-cassandra 1.56.48 servlet-api org.mortbay.jetty com.netflix.astyanax astyanax-thrift 1.56.48 <jersey.version>2.13</jersey.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 2.4.3
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26906534
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26906534

http://stackoverflow.com/a/26948259
has comment: http://stackoverflow.com/comment/42438552
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26948185
has body: 10011000 is unicode code point 152 which is an extended unicode character which will only appear if its encoding is supported by your console
upvote count: 1
has comment: http://stackoverflow.com/comment/42438631
has comment: http://stackoverflow.com/comment/42438927

http://stackoverflow.com/comment/42266830
score: 2
has text: You should edit your answer to be: `./test.sh -t some.comman -extraswitch "\"some addtional info\""`
type: AnswerComment
comment on: http://stackoverflow.com/a/26849560
type: Comment

http://stackoverflow.com/comment/42304514
has text: Shouldn't your test class have a method annotated as `@Test`?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26873120

http://stackoverflow.com/q/26897153
has comment: http://stackoverflow.com/comment/42347588
has answer: http://stackoverflow.com/a/26897205
type: AnsweredQuestion
tagged with: oop
tagged with: java
has title: private members are not inherited. then how getters and setters able to access private fields in subClass?
type: Question
accepted answer: http://stackoverflow.com/a/26897205
has body: i have read from almost every source that private members are not inherited. Then how getters and setters of these private fields able to access private fields in subClass? here is my code which is working fine. class First{ private String first; public String getFirst() { return first; } public void setFirst(String first) { this.first = first; } } public class PrivateFieldTestingUsingGettersAndSetters extends First{ private String second; public String getSecond() { return second; } public void setSecond(String second) { this.second = second; } public static void main(String[] args){ PrivateFieldTestingUsingGettersAndSetters ob1=new PrivateFieldTestingUsingGettersAndSetters(); ob1.setFirst("first"); ob1.setSecond("second"); System.out.println(ob1.getFirst()); System.out.println(ob1.getSecond()); } } Output is: first second
has comment: http://stackoverflow.com/comment/42347570
answer count: 1
score: 0
tagged with: private-members

http://stackoverflow.com/q/26952158
has body: A couple of my classmates are having a problem that I'm not able to reproduce, so I'm hoping someone can shed some light on their issue. Our assignment required us to make a method using this signature: public void addElement(int index, Object element) {...} This method is called by a provided (pre-written) driver class with this line: list1.addElement(addIndex, int1); As you may have guessed, int1 is an int. This works fine for me, but some people are receiving an error message: "The method addElement(int, Object) in the type LinkedList is not applicable for the arguments (int, int) " on list1.addElement(addIndex,int1); I've tried using different IDEs and different versions of JDK, but still can't reproduce the issue. Thanks for the help!
has title: Passing an int to an Object argument
upvote count: 2
tagged with: int
has comment: http://stackoverflow.com/comment/42444967
has comment: http://stackoverflow.com/comment/42444987
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42444988
score: 2
has answer: http://stackoverflow.com/a/26952178
has comment: http://stackoverflow.com/comment/42444955
tagged with: java
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/42444973

http://stackoverflow.com/q/26851941
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/26852296
has comment: http://stackoverflow.com/comment/42268034
tagged with: locking
has body: I am working on the backend of a game. Players first purchase their tickets, which are stored into the database, then they play and can win certain prizes. Each player can buy a max of 60 tickets. A new requirement appeared, setting an upper bound for the total number of tickets per game - 10 000 tickets. The implementation would involve adding to the purchase endpoint a test checking that the total number of purchased tickets at that time + number of tickets required on current purchase is less or equal to the max number of tickets for that game, in order for a purchase to be accepted. The problem is that, calculating the current number of purchased tickets by using count on the tickets table, the returned value may be out-of-date because in the meantime other players could have purchased tickets. A possible solution is to lock the tickets table during the purchase, but this can have a negative impact on performance and user experience. Please let me know if you have a different idea.
tagged with: db2
tagged with: concurrency
has title: How to avoid db lock
accepted answer: http://stackoverflow.com/a/26852296
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42266623
type: Question
tagged with: dirtyread
answer count: 1

http://stackoverflow.com/comment/42244694
has text: Is it homework or a programming challenge like project euler?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26839890

http://stackoverflow.com/q/26847569
tagged with: log4j
downvote count: 0
type: UnansweredQuestion
score: 6
tagged with: logging
has answer: http://stackoverflow.com/a/40766845
tagged with: java
has comment: http://stackoverflow.com/comment/93862030
has comment: http://stackoverflow.com/comment/44665149
type: Question
has title: How to get GELFJ appender work in log4j?
has answer: http://stackoverflow.com/a/35169384
upvote count: 6
tagged with: graylog2
favorite count: 0
has body: I need to get my Java application writing logging to a Graylog2 server. The application uses a log4j configuration. Several things I have tried to get the logging writing to the Graylog2 server, the things I got working was sending a test message directly to the server, as shown here (first example). Yet, when I write an appender and attach it to the root logger, I always get this error message the first time a log event is to be fired: log4j:ERROR Could not send GELF message Nothing then happens on the Graylog2 server side. The appender I try to get working: &lt;appender name="graylog2" class="org.graylog2.log.GelfAppender"&gt; &lt;param name="graylogHost" value="127.0.0.1"/&gt; &lt;param name="originHost" value="my.machine.example.com"/&gt; &lt;param name="extractStacktrace" value="true"/&gt; &lt;param name="addExtendedInformation" value="true"/&gt; &lt;param name="facility" value="gelf-java"/&gt; &lt;param name="Threshold" value="INFO"/&gt; &lt;param name="additionalFields" value="{'environment': 'DEV', 'application': 'MyAPP'}"/&gt; &lt;/appender&gt; Does anyone have an idea how to get this running? Any help is highly appreciated!
has answer: http://stackoverflow.com/a/28040361
answer count: 3

http://stackoverflow.com/comment/42342078
score: 1
has text: "It is not giving me the expected results" is not very specific. Please tell what you are getting and what do you expect, and where have you pinpointed the problem.
comment on: http://stackoverflow.com/q/26894263
type: QuestionComment
type: Comment

http://stackoverflow.com/q/26895123
tagged with: spring-integration
tagged with: java
type: Question
upvote count: 4
tagged with: delay
downvote count: 0
score: 4
has body: I am using the below XML snippet: &lt;int-amqp:inbound-channel-adapter acknowledge-mode="MANUAL" channel="commandQueue" concurrent-consumers="${commandConsumers:10}" queue-names="commands" connection-factory="connectionFactory"/&gt; &lt;int:channel id="commandQueue"/&gt; &lt;int:channel id="commands"/&gt; &lt;int:chain input-channel="commandQueue" output-channel="commands"&gt; &lt;int:delayer id="commandDelayer" default-delay="30000"/&gt; &lt;int:json-to-object-transformer id="commandTransformer" type="com.airwatch.chat.command.Command"/&gt; &lt;/int:chain&gt; &lt;int:payload-type-router input-channel="commands"&gt; .... .... It's performing these tasks: Consume messages from the RabbitMQ queue named 'commands'. Delay the message execution by 30 seconds. Proceed with further execution for message after the specified delay. If the message is already present on the commands queue before the application with the above code is started, on startup the application executes the message twice in separate threads. I think I know why this is happening. Spring reschedules the messages persisted in the message store of DelayHandler once the application context is completely initialized. Refer to the below code snippet from DelayHandler.java: public void onApplicationEvent(ContextRefreshedEvent event) { if (!this.initialized.getAndSet(true)) { this.reschedulePersistedMessages(); } } So if the message was already present in the RabbitMQ queue before application startup, during Spring context initialization the message is picked up from the queue and added to the message store of DelayHandler. Once the context initialization is done, and if in the meantime the message is not released from the message store, the above code snippet reschedules the same message. Now when two separate threads are executing the same message, if one thread has executed, then the message should be deleted from the message store and the other thread should not proceed with execution. While the thread is e…
has title: Spring Integration: Message released twice after delay
tagged with: delayed-execution
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26905170
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/q/26857711
has answer: http://stackoverflow.com/a/26860863
favorite count: 0
has comment: http://stackoverflow.com/comment/42280661
tagged with: serialization
tagged with: io
has comment: http://stackoverflow.com/comment/42277099
has title: Save the field values of a panel using I/O file write
upvote count: 0
has body: I have created a Swing page from Netbeans IDE including two labels name and age and two text fields corresponding to each label. My problem is how I could save this page entirely as a text file? private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String sb = "TEST CONTENT"; int retrieval = jFileChooser1.showSaveDialog(null); if (retrieval == JFileChooser.APPROVE_OPTION) { try( FileWriter fw = new FileWriter(jFileChooser1.getSelectedFile()+".txt")) { fw.write("name: "+txtname.getText()+"\n" ); fw.write("\nage: "+txtage.getText() ); } catch (Exception ex) { ex.printStackTrace(); } } } I have tried this code. But I am expecting to save the panel completely as a text file.
downvote count: 2
has comment: http://stackoverflow.com/comment/42280506
possible better answer: http://stackoverflow.com/a/26861190
has comment: http://stackoverflow.com/comment/42276965
tagged with: swing
has comment: http://stackoverflow.com/comment/42277024
type: AnsweredQuestion
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/42279694
accepted answer: http://stackoverflow.com/a/26860863
type: Question
has comment: http://stackoverflow.com/comment/42277051
has comment: http://stackoverflow.com/comment/42277191
has comment: http://stackoverflow.com/comment/42277061
has comment: http://stackoverflow.com/comment/42278347
answer count: 2
has answer: http://stackoverflow.com/a/26861190

http://stackoverflow.com/comment/42478504
type: QuestionComment
comment on: http://stackoverflow.com/q/26971315
has text: @DarshanLila How can I solve it?
score: 0
type: Comment

http://stackoverflow.com/a/26926909
downvote count: 0
type: Answer
upvote count: 1
has body: If you get "this" inside listener you get a reference to listener's object. You should use getSource() method, like: JButton j = new JButton("click here"); j.putClientProperty("id", "employee1"); j.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { JButton source = (JButton)ae.getSource(); String id = (String) source.getClientProperty("id"); System.out.print(id); } }); Will print - employee1.
answers question: http://stackoverflow.com/q/26905626
score: 1

http://stackoverflow.com/comment/42321532
score: 1
comment on: http://stackoverflow.com/q/26882972
type: Comment
type: QuestionComment
has text: You mean something like [this](http://stackoverflow.com/questions/14635952/java-layout-proportions-creating-a-scalable-square-panel/14636828#14636828)?

http://stackoverflow.com/comment/42256735
comment on: http://stackoverflow.com/q/26841762
type: QuestionComment
has text: @CliveEvans thanks for the explanation so what api should i upgrade i am using xalan 1.7 rite now with jdk 1.5 please advise
type: Comment
score: 0

http://stackoverflow.com/comment/42443710
score: 1
comment on: http://stackoverflow.com/q/26951385
type: Comment
type: QuestionComment
has text: To make it uniquely named. There are _two_ "List" classes in the JRE, which mean you always have to explitlity mention which one you want.

http://stackoverflow.com/a/26875695
has comment: http://stackoverflow.com/comment/42309230
score: 0
type: AcceptedAnswer
has body: I see what you've done - you are trying to replace the contents of the view in android_frag.xml with an instance of NestedAndroidFragment. There are two errors that you have here actually - the crash is the first one. I'll explain the second one shortly. What you are trying to do in the following line is wrong. transaction.replace(android.getId(), videoFragment); // you are trying to get the ID of the entire inflated view // you should be just using the id of the FrameLayout here In fragments, you should be replacing the contents of a root level container with a fragment. What you are trying to do is ask fragment B to reside inside fragment A but replace all of A. Do you see how this paradigm is broken? You cannot ask B to reside inside A while at the same time replacing A. And this is the reason for your crash. Fixing this is pretty simple. In android_frag.xml, add an id attribute for the FrameLayout as follows: android:id="@+id/container" Now go back to your Android.java and replace line where you make the replace transaction with: transaction.replace(R.id.container, videoFragment); // you can directly reference the id here This will fix the issue of your crash but this is where you will notice another issue - the contents of the videoFragment will overlay the contents of your ListView. The reason for this is that while using fragments, Android expects you to fill the containers as and when you need them. But you have a ListView defined in the xml. Once a widget is defined in xml, you cannot keep replacing it or removing it as you would with fragments. Once it is in xml, it will always be in every view where that xml is. The best design in your case would be to have your Android class extend a ListFragment and then take things from there (but this is only from looking at what you have put up now. I am not sure how this would interact with your other code and hence only take my statement as a suggestion if it works for you). As a workaround to deal with what you ha…
type: Answer
accepted answer of: http://stackoverflow.com/q/26874731
answers question: http://stackoverflow.com/q/26874731

http://stackoverflow.com/a/26947031
has comment: http://stackoverflow.com/comment/42436308
has comment: http://stackoverflow.com/comment/42436176
has comment: http://stackoverflow.com/comment/42436216
has comment: http://stackoverflow.com/comment/42436298
has comment: http://stackoverflow.com/comment/42458250
has body: Part of the problem is that there is no guarantee that the user will have added values before searching for the largest or smallest numbers. Int arrays have a default value of 0 when initialized, so if you aren't adding values to the array before searching, you will naturally get zero as your largest and smallest. I would recommend against using the switch for this reason.
has comment: http://stackoverflow.com/comment/42436332
type: Answer
has comment: http://stackoverflow.com/comment/42436276
score: 0
has comment: http://stackoverflow.com/comment/42436271
answers question: http://stackoverflow.com/q/26946945

http://stackoverflow.com/q/26917853
has comment: http://stackoverflow.com/comment/42396926
answer count: 1
favorite count: 0
has title: Cannot find symbol from ResultSet JDBC
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/25706216
tagged with: jdbc
upvote count: 1
has answer: http://stackoverflow.com/a/26917912
tagged with: java
downvote count: 3
has body: I'm getting a cannot find symbol error and it points to the period right in rs.getChars(1) This code is all within a try{}. There are three columns in the view table, title, item_id, and name. I'm just trying to query it but get a cannot find symbol on the line inside the start of the while loop. PreparedStatement pstmt= conn.prepareStatement("SELECT * FROM Film_Sound_Track"); ResultSet rs = pstmt.getResultSet(); while(rs.next()){ char item_id = rs.getChars(1); } rs.close(); pstmt.close();
type: Question
has comment: http://stackoverflow.com/comment/42384213
tagged with: syntax-error
duplicate of: http://stackoverflow.com/q/25706216
score: -2

http://stackoverflow.com/q/26907926
answer count: 4
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/26908797
type: Question
has comment: http://stackoverflow.com/comment/42367215
has answer: http://stackoverflow.com/a/26908001
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/42366126
has comment: http://stackoverflow.com/comment/42365992
has body: This is my code: package vvv; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class test { public static void main(String args[]){ Map&lt;Integer, String&gt; map = new HashMap&lt;Integer, String&gt;(); map.put(1, "demo"); map.put(20, "fdemo"); map.put(60, "gdemo"); map.put(500, "udemo"); map.put(8000, "odemo"); // etc int b = 7999; for(int i =1; i&lt;=8000; i++) { if(i == b) System.out.println(map.get(b)); } } } I don't want to use a big "for loop" just to find a result from map, and in addition, I can't change a key in the map (for example I can't change 500 to 4). What should I do to reduce my loop condition?
has answer: http://stackoverflow.com/a/26907975
accepted answer: http://stackoverflow.com/a/26907975
downvote count: 1
favorite count: 0
has title: Reduce For loop in Map
has answer: http://stackoverflow.com/a/26908655
possible better answer: http://stackoverflow.com/a/26908001
tagged with: dictionary

http://stackoverflow.com/comment/42539200
type: AnswerComment
comment on: http://stackoverflow.com/a/26982347
type: Comment
has text: there is no bad hiding behavior of doing that ?
score: 0

http://stackoverflow.com/q/26898049
type: Question
has body: I have this dialog that works, until I added the code to try and launch another Dialog and then it crashes with a DialogFragment.class error. popup.show is where the error occurs. public class ProcessLocation extends DialogFragment { Context context; SharedPreferences domainToName; SharedPreferences nameToDomain; SharedPreferences defaults; PopupMessage popup; int locationTally; // Constructor ProcessLocation(Context context) { this.context = context; } public void processLocation(String domain, String name, String password) { domainToName = context.getSharedPreferences("domainToName", Context.MODE_PRIVATE); //domain name = friendly name nameToDomain = context.getSharedPreferences("nameToDomain", Context.MODE_PRIVATE); //friendly name = domain name/password/acm defaults = context.getSharedPreferences("Defaults", Context.MODE_PRIVATE); //friendly name = domain name/password/acm String checkName = nameToDomain.getString(name,null); locationTally = defaults.getInt("tally",0); final Editor domainEdit = domainToName.edit(); final Editor nameEdit = nameToDomain.edit(); //popup = new PopupMessage(); // Check to see if the location friendly name exists already, if so the entry is overwritten with new data if (checkName == null) { locationTally++; updatePreferences(locationTally, name, domain, password); // popup.message = "Location has been added"; // popup.show(getFragmentManager(), "PopupMsgFragment"); } else { nameEdit.remove(name); nameEdit.commit(); domainEdit.remove(domain); domainEdit.remove(domain+"Pw"); domainEdit.commit(); updatePreferences(locationTally, name, domain, password); } } public void updatePreferences(int tally, String name, String domain, String password) { popup = new PopupMessage(); domainToName = context.getSharedPreferences("domainToName", Context.MODE_PRIVATE); //domain name = friendly name nameToDomain = context.getSharedPreferences("nameToDomain", Context.MODE_PRIVATE); //friendly name = domain name/password/acm defaults = context.getSharedPref…
has title: Launching Dialog from non-activity
answer count: 2
upvote count: 1
tagged with: android-dialogfragment
favorite count: 0
has answer: http://stackoverflow.com/a/26899628
tagged with: android-context
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/26900840
tagged with: android-alertdialog
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/q/26923155
has comment: http://stackoverflow.com/comment/42394096
downvote count: 0
has answer: http://stackoverflow.com/a/26923490
has title: comparing and sorting arraylist of values in hashmap java
possible better answer: http://stackoverflow.com/a/26923577
favorite count: 0
has answer: http://stackoverflow.com/a/26923577
tagged with: arraylist
tagged with: key-value
answer count: 3
has comment: http://stackoverflow.com/comment/42428948
accepted answer: http://stackoverflow.com/a/26923490
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42394159
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/42419344
has answer: http://stackoverflow.com/a/26926279
tagged with: hashmap
has body: I have a hashmap Map&lt;String, ArrayList&lt;String&gt;&gt; games = new hashmap&lt;String, Arraylist&lt;String&gt;&gt;(); it contains name as the key and list of games as the values. like this: A= [ cricket, soccer, tennis, baseball] B= [soccer, badminton, rugby] C= [cricket, badminton] D= [rugby, cricket, soccer] E= [cricket, baseball] F= [tennis, rugby] now i want to count the occurence of each value (criket, soccer etc.) and assign only one value to a key based on the occurence of values. here, cricket occured 4 times, soccer occured 3 times and so on. And compare the values of each key and check which values occured how many times. Then i want to assign the value with the maximum occurence. that is i want to have a hashmap which will be like this: A= [ cricket] // because among its 4 values, cricket has occured maximum times. B= [soccer] // among its 3 values, soccer has occured maximum times. C= [cricket] D= [cricket] E= [cricket] F= [rugby] // among its 2 values, rugby has occured maximum times which is 3. And so on... I have no clue on how to tackle this situation. So, please help me regarding this and give detailed info. thanks

http://stackoverflow.com/q/26878404
has body: How can the number of elements in an array be counted? So the array can hold 10 elements, but not all are filled. How do I count the number of elements that are entered? Also, what is the correct way to find the average of an array? What I have now gives me this, The number of valid grades entered is 10 [D@7ea987ac[D@7ea987acAverage: 0.0 //validate strings entered by user if(convertedInput &gt;= 0 &amp;&amp; convertedInput &lt;=100){ ValidArray[validArraycount] = convertedInput; validArraycount ++; } } catch(NumberFormatException e){ } //Prints number of valid values entered System.out.println("The number of valid grades entered is " + vArrayLen); //for printing array backwards for (int i = (arraycount-1); i&gt;=0; i--){ System.out.print(ValidArray); } //calculates sum of all values in array of ValidArray (of grades) for(double d : ValidArray){ sum += d; } //avergae of valid number array double average = (sum/ValidArray.length); System.out.println("Average: " + average); } } Thank You. EDIT: The input is suppose to be up to 10 strings. Anything can be entered. Valid strings are double numbers between 0-10 that can be 0 and 10. All strings not valid are discarded. As of now this is what my code looks like: import java.util.*; public class Grades{ public static void main(String args[]){ int arraycount = 0; final int SIZE = 100; int validArrayCount = 0; final int ValidArraySize = 100; int valuesinValidArray = 0; Scanner reader = new Scanner(System.in); String initialInput = new String (""); String [] sArray = new String[SIZE]; double [] ValidArray = new double[ValidArraySize]; double sum = 0; boolean exit = false; System.out.println("You may enter up to 100 grades."); System.out.println("When you are done entering grades, press the enter/return key."); //Prints to user. Stops if nothing is entered. while((arraycount &lt; SIZE)&amp;&amp;(exit == false)){ System.out.println("Enter line " + (arraycount+1) + ": "); initialInput = reader.nextLine(); if (initialInput.length(…
tagged with: java
has title: How to count the number of elements added to an array and find the average of numbers added in Java?
type: Question
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/26878474
has answer: http://stackoverflow.com/a/26878573
has comment: http://stackoverflow.com/comment/42313807
score: 0
has comment: http://stackoverflow.com/comment/42313804
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42313835
has comment: http://stackoverflow.com/comment/42313987

http://stackoverflow.com/q/26847113
has title: Schedule remote file download over FTP and process file in memory with Spring Integration
favorite count: 0
has body: I need to download a file from a remote FTP server every day and provide its contents to a class as an InputStream (or at least as byte[]) for further processing. Ideally I should also avoid any disk write. Can anyone give some advice on how to configure it with an XML or an annotation based configuration?
tagged with: ftp
has answer: http://stackoverflow.com/a/26847740
downvote count: 0
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: spring-integration
score: 1
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/a/26884415
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/42354662
has comment: http://stackoverflow.com/comment/42363927
downvote count: 0
has body: your solution is that whenever you entered in any new activity.... 1.) You have to save the name of this activity in shared preferance(on same key) you have to perform this things in onResume() of every activity or your BaseActivity. 2.) At the every time of splash screen you have to check the name of this activity and pass it in your intent. so you get the last open activity each time after your splash screen done.
answers question: http://stackoverflow.com/q/26883962
has comment: http://stackoverflow.com/comment/42347727
type: Answer

http://stackoverflow.com/comment/42252410
type: Comment
score: 1
comment on: http://stackoverflow.com/a/26844513
type: AnswerComment
has text: It also has static members.

weblogic
tags question: http://stackoverflow.com/q/26976587
tags question: http://stackoverflow.com/q/26991296
tags question: http://stackoverflow.com/q/26883735
tags question: http://stackoverflow.com/q/26984954
tags question: http://stackoverflow.com/q/26858510
tags question: http://stackoverflow.com/q/26854098
tag name: weblogic
tags question: http://stackoverflow.com/q/26940745
type: Tag
tags question: http://stackoverflow.com/q/26866069
tags question: http://stackoverflow.com/q/26869639

http://stackoverflow.com/comment/42348296
score: 0
comment on: http://stackoverflow.com/q/26895036
type: QuestionComment
type: Comment
has text: But if I don't want to look at the source code and just continue on with debugging? "Step over" also makes the window pop up.

http://stackoverflow.com/q/26918675
downvote count: 3
accepted answer: http://stackoverflow.com/a/26918760
tagged with: http://stackoverflow.com/tag/png
favorite count: 0
score: 8
linked to: http://stackoverflow.com/q/11959758
has answer: http://stackoverflow.com/a/26918760
tagged with: bufferedimage
type: Question
type: AnsweredQuestion
tagged with: java
upvote count: 11
has body: I'm reading a PNG image with the following code: BufferedImage img = ImageIO.read(new URL(url)); Upon displaying it, there is a black background, which I know is caused from PNG transparency. I found solutions to this problem suggesting the use of BufferedImage.TYPE_INT_RGB, however I am unsure how to apply this to my code above.
answer count: 1
has title: Removing transparency in PNG BufferedImage

http://stackoverflow.com/a/26926922
answers question: http://stackoverflow.com/q/26926888
score: 42
has comment: http://stackoverflow.com/comment/76183650
type: Answer
has comment: http://stackoverflow.com/comment/42400545
has comment: http://stackoverflow.com/comment/42400163
has comment: http://stackoverflow.com/comment/138319622
downvote count: 2
has body: In the bottom right of your window, change [CRLF] to [LF]
upvote count: 44

http://stackoverflow.com/q/26875107
upvote count: 3
answer count: 1
favorite count: 0
has body: I am including a "sub-project" into my project. To do that I simply copy and paste into my project. Say my project is com.important.stuff and the sub-project is com.redo.things.utensil.pencil. So I move the content of the sub-project so that the package would now be com.important.stuff.redo.things.utensil.pencil. But when I open my project in eclipse, it's all red and I know how to fix it one by one. But is there a batch solution? My eclipse is Version: Juno Service Release 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/26875249
type: Question
score: 3
tagged with: osx-mavericks
tagged with: eclipse
has title: change package declaration of multiple java files in eclipse
has answer: http://stackoverflow.com/a/26875249

http://stackoverflow.com/a/57893103
has comment: http://stackoverflow.com/comment/122023467
has comment: http://stackoverflow.com/comment/120220702
has comment: http://stackoverflow.com/comment/108902728
has body: Run this command in your project console: mvn idea:idea Done. Had this issue many times. Tried 'Invalidate Cache &amp; Restart' and all other solutions. Running that command works perfect to me. I'm currently using IntelliJ 2019.2, but this also happened in previous versions and solution worked as well.
score: 31
type: Answer
upvote count: 32
answers question: http://stackoverflow.com/q/26952078
downvote count: 1

http://stackoverflow.com/comment/42295230
has text: I would look at the line that says array[s] = 2; We have no idea what s is going to be. Chances are it is overwriting values of the same cells, and it is possible that the if statement isn't even running.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26867929
score: 2

http://stackoverflow.com/a/26971322
accepted answer of: http://stackoverflow.com/q/26970644
upvote count: 1
type: AcceptedAnswer
has body: Thanks for your answer @Sebri. I found the solution, I just replaced index by unique-key property &lt;hibernate-mapping default-lazy="false" default-cascade="all" package="xxx"&gt; &lt;id name="dbId" column="db_id" type="long"&gt; &lt;generator class="IdentityGenerator"/&gt; &lt;/id&gt; &lt;discriminator column="tag" type="string"/&gt; &lt;property name="created" type="timestamp" insert="false" update="false" generated="insert"/&gt; &lt;property name="name" column="name" type="string" not-null="true" unique-key="key"/&gt; &lt;property name="version" column="version" length="80" type="string" unique-key="key"/&gt; &lt;property name="size" column="size" type="long"/&gt; &lt;property name="newField" column="new_field" type="long" unique-key="key"/&gt;
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26970644

http://stackoverflow.com/comment/42328718
score: 0
type: Comment
has text: resetChoosableFileFilters is what I needed! I guess the name setFileFilter is badly choosen because what it does in reality is set the _selected_ file filter (without replacing the other filters).
comment on: http://stackoverflow.com/a/26887024
type: AnswerComment

http://stackoverflow.com/a/27074860
score: 0
type: Answer
answers question: http://stackoverflow.com/q/26984296
has body: Finally i've achieved wich works, the problems is the primefaces version i was working with primefaces 5, the correct version for this throuble is primefaces version 4. Thanks anyway. ;)

http://stackoverflow.com/comment/73587010
score: 0
has text: Extending the outer class is a very good starting point, if you *must* use inner classes for something ... I like it a lot, despite that it could easily be used in wrong context / bad design, the general idea is *very* good!
type: Comment
comment on: http://stackoverflow.com/a/26968689
type: AnswerComment

http://stackoverflow.com/comment/42328282
type: Comment
score: 0
type: AnswerComment
has text: -1 this appears plagiaristic. It would have been better to state something like: `Peter Lawrey states:` This questions should have just be closed as duplicate.
comment on: http://stackoverflow.com/a/26886346

http://stackoverflow.com/comment/42426452
type: AnswerComment
has text: Can you go into more detail about the _Basically_?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26941324

http://stackoverflow.com/a/75391235
has body: For me it worked like this: On your desktop go to Search-&gt;View advanced system settings-&gt;Environment Variables Under System Variables look for path and click Edit. Click on New and add the new Path and move it to the top. To find your java path if you don't know where it is installed in cmd type where javac
type: Answer
score: 0
answers question: http://stackoverflow.com/q/26864662

http://stackoverflow.com/comment/42284492
has text: But with this, even I selected the cancel from dialogue box, it still execute the createEvent which is in the if statement if parameter passed in was one. Do you have any ideas to twist this around?
comment on: http://stackoverflow.com/a/26861707
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/42447648
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/26953669
has text: i just found a class that implements thread. it works on my computer (ubuntu) so when i can use my moms again i will test it on there. i got the class from the first answer [here](http://stackoverflow.com/questions/18009542/extreme-lag-after-having-wav-au-sound-in-my-game?rq=1) if you want to see it.
score: 0

http://stackoverflow.com/a/26875052
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42337527
type: Answer
has comment: http://stackoverflow.com/comment/42337160
has comment: http://stackoverflow.com/comment/42336710
accepted answer of: http://stackoverflow.com/q/26874592
has body: You should use an Interface 1) create an interface class: public interface MyAdapterInterface { public void updateEditText(String value); } 2) change your adapter to: public class CustomCursorAdapter extends CursorAdapter{ public int counter = 0; private MyAdapterInterface mMyInterface; public CustomCursorAdapter(Context context, Cursor c, MyAdapterInterface myInterface) { super(context, c); this.context = context; this.mMyInterface = myInterface; } Context context; @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { // when the view will be created for first time, // we need to tell the adapters, how each item will look LayoutInflater inflater = LayoutInflater.from(parent.getContext()); View retView = inflater.inflate(R.layout.row, parent, false); return retView; } public void bindView(View view, Context context, Cursor cursor) { // here we are setting our data // that means, take the data from the cursor and put it in views TextView textViewPersonName = (TextView) view.findViewById(R.id.item1); textViewPersonName.setText(cursor.getString(cursor.getColumnIndex(cursor.getColumnName(1)))); final EditText edit1 = (EditText) view.findViewById(R.id.runningTotal); Button plusButton = (Button) view.findViewById(R.id.plusButton); plusButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { counter++; edit1.setText(Integer.toString(counter)); mMyInterface.updateEditText(/*YOUR VALUE*/); } }); Button minusButton = (Button) view.findViewById(R.id.minusButton); minusButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { counter--; edit1.setText(Integer.toString(counter)); mMyInterface.updateEditText(/*YOUR VALUE*/); } }); } } 3) implement the interface in your activity: public class MyActivity extends Activity implements MyAdapterInterface { private CustomCursorAdapter customAdapter; public ListView list1; com.example.rory.dbtest.DBAdapter db = new com.example.rory.dbtest.DBAdapter(this); p…
answers question: http://stackoverflow.com/q/26874592
has comment: http://stackoverflow.com/comment/42337297

http://stackoverflow.com/comment/42456956
comment on: http://stackoverflow.com/a/26956486
type: Comment
type: AnswerComment
score: 0
has text: haha actually i dont really know, umm im really new to java, even though im loving this language, its really hard to understand some of the statements. im trying to make it simple by asking dumb questions haha. anyways. the thing was just to make a program with 2 buttons that show a message when you press them so now that's accomplished, so what im doing next is i want to put a few pictures in the program, and use the 2 buttons as next and back to show the pictures

http://stackoverflow.com/comment/42313019
score: 0
has text: Got some code at all?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26877986

http://stackoverflow.com/comment/42492821
type: AnswerComment
score: 0
has text: I'm trying to optimize some graph traversal code that needs to visit every possible path. There's a decent amount of data that once generated will be constant for the node it's related to, and rather than regenerate it every time I hit the node, I want to generate it once, then re-link my linked list as necessary since the data at any node is sensitive to data that's ahead of it in the list. It's not a great explanation, I can't really find the right words to explain it :/
type: Comment
comment on: http://stackoverflow.com/a/26978939

http://stackoverflow.com/a/26910457
has comment: http://stackoverflow.com/comment/42370804
has body: no, java does not support preprocessor macros. What you can do is to have a java.pre file, and use ant to generate the .java files that will be compiled.
answers question: http://stackoverflow.com/q/26910410
has comment: http://stackoverflow.com/comment/42370908
score: 0
type: Answer

http://stackoverflow.com/q/26921370
has body: i am working on a test tool, where QTP will publish results in MySQL DB. Now i have another application ( preferably Java ) which is going to manipulate the results. My requirement is whenever a new row value ( test results ) are updated in MySQL DB table, my Java application should receive a notification that new values are updated. Thanks
type: UnansweredQuestion
has title: MYSQL: Notifications when a new row values are added
has comment: http://stackoverflow.com/comment/42390776
upvote count: 1
score: 1
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/26921962
type: Question
downvote count: 0
answer count: 1
favorite count: 0
tagged with: notifications

http://stackoverflow.com/q/26851168
downvote count: 0
has answer: http://stackoverflow.com/a/26853163
favorite count: 0
has comment: http://stackoverflow.com/comment/42264783
has comment: http://stackoverflow.com/comment/42264802
has comment: http://stackoverflow.com/comment/42264906
has title: How to try a true or false syntax in java
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/26851226
has comment: http://stackoverflow.com/comment/42264793
tagged with: java
has body: I have the fallowing code while (b == true){ System.out.print("input the account balance without tax: "); int inner = input.nextInt(); List[x]=inner; x=x+1; } and I want to check if my user inputs a word it would do: b =false So I would exit this loop. In python we had try() and except. I don't really know what to do in java.
has comment: http://stackoverflow.com/comment/42264768
type: Question
answer count: 2
score: 2
has comment: http://stackoverflow.com/comment/42264817

http://stackoverflow.com/comment/42496547
has text: @RomainHippeau Four legs good, two legs _better_! Four legs good, two legs _better_! Four legs .......
type: Comment
comment on: http://stackoverflow.com/q/26981095
type: QuestionComment
score: 0

http://stackoverflow.com/comment/42295676
score: 2
type: Comment
has text: Why does this constructor `public Quiz (int[] scores, int count, String name)` require some arguments, if it doesn't use them? Next thing: `scores=new int [size];` ... `size` was set to `0`, so allows `0` entries ... not very useful, don't you think? And the last thing (for now): wouldn't it make more sense to use the existing array in method `addScores` instead of creating a new one?
type: QuestionComment
comment on: http://stackoverflow.com/q/26868153

http://stackoverflow.com/comment/42313987
type: QuestionComment
has text: I cannot use ArrayList
score: 0
type: Comment
comment on: http://stackoverflow.com/q/26878404

http://stackoverflow.com/a/26996786
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/26989390
upvote count: 2
has body: A1: Yes, but ... A2: Yes, but ... A3: Follow the ZeroMQ Best Practice, do not rely just on the language binding A4: Ref. A3 What is the motivation for "The Best Practice"? First of all, one shall kindly realise, that ZeroMQ has a certain set of internal architecture principles that nobody shall either knowingly or accidentally violate. That said, one may also realise, that different language-bindings ( it is not the ZeroMQ, but some other code-wrapper associated externally with the internal architecture rules ) may have problems on orchestrating gracefull termination ( and some wrappers hide this under the hood so that user is not aware what is going to happen there ). Endless hanging .bind()-s to localhost port(s) and threads caught in dead-locks are just a few troubles one may face with a poor resources release &amp; termination practice. What is the ZeroMQ rule of thumb? Enforce a non-blocking .close() on all ZMQ-socket instances Finally enforce .term() the ZMQ-context instance Ad 1) non-blocking means, one must take due care of .setsockopt() parameters, alike ZMQ_LINGER, so as to avoid dead-lock(s) on letting the ZMQ-socket archetype wait endlessly in an expectation, that the opposite counterparty may still have some messages to be received, so be carefull and methodic on this step. Set all safe-exit parameters before calling .close(). Otherwise you have lost your control entering into a blocking-mode.
type: Answer
has comment: http://stackoverflow.com/comment/42531664

http://stackoverflow.com/comment/42322008
type: AnswerComment
score: 0
has text: Actually I am reading the version from window's Registy Editor
type: Comment
comment on: http://stackoverflow.com/a/26877116

cannot-find-symbol
tags question: http://stackoverflow.com/q/26915167
tag name: cannot-find-symbol
type: Tag

http://stackoverflow.com/comment/42414699
score: 0
type: Comment
comment on: http://stackoverflow.com/a/26915779
type: AnswerComment
has text: I'm sorry you didn't like my answer. I'm willing to keep thinking about this with you and look for faster heuristic approaches, but not if you're just going to shoot down every idea that's suggested to you, I am actually trying to help you.

http://stackoverflow.com/comment/42326678
has text: I moved the second while part into the first while part but still I can't get the correct result.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26885955

http://stackoverflow.com/comment/42309707
comment on: http://stackoverflow.com/q/26875839
score: 0
type: QuestionComment
type: Comment
has text: I think i fixed it. Sorry I am new to this.

http://stackoverflow.com/q/26952513
downvote count: 0
answer count: 7
has comment: http://stackoverflow.com/comment/42445702
favorite count: 0
has answer: http://stackoverflow.com/a/26952563
has title: How to return reference to object as parameter in Java
possible better answer: http://stackoverflow.com/a/26952596
has answer: http://stackoverflow.com/a/26952596
tagged with: parameter-passing
has answer: http://stackoverflow.com/a/26952567
tagged with: reference
type: AnsweredQuestion
has body: Although I've programmed C, C++ and C# for many years I'm am only superficially familiar with Java. Helping my Comp Sci son with a Java college project he had a need to return references to two objects from a method in Java. I suggested returning one as the function value and the 2nd as a reference. He wasn't sure how to do this. I did a little research and realized it may not be possible. My question is in Java what is the common method used when a method needs to return more than one reference to an object. Here's the specific example in my sons case. // This method returns references to the head and tail objects from the passed in // linked list. The head object is returned as the function value and the tail is // returned as a parameter. public Static Node GetHeadTail(List list, Node tail) I realize the above doesn't work in Java since the tail is a reference to node and in Java the reference itself is passed by value. What is the most common way of dealing with this in Java? My son's solution was to return an array of 2 Node objects for the function value. I said that was a poor solution because it doesn't document the meaning of each element of the array. Another solution would be to create an object that contained the head and tail references. However in the particular example it was the head pointer that was of most interest and if an object was returned it would create undesired coding overhead for the caller of the method if all they wanted was the head.
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/44347955
linked to: http://stackoverflow.com/q/40480
upvote count: 7
has answer: http://stackoverflow.com/a/57483868
has answer: http://stackoverflow.com/a/26952613
type: Question
accepted answer: http://stackoverflow.com/a/26952567
has comment: http://stackoverflow.com/comment/42445703
has answer: http://stackoverflow.com/a/26952593
has answer: http://stackoverflow.com/a/26953028
has comment: http://stackoverflow.com/comment/42445699
has comment: http://stackoverflow.com/comment/42445710

http://stackoverflow.com/comment/42465697
type: Comment
has text: @hagubear: a correct answer is much better than a comment. Please fix it so I can up-vote it.
comment on: http://stackoverflow.com/q/26963828
score: 0
type: QuestionComment

http://stackoverflow.com/a/26871429
has body: If I understand you correctly, you want to request user input and create nodes in the GUI according to the input. You can't create loops respectively control structures in a fxml file, but you can dynamically add and remove nodes (i.e. TextFields) by defining a Vertical Box / Horizontal Box, &lt;VBox id="HBox" fx:id="myVBox" ...&gt; get the input as an integer, int sum = Integer.parseInt(textField.getText()); and add the nodes in a for-loop, for(int i=0, i&lt;sum, i++) { myVBox.getChildren().add(new TextField("executing time")); } and update the view. Hope it helps.
type: Answer
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26864159
answers question: http://stackoverflow.com/q/26864159
score: 0

named-query
type: Tag
tags question: http://stackoverflow.com/q/26899702
tag name: named-query

authentication
tags question: http://stackoverflow.com/q/26900029
tags question: http://stackoverflow.com/q/26920068
tags question: http://stackoverflow.com/q/26871466
tags question: http://stackoverflow.com/q/26984382
tag name: authentication
type: Tag
tags question: http://stackoverflow.com/q/26843316
tags question: http://stackoverflow.com/q/26948591
tags question: http://stackoverflow.com/q/26887934
tags question: http://stackoverflow.com/q/26859669
tags question: http://stackoverflow.com/q/26972035
tags question: http://stackoverflow.com/q/26906293
tags question: http://stackoverflow.com/q/26911844
tags question: http://stackoverflow.com/q/26926634
tags question: http://stackoverflow.com/q/26912953

http://stackoverflow.com/comment/42483639
comment on: http://stackoverflow.com/a/26974115
score: 0
type: AnswerComment
has text: @Karl Depends on what you actuallu want to do. There's not enough context (sic) in the question to offer specific guidance other than not to instantiate activities with `new`.
type: Comment

http://stackoverflow.com/a/26956350
upvote count: 8
has comment: http://stackoverflow.com/comment/42453777
has comment: http://stackoverflow.com/comment/42453819
has body: You can select all the links and transform their hrefs to absolute using Element.absUrl() Example in your code: EDIT (added processing of images) public static void main(String[] args) { String html = " The Title " + " "; Document doc = Jsoup.parse(html,"https://whatever.com"); Elements select = doc.select("a"); for (Element e : select){ // baseUri will be used by absUrl String absUrl = e.absUrl("href"); e.attr("href", absUrl); } //now we process the imgs select = doc.select("img"); for (Element e : select){ e.attr("src", e.absUrl("src")); } System.out.println(doc); }
type: Answer
accepted answer of: http://stackoverflow.com/q/26956258
answers question: http://stackoverflow.com/q/26956258
score: 8
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26919784
type: Answer
has body: I was able to get it! This blog post is exactly what I was trying to display: http://blog.ngopal.com.np/2011/10/19/dyanmic-tableview-data-from-database/
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26918167
has comment: http://stackoverflow.com/comment/43025763
answers question: http://stackoverflow.com/q/26918167

http://stackoverflow.com/a/26970915
answers question: http://stackoverflow.com/q/26970827
has body: Take the input; say you got N=5. Do a loop from 1 to N, and start a Thread in each iteration of your loop.
score: 0
has comment: http://stackoverflow.com/comment/42481568
type: Answer

http://stackoverflow.com/a/26839943
downvote count: 0
has body: First of all, I'm assuming that double sum = Math.pow(a,(1/root)); should be double sum = Math.pow(a,(1/n)); since there is no root variable in your code. Second of all, 1/n would give you 0 for every integer n > 1. Therefore sum would be 1.0. You should replace it with : double sum = Math.pow(a,(1.0/n)); or double sum = Math.pow(a,(1/(double)n)); In order to get a division of double variables.
score: 5
answers question: http://stackoverflow.com/q/26839890
upvote count: 5
type: Answer

http://stackoverflow.com/q/26842454
tagged with: mysql
type: Question
has body: I was having some difficulty when trying to do some logic in Java. When my map is on single tap, I will create a dialog box. If the user select okay from dialog box, I will then call another method to set value for object. Here are the codes: public void onSingleTap(float x, float y) { Event eventModelAdd = null; eventModelAdd = CreateEvent .createEventDialog(context, point.getX(), point.getY()); if (eventModelAdd != null) { new MyAsyncTask().execute(eventModelAdd); } } Then in the CreateEvent class: static Event addEventModel; public static Event createEventDialog(final Context context,final double x, final double y) { AlertDialog.Builder AddDialog = new AlertDialog.Builder(context); AddDialog.setTitle("Add Event"); LayoutInflater li = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View dialogView = li.inflate(R.layout.create_event, null); txtEventName = (EditText) dialogView.findViewById(R.id.txtEventName); txtEventDesc = (EditText) dialogView.findViewById(R.id.txtEventDesc); radioDiscussion = (RadioButton) dialogView .findViewById(R.id.radioDiscussion); AddDialog.setView(dialogView); AddDialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { addEventModel = new Event(); addEventModel = onConfirmAddEventClicked(context, x, y); dialog.dismiss(); } }); AddDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); } }); AddDialog.show(); return addEventModel; } public static Event onConfirmAddEventClicked(Context context, double x , double y) { Event eventModel = new Event(); // Set the value to Event object } return eventModel; } With these codes, it can perform DB insertion with no errors. But let's say I've successfully inserted a record into database, when I select another point on the map, and the dialog box pop up, and I select Cancel, the previous object reco…
linked to: http://stackoverflow.com/q/26865092
downvote count: 0
has answer: http://stackoverflow.com/a/26842539
tagged with: android
answer count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/6931168
linked to: http://stackoverflow.com/q/19662851
upvote count: 1
accepted answer: http://stackoverflow.com/a/26842539
type: AnsweredQuestion
tagged with: onclicklistener
tagged with: dialog
has title: Java Clearing Object upon Successful DB Insertion
score: 1
tagged with: java

http://stackoverflow.com/a/26881874
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Archetype maven-archetype-webapp is used for web applications and has folder like webapp, and maven-archetype-quickstart is a simple java project.
answers question: http://stackoverflow.com/q/26881813

http://stackoverflow.com/comment/42438484
has text: I didn't use any testing framework java for this case. I created a class with the values I wanted. I know Junit, I am going to try with It. do you advice me a better framework ?
score: 0
comment on: http://stackoverflow.com/q/26945143
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/79582866
type: Comment
has text: How is `Tile`'s `equals` method impemented?
type: QuestionComment
comment on: http://stackoverflow.com/q/26970339
score: 0

http://stackoverflow.com/q/26843951
has title: not working ccs style javafx -fx-strikethrough
accepted answer: http://stackoverflow.com/a/26855420
tagged with: css
type: AnsweredQuestion
upvote count: 2
possible better answer: http://stackoverflow.com/a/26844225
downvote count: 1
has answer: http://stackoverflow.com/a/26844225
type: Question
has body: I want to make text strikethrough using CSS. I use tag: button.setStyle("-fx-strikethrough: true;"); But this code is working, please help.
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/26855420
answer count: 2
score: 1
favorite count: 0

robovm
tags question: http://stackoverflow.com/q/26927425
type: Tag
tag name: robovm
tags question: http://stackoverflow.com/q/26845109

http://stackoverflow.com/comment/42256147
comment on: http://stackoverflow.com/q/26842909
type: QuestionComment
has text: Exactly. I figure there is some sort of Spring EL to handle this, but I can't find it.
score: 0
type: Comment

lambda
tags question: http://stackoverflow.com/q/26862874
tags question: http://stackoverflow.com/q/26913957
tags question: http://stackoverflow.com/q/26872827
tags question: http://stackoverflow.com/q/26915037
tag name: lambda
tags question: http://stackoverflow.com/q/26985390
tags question: http://stackoverflow.com/q/26920866
tags question: http://stackoverflow.com/q/26934042
type: Tag
tags question: http://stackoverflow.com/q/26970652
tags question: http://stackoverflow.com/q/26875226
tags question: http://stackoverflow.com/q/26927155

http://stackoverflow.com/comment/42341732
type: QuestionComment
has text: @ProllyGeek here is a fiddle link: http://jsfiddle.net/joe847/s5mptqph/ It does not seem to operate as it would on my site (selecting, the dropdowns, etc) Will this do?
comment on: http://stackoverflow.com/q/26877982
score: 0
type: Comment

http://stackoverflow.com/a/26908027
answers question: http://stackoverflow.com/q/26897819
type: Answer
has body: Many people are not fond of lenghty tutorials and while @Holger answered the question at hand, the real problem seems lack of understanding the general principles. Optimum concurrency benefits come from using all available ressources efficiently. This usually means adapting to the number of cores (ie not using more active threads than cores), making threads really independent from each other, and many other things. This can be achieved using ThreadPools, but one should understand what a thread pool does. A thorough answer would mean repeating most of it, therefore a good start is – as always – the official Java Concurrency Tutorial.
score: 0

http://stackoverflow.com/comment/42373240
type: AnswerComment
type: Comment
has text: Or `List<Transaction> transactions = new ArrayList<>();` for Java 7+
comment on: http://stackoverflow.com/a/26911813
score: 1

http://stackoverflow.com/a/26865817
downvote count: 0
answers question: http://stackoverflow.com/q/26865573
upvote count: 2
has body: The difference is due to the timezone. For example, in my case, given as the parameter the time that would be in an hour, I get 3H as output, because the date would be Thu Jan 01 03:00:00 EET 1970. Notice the EET (I'm from Eastern Europe). Your code would work if you'd notify java to use GMT time, as it says in the new Date(long) description: Allocates a Date object and initializes it to represent the specified number of milliseconds since the standard base time known as "the epoch", namely January 1, 1970, 00:00:00 GMT. Also, keep in mind that Date does not give perfect results. Using programatically determined dates exactly 1h appart (no millies / minutes difference), date calculations give an offset of 59 minutes, 59 seconds and 999 milies. If you require more exact values, you should use nanoseconds. However, the other commenters are right. You should not use Java Date / Calendar in such a way, as it is a bug factory (this is only one corner case). You should check out other libraries (such as yoda time), or if you only need simple calculations such as this, do it yourself. Hope it helps.
type: Answer
score: 2

http://stackoverflow.com/q/26955430
has comment: http://stackoverflow.com/comment/42450916
has answer: http://stackoverflow.com/a/26955492
tagged with: compiler-errors
type: UnansweredQuestion
upvote count: 1
type: Question
has title: How to cast an Object at runtime in Java when a button is clicked
tagged with: java
score: -3
has body: So I need to know how to cast an parent class to a subclass during runtime (or some other way to point to one of 4 tools available). I have a paint program with 4 tools that are subclassed from my parent tool class "DrawingTool" class. I have a field in my class that extends JPanel for my "canvas" to hold myCurrentTool that will need to change based on the JToggleButton the user currently has selected. I am setting it up so my Action Listener changes to the correct tool when the button is selected. So when a specific button is active the paint method will be calling on that field and it needs to use the overridden methods for whatever specific subclass it should be referencing. I have tried myCurrentTool = myTool, no go. Cant figure out how to cast it without a compile error (hopefully I just don't know the syntax for this. Any suggestions would be great. Here are some snippets of code. My code is separated into 9 different classes so this is little relevant chunks from wherever. public DrawingAction(final String theName, final Icon theIcon, final DrawingTool theTool, final int theKey) { super(theName, theIcon); putValue(Action.SHORT_DESCRIPTION, theName + " background"); putValue(Action.SELECTED_KEY, true); putValue(Action.MNEMONIC_KEY, theKey); myTool = theTool; } ... myDrawingActions `enter code here`= new ArrayList&lt;DrawingAction&gt;(); myDrawingActions.add(new DrawingAction("Pencil", new ImageIcon("icons\\pencil.gif"), new PencilTool(), KeyEvent.VK_L)); myDrawingActions.add(new DrawingAction("Line", new ImageIcon("icons\\line.gif"), new LineTool(), KeyEvent.VK_L)); myDrawingActions.add(new DrawingAction("Rectangle", new ImageIcon("icons\\rectangle.gif"), new RectangleTool(), KeyEvent.VK_R)); myDrawingActions.add(new DrawingAction("Ellipse", new ImageIcon("icons\\ellipse.gif"), new EllipseTool(), KeyEvent.VK_E)); ... public void paintComponent(final Graphics theGraphics) { super.paintComponent(theGraphics); final Graphics2D g2 = (Graphics2D) theGraphics; g2.se…
has comment: http://stackoverflow.com/comment/42450934
downvote count: 4
has comment: http://stackoverflow.com/comment/42450600
tagged with: casting
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/42450518

date
tags question: http://stackoverflow.com/q/26983078
tags question: http://stackoverflow.com/q/26979786
tag name: date
tags question: http://stackoverflow.com/q/26913049
tags question: http://stackoverflow.com/q/26899550
tags question: http://stackoverflow.com/q/26952959
tags question: http://stackoverflow.com/q/26936932
tags question: http://stackoverflow.com/q/26858419
tags question: http://stackoverflow.com/q/26962431
tags question: http://stackoverflow.com/q/26967476
tags question: http://stackoverflow.com/q/26987487
tags question: http://stackoverflow.com/q/26983579
tags question: http://stackoverflow.com/q/26924799
tags question: http://stackoverflow.com/q/26943571
tags question: http://stackoverflow.com/q/26931509
tags question: http://stackoverflow.com/q/26976386
tags question: http://stackoverflow.com/q/26961587
tags question: http://stackoverflow.com/q/26842075
type: Tag
tags question: http://stackoverflow.com/q/26906297
tags question: http://stackoverflow.com/q/26967454
tags question: http://stackoverflow.com/q/26859158
tags question: http://stackoverflow.com/q/26858679
tags question: http://stackoverflow.com/q/26883454
tags question: http://stackoverflow.com/q/26883839
tags question: http://stackoverflow.com/q/26979822
tags question: http://stackoverflow.com/q/26837640
tags question: http://stackoverflow.com/q/26863012
tags question: http://stackoverflow.com/q/26991163
tags question: http://stackoverflow.com/q/26965517
tags question: http://stackoverflow.com/q/26858335
tags question: http://stackoverflow.com/q/26953077
tags question: http://stackoverflow.com/q/26920335
tags question: http://stackoverflow.com/q/26924952
tags question: http://stackoverflow.com/q/26932332
tags question: http://stackoverflow.com/q/26842063
tags question: http://stackoverflow.com/q/26944148
tags question: http://stackoverflow.com/q/26927167
tags question: http://stackoverflow.com/q/26968205
tags question: http://stackoverflow.com/q/26983509

http://stackoverflow.com/a/26930253
has comment: http://stackoverflow.com/comment/42407159
upvote count: 3
has comment: http://stackoverflow.com/comment/42405913
has comment: http://stackoverflow.com/comment/42406158
has comment: http://stackoverflow.com/comment/42407372
type: Answer
has body: The difference between Integer.toString() and Integer.toString(int) is that the latter is a static method, and therefore can be called for a primitive variable. The former is an instance method, and can only be called on a reference type. String.valueOf(Object) is different than the toString() instance methods, since String.valueOf(null) would return "null", while null.toString() would throw a NullPointerException. Integer.toString(int) will also throw a NullPointerException when pass a null Integer reference, since the attempt to unbox that Integer would result in that exception. Therefore, if you have an Integer i variable, String.valueOf(i) will behave differently than i.toString() and Integer.toString(i) when i is null.
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/42408043
answers question: http://stackoverflow.com/q/26930034
has comment: http://stackoverflow.com/comment/42408752
has comment: http://stackoverflow.com/comment/42406040
has comment: http://stackoverflow.com/comment/42407677

casting
tags question: http://stackoverflow.com/q/26844322
tags question: http://stackoverflow.com/q/26975700
tags question: http://stackoverflow.com/q/26889659
tags question: http://stackoverflow.com/q/26955430
tag name: casting
type: Tag
tags question: http://stackoverflow.com/q/26957492
tags question: http://stackoverflow.com/q/26930034
tags question: http://stackoverflow.com/q/26979602
tags question: http://stackoverflow.com/q/26945902
tags question: http://stackoverflow.com/q/26879033
tags question: http://stackoverflow.com/q/26882458

http://stackoverflow.com/a/26885667
accepted answer of: http://stackoverflow.com/q/26876977
answers question: http://stackoverflow.com/q/26876977
score: 4
has comment: http://stackoverflow.com/comment/42475261
has body: Indeed, it seems there is a mismatch between the randomizedtesting jar Lucene uses and the one ES uses. Try this in your pom.xml: org.apache.lucene lucene-test-framework 4.10.2 test randomizedtesting-runner com.carrotsearch.randomizedtesting org.elasticsearch elasticsearch 1.4.0 test test-jar org.elasticsearch elasticsearch 1.4.0 test com.carrotsearch.randomizedtesting randomizedtesting-runner 2.1.10 test
type: AcceptedAnswer
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/26839807
has body: I would use DateUtils.truncate(date, Calendar.SECOND)
downvote count: 0
answers question: http://stackoverflow.com/q/26839669
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/29089184
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26926571
upvote count: 1
has body: I encountered the same issue yesterday. I checked the syslog for the particular map task which was failing, which suggested that I was getting another exception in that task which was triggering this error. In my case this was an invalid parsing, and when I corrected that issue, this error was fixed. Closer examination of the log for the failed task should give you the root cause for the issue.
score: 1

http://stackoverflow.com/q/26862732
has title: Can I make a synchronous/blocking call via RabbitMQ using Spring Integration?
has body: Imagine I have two Java apps, A and B, using Spring Integration's RabbitMQ support for communication. Can I make a synchronous/blocking call from A to B? If so, how (roughly)? Ideally, A has a Spring Integration Gateway which it invokes via e.g. a method called Object doSomething(Object param) Then it blocks while the Gateway sends on the message via RabbitMQ to a ServiceActivator on B, and B returns the return value, which eventually becomes the result of the doSomething() method. It seems this may be possible, but the docs and other Stack Overflow questions don't seem to address this directly. Many thanks!
upvote count: 1
favorite count: 0
downvote count: 0
tagged with: spring
tagged with: rabbitmq
type: AnsweredQuestion
tagged with: spring-integration
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26863090
accepted answer: http://stackoverflow.com/a/26863090
answer count: 1

http://stackoverflow.com/q/26974251
tagged with: java
linked to: http://stackoverflow.com/q/4159802
has comment: http://stackoverflow.com/comment/42483720
type: Question
has answer: http://stackoverflow.com/a/26974330
score: 0
has answer: http://stackoverflow.com/a/26974381
answer count: 2
has body: I want to restart the program after throwing an exception this my code System.out.println("please enter an intger to compute its factorial:"); BufferedReader bufferedreader = new BufferedReader( new InputStreamReader(System.in)); String number =""; try { try { number = bufferedreader.readLine(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } intN=Integer.parseInt(number); if (intN &gt; 0) { // from the command line FactorialIter f = new FactorialIter(Math.abs(intN)); } } catch (NumberFormatException e) { // TODO Auto-generated catch block System.out.println("error you should enter a number"); throw new MyExceptions("try again please use integer numbers"); //if possible to restart the main } so when ever the user enters a character the program will throws an exception and then restarts is this possible??
tagged with: exception
type: UnansweredQuestion
has title: Calling the main for another try after throwing an exception

http://stackoverflow.com/q/26975394
tagged with: apache-camel
accepted answer: http://stackoverflow.com/a/26976591
tagged with: apache
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has body: Does anyone know how to write this camel route snippet in blueprint xml's sytax? .setHeader("headerName").method(beanInstance, "methodToGetHeaderValue") I assume it's something like this but I can't get the exact syntax down. &lt;setHeader headerName="theHeader"&gt; &lt;bean id="beanId" ref="MyBean" method="BeanMethod"/&gt; &lt;/setHeader&gt; Thanks!
has answer: http://stackoverflow.com/a/26976591
upvote count: 1
type: Question
has title: Translate this camel route snippet from Java DSL to Blueprint xml
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/26911675
answer count: 0
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/42373064
tagged with: java
has comment: http://stackoverflow.com/comment/42373128
type: Question
score: 0
has body: I am trying to draw a circle with a letter in the center of it, which can be entered by the user. Below is the drawing function, but it's not working. (I have to draw a automata state ) private void doDrawingNew(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); String nam; float cx,cy; final Font f = new Font("SansSerif", Font.BOLD, 18); JFrame frame = new JFrame("InputDialog Example #1"); for (int i = 0; i &lt; mylist.size(); i++) { GCircle obj = mylist.get(i); nam = obj.getName(); if (nam == null) { nam = JOptionPane.showInputDialog(frame, "What's your name?"); obj.setName(nam); } cx=(float)obj.getX(); cy=(float)obj.getY(); cx=+40; cy=+40; g2d.setColor(new Color(0, 200, 0)); g2d.fill(obj); g2d.setColor(Color.red); g2d.setFont(f); g2d.drawString(nam, cx, cy); } }
has title: How to draw a automata state, circle containing a letter in it using java swing

http://stackoverflow.com/comment/42445393
score: 0
type: QuestionComment
type: Comment
has text: Please provide stacktrace.
comment on: http://stackoverflow.com/q/26952300

http://stackoverflow.com/a/26857709
has comment: http://stackoverflow.com/comment/42277335
has comment: http://stackoverflow.com/comment/42279084
has body: You have a maven project so the User.hbm.xml should be inside src/main/resources/ instead of src/main/java When you build a maven project then it compiles are the .java files present in src/main/java and it will not consider any other files which are present in this directory. So the maven project has a folder structure src/main/resources where you can place all your configuration files like .xml, .properties etc. So when you build the maven project then it will compile all the java files from src/main/resources and places the .class files in classpath and also maven will copy all the resources from src/main/resources and places them in classpath. So when you run the application then the configuration files will also available in classpath. But if you just place the configuration files in src/main/java then maven will just ignore them so they will not be available in classpath. But if the project you are working on is a simple java project instead of maven project then the code setup mentioned in your question will work without any issues even when you have the configuration files in src/main/java. Hope this explanation helps. To make sure the maven project is build properly you can verify by opening the directory target/classes/ and then the path to your configuration files. So, to sum up all this information, here's what you need to do: Creat a package structure in /src/main/resources that mimics the one in /src/main/java - that is, create the net.codejava.spring.model package in /src/main/resources and place User.hbm.xml in there. After running a Maven clean package (or some other build goal) command, the User.hbm.xml file will be in it's correct location (which is not shown in the picture below) - /target/SpringMvcHibernateXML-1.0.0-BUILD-SNAPSHOT/WEB-INF/classes/net/codejava/spring/model/User.hbm.xml. Ultimately, after building in Maven, the project should look like this:
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26857086
type: Answer
answers question: http://stackoverflow.com/q/26857086
score: 1
has comment: http://stackoverflow.com/comment/42279189
has comment: http://stackoverflow.com/comment/42278864
has comment: http://stackoverflow.com/comment/42278954
upvote count: 1
has comment: http://stackoverflow.com/comment/42279248
has comment: http://stackoverflow.com/comment/42278387

http://stackoverflow.com/comment/42356901
score: 0
type: AnswerComment
type: Comment
has text: thanks for ur comments........i got the ans from here....(http://www.dreamincode.net/forums/topic/328935-simple-regression-library-part-2-linear-regression-model/)
comment on: http://stackoverflow.com/a/26887830

http://stackoverflow.com/comment/42459293
score: 0
type: Comment
type: QuestionComment
has text: Your class `Mandate` doesn't override `toString()`. Is `s.results` an instance of `Mandate`?
comment on: http://stackoverflow.com/q/26959140

http://stackoverflow.com/a/26908469
upvote count: 2
score: 2
has body: If You want a standalone application, that is impossible. You should rather load context in Your main method, and just run a specific bean's method (treat main method only as an entry point to Your app).
accepted answer of: http://stackoverflow.com/q/26907529
answers question: http://stackoverflow.com/q/26907529
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/42433872
type: AnswerComment
has text: @MindDots: I don't really understand what you mean. Also I fail to find where you try to print out the values. Maybe you need to share more code. Do you have any getters on the object on which you are trying to print whatever it is you're trying to print out?
type: Comment
comment on: http://stackoverflow.com/a/26945469
score: 0

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/26967814

http://stackoverflow.com/comment/42237790
type: AnswerComment
comment on: http://stackoverflow.com/a/26836004
score: 0
type: Comment
has text: how come? if one thread enters the synchronized block shouldn't it be locked?

http://stackoverflow.com/a/26834568
has comment: http://stackoverflow.com/comment/42235364
has body: Try to convert your charSequence to String with charSequence.toString() Or use CharSequence for your array private CharSequence[] randomSpanishWords = { "pueblo", "madre" };
accepted answer of: http://stackoverflow.com/q/26834485
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/26834485
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/a/26991320
accepted answer of: http://stackoverflow.com/q/26991207
has body: if(status){ currentStatus.setText("Current status: Fine."); status = false; }else { currentStatus.setText("Current status: In need of help!"); status = true } or using ternary operator : currentStatus.setText(status ? "Current status: Fine." : "Current status: In need of help!"); status = !status;//toggle boolean value
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42514321
has comment: http://stackoverflow.com/comment/42514649
answers question: http://stackoverflow.com/q/26991207
type: Answer

http://stackoverflow.com/comment/42465549
score: 1
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/26963673
has text: Have you tried stepping through the code in a debugger?

http://stackoverflow.com/comment/42279135
comment on: http://stackoverflow.com/q/26858993
type: QuestionComment
has text: try to read output of this line `Log.e("JSON", json);` in your jsonparser class wheather it's json format ?
score: 0
type: Comment

http://stackoverflow.com/q/26949118
has title: Is there a way to inverse/inverse an ImmutableMap
downvote count: 0
has answer: http://stackoverflow.com/a/26949247
has comment: http://stackoverflow.com/comment/42439863
answer count: 1
has comment: http://stackoverflow.com/comment/42439889
favorite count: 0
upvote count: 2
accepted answer: http://stackoverflow.com/a/26949247
type: AnsweredQuestion
score: 2
tagged with: guava
tagged with: java
type: Question
has body: Given an ImmutableMap&lt;K,V&gt; where values are non-unique, is there a way to invert / inverse / pivot this to an ImmutableMap like collection that allows for multiple keys? I would assume that it would end up being an ImmutableSetMultiMap&lt;V,K&gt; I was previously using an ImmutableSetMultiMap&lt;K,V&gt; but realized that it allowed multiple keys, which could be a possible source of bugs in the future. This also renders a ImmutableBiMap useless, as there could be non-unique values.

http://stackoverflow.com/a/26967970
type: Answer
answers question: http://stackoverflow.com/q/26967924
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The compiler knows that 90 is a valid value for char. However, System.in.read() can return any int, which may be out of the valid range for chars. If you change 90 to 90000, the code won't compile: char ch; ch = 90000;
accepted answer of: http://stackoverflow.com/q/26967924
upvote count: 2

http://stackoverflow.com/comment/42532982
comment on: http://stackoverflow.com/a/26987756
score: 0
type: AnswerComment
type: Comment
has text: Amazing! It works great! I just have to ask, because I want to understand. When you set the Array list with private java.util.List<SkeletonHand> hands = new java.util.ArrayList<>(25); The (25) is that the limit for the array? I just ran it and added well over 25 SkeletonHands which is why I ask, or is it just a reference for a sample size, and does the array increment itself when a new one over the limit is added?

http://stackoverflow.com/q/26904554
has answer: http://stackoverflow.com/a/26904681
has comment: http://stackoverflow.com/comment/56942377
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/26914471
has body: I'm working with a Java project in Intellij IDEA where we have a lot of internal, standalone, Maven dependencies. I have the source code for these dependencies imported into my IDEA project as modules, but when I select Go To -> Implementation(s) on a class that is part of an internal Maven dependency (and that I have also imported as a module in my project) I'm navigated to a decompiled view of the class in the Maven dependency (jar) and not the source code file of that class that I imported as a module. To solve this I need to do the following: Open Module Settings on the module using the internal Maven dependency Find and remove the internal Maven module in the Dependencies list Add a new Module Dependency and then select the imported module that corresponds to the internal Maven dependency Is there any way to have IDEA figuring out this automatically or do I have to do this manual procedure over and over?
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/42490189
has comment: http://stackoverflow.com/comment/53280010
tagged with: java
score: 10
has title: Can Intellij IDEA automatically replace Maven dependencies with module dependencies?
upvote count: 10
has answer: http://stackoverflow.com/a/26906660
type: Question
tagged with: intellij-idea
downvote count: 0

http://stackoverflow.com/comment/42396035
type: QuestionComment
score: 2
has text: And why should it roll back... You are opening new sessions yourself and managing transactions yourself also. How should Spring know that.
comment on: http://stackoverflow.com/q/26924569
type: Comment

http://stackoverflow.com/q/26976310
answer count: 1
favorite count: 0
tagged with: android-asynctask
type: UnansweredQuestion
tagged with: android
tagged with: apk
tagged with: installation
downvote count: 0
linked to: http://stackoverflow.com/q/15213211
score: 1
type: Question
tagged with: java
has body: I am trying to write a function to update my android app without google play from within the app. I based my code very heavily off of the answer from this stackoverflow question. I've been able to fix most of the problems that have occurred but I'm now getting "Parse Error: There is a problem parsing the package". I've looked around for answers to this problem and I feel I have eliminated the obvious responses as the cause. I know the package is not corrupted because I ran my app in an emulator then used the monitor to get the apk file from the data/data location, uploaded the apk to my website, then downloaded the apk on my phone, and installed it from the download manager and it worked. Here is the code: MainActivity calls asynctask that checks if the current version is equivalent to the most recent version online. public class MainActivity extends Activity { ListView list; //private ProgressBar pb; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //pb.setVisibility(View.VISIBLE); int v = 0; try { v = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { // Huh? Really? } new CheckUpdates(this).execute(v); } } If there is a newer version then it calls the InstallUpdate asynctask. private class CheckUpdates extends AsyncTask&lt;Integer, Integer, String&gt;{ private Context mContext; private ProgressDialog pdia; public CheckUpdates (Context c) { this.mContext = c; } @Override protected void onPreExecute(){ super.onPreExecute(); pdia = new ProgressDialog(mContext); pdia.setMessage("Checking for update..."); pdia.show(); } @Override protected String doInBackground(Integer... params) { return postData(params[0]); } @Override protected void onPostExecute(final String responseString){ pdia.dismiss(); if (!responseString.equals("")) { AlertDialog dialog = new AlertDialog.Builder(mContext).create(); dialog.setTitle("Con…
has answer: http://stackoverflow.com/a/28233161
has comment: http://stackoverflow.com/comment/54063380
upvote count: 1
has title: Parsing Error when updating apk from within android app

http://stackoverflow.com/comment/42385802
score: 1
has text: [This answer](http://stackoverflow.com/a/10089138/524900) shows how to hide columns of a JTable. No need for a custom `ColumnTableModel`. All you need to do is remove the columns from the default `TableColumnModel`, this does _not_ remove them from the `TableModel`, thus you shouldn't need to call `fireTableStructureChanged()`.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26918590

http://stackoverflow.com/comment/42410411
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/26932172
has text: @Joeblade ahh right!!! Now I understand it. In fact, fixing the code (inverting) and now works perfectly. thanks a lot!!!
score: 0

http://stackoverflow.com/q/26861079
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has body: The purpose of this problem is to verify whether the method you are using to read input data is sufficiently fast to handle problems branded with the enormous Input/Output warning. You are expected to be able to process at least 2.5MB of input data per second at runtime. http://www.codechef.com/problems/INTEST/ Input The input begins with two positive integers n k (n, k&lt;=107). The next n lines of input contain one positive integer ti, not greater than 109, each. Output Write a single integer to output, denoting how many integers ti are divisible by k. Example Input: 7 3 1 51 966369 7 9 999996 11 Output: 4 And i have solution which is :- import java.io.*; class Main { public static void main(String[] args) throws IOException { int ans = 0; int count = 0, n = 0, in = 0, data = 0; byte[] b = new byte[1024]; InputStream is = null; try { is = new FileInputStream("G://test1.txt"); } catch (Exception e) { System.out.println(e); } while ((in = is.read()) != ' ') count = count * 10 + in - '0'; // how does this line work ? while ((in = is.read()) != '\n') n = n * 10 + in - '0'; for (int i = 0; i &lt; count; i++) { in = is.read(b, 0, 1024); if (in == -1) { break; } for (int j = 0; j &lt; in; j++) { if (b[j] != '\n') { data = data * 10 + b[j] - '0'; } else { if (data % n == 0) ans++; data = 0; } } } System.out.println(ans + "ans"); } } count = count * 10 + in - '0'; // how does this line work ?
has title: "codeChef INTEST" not getting 1 line in solution
upvote count: 1
answer count: 1
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/27001267
accepted answer: http://stackoverflow.com/a/27001267

http://stackoverflow.com/comment/130562113
comment on: http://stackoverflow.com/a/49793605
type: AnswerComment
score: 0
has text: @Arefe this is redundant but this fix the "autowired not found" error. It seems to be an intellij bug.... I've put this annotation on another class than the `@SpringBootApplication` to fix all errors
type: Comment

http://stackoverflow.com/a/57789419
has comment: http://stackoverflow.com/comment/133549292
score: 1
upvote count: 2
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/26904955
has body: In case you needed Kotlin version with few upgrades, here it is: class AlertDialogFragment : DialogFragment() { companion object { internal fun newInstance( exampleParameter: String, listener: AlertDialogListener? = null ) = AlertDialogFragment().apply { this.arguments = Bundle().apply { this.putString(EXAMPLE_PARAMETER, exampleParameter) this.putParcelable(ALERT_LISTENER, listener) } } interface AlertDialogListener: Parcelable { fun primaryActionClicked() fun secondaryActionClicked() { /* nop */ } override fun describeContents(): Int = 0 override fun writeToParcel(dest: Parcel, flags: Int) { /* nop */ } } const val EXAMPLE_PARAMETER = "example_parameter" const val ALERT_LISTENER = "alert_listener" } private var listener: AlertDialogListener? = null override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { return inflater.inflate(R.layout.dialog_alert, container, false) } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { initListeners() initExampleParameter() } private fun initListeners() { val listener = arguments!!.getParcelable&lt;AlertDialogListener&gt;(ALERT_LISTENER) if (listener != null) { this.listener = listener } } private fun initExampleParameter() { example_view.text = arguments!!.getString(EXAMPLE_PARAMETER)!! example_view.setOnClickListener { listener?.primaryActionClicked() dismiss() } } } Then you start it this way: AlertDialogFragment.newInstance( getString(R.string.example_parameter), object : AlertDialogFragment.Companion.AlertDialogListener { override fun primaryActionClicked() { // DO SOMETHING ABOUT THE ACTION } } ).show(childFragmentManager, AlertDialogFragment::class.java.name) You might also want to ignore the listener parameter in case you only need to inform user about something that happened. Happy coding!

http://stackoverflow.com/comment/42443421
score: 1
has text: [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing?](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi)
type: AnswerComment
comment on: http://stackoverflow.com/a/26951235
type: Comment

http://stackoverflow.com/comment/42263488
type: Comment
type: QuestionComment
score: 1
has text: What is your understanding of "Wrapper" in this context? could you give us an example?
comment on: http://stackoverflow.com/q/26850261

http://stackoverflow.com/comment/61018098
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/26901852
has text: "I usually make my UriMatcher instance static" why?
type: Comment

http://stackoverflow.com/a/26878143
answers question: http://stackoverflow.com/q/26875840
downvote count: 0
has body: The thing is, your template expressions have ambiguous paths. After the three main sorting keys [1], the path is still ambiguous. URIs don't know about types. Everything is the URI (and during URI matching) is a String. The template expression values will later get converted to our method parameter types (if it is a convertible type [2]). That being said, a way you can disambiguate the two is by using regular expression for the template. For example @Path("/{date: \\d{2}-\\d{2}-\\d{4}}") public Response getPartnerInteractionsByDate @Path("/{interactionId: \\d{10}}") public Response getPartnerInteraction This is assuming dates com in MM-DD-YYYY format and interaction ids are ten digits. This is just an example, but shows how you can make it work. If there are absolutely no regex patterns that can match the URIs, then you will need to change the path (add a part to one of them) to disambiguate. [1] The primary key of the sort is the number of literal characters in the full URI matching pattern. The secondary key of the sort is the number of template expressions embedded within the pattern The tertiary key of the sort is the number of nondefault template expressions. A default template expression is one that does not define a regular expression [2] It is a primitive type. The int, short, float, double, byte, char, and boolean types all fit into this category. It is a Java class that has a constructor with a single String parameter. It is a Java class that has a static method named valueOf() that takes a single String argument and returns an instance of the class. It is a java.util.List&lt;T&gt;, java.util.Set&lt;T&gt;, or java.util.SortedSet&lt;T&gt;, where T is a type that satisfies criteria 2 or 3 or is a String.
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42344864
upvote count: 2

http://stackoverflow.com/a/26962941
score: 5
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/26962867
downvote count: 0
answers question: http://stackoverflow.com/q/26962867
has body: Use java's String#replaceAll() method to replace with blank (ie "delete") the target chars: str = str.replaceAll("(?i)^[a-z]+|[a-z]+$", ""); The regex means "ignoring case, match letters immediately after start or immediately before end"

http://stackoverflow.com/q/26910547
has title: How don't duplicate the dataSource in Spring xml files?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/26910905
has comment: http://stackoverflow.com/comment/42371243
has comment: http://stackoverflow.com/comment/42370813
has comment: http://stackoverflow.com/comment/42371519
tagged with: spring
has body: I have two files which contain the dataSource definitions. There are /WEB-INF/applicationContext.xml and src/main/resources/hibernateContext.xml it's my dataSource definition: &lt;bean id="dataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost/fullproject" p:username="root" p:password="admin" /&gt; This definition is necessary in every file for using with different services; Can i don't duplicate this code and only definite it only in one place????
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/26910579
accepted answer: http://stackoverflow.com/a/26910579
type: AnsweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/42372723
tagged with: java
has comment: http://stackoverflow.com/comment/42371196
possible better answer: http://stackoverflow.com/a/26910905

http://stackoverflow.com/a/26889627
score: 0
has comment: http://stackoverflow.com/comment/42337019
type: Answer
has comment: http://stackoverflow.com/comment/42347245
has body: First add a check to see if the phone is connected to a Netwerk. You can do this using the following code; public boolean isNetwork() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo != null &amp;&amp; netInfo.isConnectedOrConnecting(); } if (isNetwork()) { // do your request &amp;&amp; server ping !! } else { Toast.makeText(this, "Not connected to a network", Toast.LENGTH_SHORT).show(); } Also add the following permission to the AndroidManifest.xml: &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; However, it can return a false positive for example, if the phone is connected to a WiFi network with a captive portal or vpn, this function will incorrectly return true. That's why you still need to check if you have internet, you can do this by adding a simple ping to your server or Google (Because Google is up 99,99% of the time). Something like this; public boolean isNetwork() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo netInfo = cm.getActiveNetworkInfo(); return netInfo != null &amp;&amp; netInfo.isConnectedOrConnecting(); } public Boolean isInternet() { try { Process process = java.lang.Runtime.getRuntime().exec("ping -c 1 www.google.com"); int returnVal = process.waitFor(); boolean reachable = (returnVal==0); return reachable } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; } if (isNetwork()) { if (isInternet()) { // do your request } else { Toast.makeText(this, "No internet connection", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this, "Not connected to a network", Toast.LENGTH_SHORT).show(); } Finally dont forget, when you're doing a async tasks, you update the GUI in the onPostExecute Method. You dont call the runOnUiThread() …
answers question: http://stackoverflow.com/q/26889274

http://stackoverflow.com/comment/42380705
comment on: http://stackoverflow.com/a/26914475
has text: Although Saxon supports the javax.xml.xpath API, it also has its own s9api API which is much more convenient for simple tasks like defining a namespace binding: `xPathCompiler.declareNamespace(prefix, uri)`. See http://www.saxonica.com/documentation/#!javadoc/net.sf.saxon.s9api/XPathCompiler
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/26944318
has comment: http://stackoverflow.com/comment/42431515
answer count: 0
tagged with: java
score: 0
tagged with: garbage-collection
has title: Android XML increases the Garbage collector limit till max size and hangs the environment
type: Question
has body: I am working on android development. Recently i have also increases ADT Heap Size to 1024. When ever i start working on XML which includes more than 10 TextViews,EditText or other view, Garbage Collector increases till its max limit, and then hangs and slows my Eclipse environment and it will be very difficult for working. For example 1001/1083 ratio in garbage collector. My system config is 4 GB Ram, Core i3 Ultrabook. Thanks in advance.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/42432134
has comment: http://stackoverflow.com/comment/42432162
has comment: http://stackoverflow.com/comment/42432103
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/comment/42402152
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26924219
has text: @MelbinMathew Put in both, not one or the other.
score: 0

http://stackoverflow.com/a/26893345
type: Answer
has comment: http://stackoverflow.com/comment/42345376
downvote count: 0
score: 1
has body: Add the border in paintThumb(), after the image has been scaled by drawImage(). Starting from the original and using Color.red for emphasis, the result is seen below: @Override protected void paintThumb(Graphics g, JComponent c, Rectangle r) { g.setColor(Color.blue); Graphics2D g2d = (Graphics2D) g; g2d.drawImage(imageThumb, r.x, r.y, r.width, r.height, null); g2d.setPaint(Color.red); g2d.drawRect(r.x, r.y, r.width - 1, r.height); }
has comment: http://stackoverflow.com/comment/42345240
has comment: http://stackoverflow.com/comment/42362035
has comment: http://stackoverflow.com/comment/42345293
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26881056
answers question: http://stackoverflow.com/q/26881056

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/26838821

http://stackoverflow.com/comment/42395046
type: Comment
type: QuestionComment
has text: What do you mean by "controller". What does the 'instance' command gives you after the reconfiguration ?
score: 0
comment on: http://stackoverflow.com/q/26910143

http://stackoverflow.com/comment/42249338
type: Comment
has text: @Baz Yes, I know that a SWT Tree can have more than one "root" that are of type TreeItem. But in my case there is already a lot of trees with own listeners, menus (some of them allow single selection and some don't) that I don't want to rework and combine them into a single SWT tree. I find it easier to make them look like a singe SWT tree.
score: 0
comment on: http://stackoverflow.com/q/26840296
type: QuestionComment

http://stackoverflow.com/q/26918737
tagged with: generics
type: AnsweredQuestion
has title: Custom Generic LinkedList with Inner Nodes and Iterator in Java: Type Confusion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26918773
accepted answer: http://stackoverflow.com/a/26918773
linked to: http://stackoverflow.com/q/17375417
score: 0
tagged with: iterator
has body: I thought I was getting the hang of generics until I came across this (a basic implementation of a Generic LinkedList with inner Node and Iterator classes. A clipped version of code linked pasted below). Q: Why is it that we have LinkedListIterator and not LinkedListIterator&lt;AnyType&gt; A: See answer here. Fine. Makes sense. But then, Q: Why is it that we have Node&lt;AnyType&gt; and not Node? Since the Node class is also within the scope of LinkedList, from the last answer, I would expect that Node also would not require in its definition. public class LinkedList&lt;AnyType&gt; implements Iterable&lt;AnyType&gt; { private Node&lt;AnyType&gt; head; //... private static class Node&lt;AnyType&gt; { private AnyType data; private Node&lt;AnyType&gt; next; public Node(AnyType data, Node&lt;AnyType&gt; next) { this.data = data; this.next = next; } } public Iterator&lt;AnyType&gt; iterator() { return new LinkedListIterator(); } private class LinkedListIterator implements Iterator&lt;AnyType&gt; { private Node&lt;AnyType&gt; nextNode; public LinkedListIterator() { nextNode = head; } //...
answer count: 1

http://stackoverflow.com/a/26986658
upvote count: 11
answers question: http://stackoverflow.com/q/26986162
has comment: http://stackoverflow.com/comment/42506636
has comment: http://stackoverflow.com/comment/42507894
score: 11
has body: The reason you see rapid convergence is that your methodology for "mating" is not very good. You are always producing two offspring from "mating" of the top two scoring individuals. Imagine what happens when one of the new offspring is the same as your top individual (by chance, no crossover and no mutation, or at least none that have an effect on the fitness). Once this occurs, the top two individuals are identical which eliminates the effectiveness of crossover. A more typical approach is to replace EVERY individual on every generation. There are lots of possible variations here, but you might do a random choice of two parents weighted fitness. Regarding population size: I don't know how hard of a problem sudoku is given your genetic representation and fitness function, but I suggest that you think about millions of individuals, not dozens. If you are working on really hard problems, genetic algorithms are much more effective when you place your population on a 2-D grid and choosing "parents" for each point in the grid from the nearby individuals. You will get local convergence, but each locality will have converged on different solutions; you get a huge amount of variation produced from the borders between the locally-converged areas of the grid. Another technique you might think about is running to convergence from random populations many times and store the top individual from each run. After you build up a bunch of different local minima genomes, build a new random population from those top individuals.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/42509297
has comment: http://stackoverflow.com/comment/42507885
type: Answer
has comment: http://stackoverflow.com/comment/42509377
accepted answer of: http://stackoverflow.com/q/26986162

http://stackoverflow.com/a/26893449
has comment: http://stackoverflow.com/comment/42351244
type: AcceptedAnswer
score: 0
has body: I don't experience the warning described above on my emulator. It's probably just your emulator is slow. Here is my emulator detail CPU/ABI: Intel Atom (x86) Target: Android 4.0.3 (API level 15) Skin: 320x480 SD Card: 200M hw.lcd.density: 160 disk.dataPartition.size: 200M hw.gpu.enabled: yes hw.ramSize: 512 tag.display: Default hw.sdCard: yes hw.device.manufacturer: Generic hw.device.name: 3.2in QVGA (ADP2) vm.heapSize: 16 And I suggest you to run your app on an x86 image with Using host GPU option turned on, and then see if the warning still comes up.
type: Answer
accepted answer of: http://stackoverflow.com/q/26891861
answers question: http://stackoverflow.com/q/26891861
has comment: http://stackoverflow.com/comment/42344434

http://stackoverflow.com/a/26917020
score: 3
type: Answer
has body: You can use String formattedInteger = NumberFormat.getNumberInstance(Locale.US).format(bigInteger); or you can write your own. It would be pretty simple, just convert your BigInteger to a String then loop through it backwards and every 3rd character you pass add a comma.
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/26916958

http://stackoverflow.com/a/26871389
type: Answer
has body: You don't need to close a 'connection", as there's no such thing as a continuous connection to S3 when using AmazonS3Client. The AWS java SDK send REST requests to S3, where REST is stateless, for each REST request, it will be signed with the user credentials information, so it doesn't need a long connection(such as something like session).
answers question: http://stackoverflow.com/q/26866739
downvote count: 1
upvote count: 27
score: 26
has comment: http://stackoverflow.com/comment/133541176
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/26866739

http://stackoverflow.com/q/26975119
has comment: http://stackoverflow.com/comment/42485183
has answer: http://stackoverflow.com/a/26975241
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/42485232
tagged with: runtime
has comment: http://stackoverflow.com/comment/42485278
has body: I have this class which creates a simulation of registers and clients and asks for total time to finish with them and the average waiting time. I have created a FIFO array which is consisted of listed queues of the IntQueueImpl class i have. Now the code compliles fine but when i run it i get a runtime. Here's the class: import java.util.Scanner; public class QueueSimulation { public static void main(String[] args) { int a, tail, head; int i = 0; String s; Scanner input = new Scanner(System.in); System.out.println("This programs simulates a queue of customers at registers."); System.out.println("We assume the every customer take 4 seconds to leave the register."); System.out.println("Enter the number of registers you want to simulate:"); a = input.nextInt(); while(a==0 || a &lt;0){ System.out.println("0 registers or no registers is invalid. Enter again: "); a = input.nextInt(); } IntQueueImpl fifo[] = new IntQueueImpl[a]; System.out.println("Enter how many customers enter per second.For example: 0 0 1 1 2 2 2 3 3. Enter: "); s = input.nextLine(); s = input.nextLine(); String[] parts = s.split(" "); int[] A = new int[parts.length]; for(int j = 0; j &lt; parts.length; j++){ A[j]= Integer.parseInt(parts[j]); while(A[j] &lt; 0){ System.out.println(A[j]+" is invalid.Enter positive integer: "); A[j]= input.nextInt(); } } input.close(); head = tail = 0; int T[] = new int[A.length]; int temp= 0; for(int j = 0 ; j&lt; A.length ; j++){ if(fifo[tail].isEmpty()) fifo[tail].put(A[j] +4); else{ temp = fifo[tail].size(); fifo[tail].put(A[j] + 4*temp); } if(tail == a-1){ tail=0; }else tail++; if(j&gt;=4){ temp = fifo[head].get(); T[j]= j-temp; if(head == a-1){ head=0; }else head++; } } int sum = 0; for(int j= 0; j&lt;T.length; j++){ sum =+ T[j]; } System.out.println("All customers leaved at: " + sum + " seconds."); } } And the runtime error i get is this: Exception in thread "main" java.lang.NullPointerException at QueueSimulation.main(QueueSimulation.java:58) which is this command…
score: 0
tagged with: nullpointerexception
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42485277
has title: Runtime PointerNullException solution seeking

http://stackoverflow.com/comment/42494013
has text: Results are in comments across the code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/26979786
score: 2

http://stackoverflow.com/a/26905442
upvote count: 1
answers question: http://stackoverflow.com/q/26856487
has body: I can't verify the correctness of this solution, but I was facing this problem as well and approached it following this idea: @Override public void onBindViewHolder(ViewHolder viewHolder, final int i) { ... if(mImageView.getDrawable() == null) Picasso.with(context) .load(path) .error(errorResId) .tag(tag) .into(mImageView); ... } It is intended to forbid Picasso from loading anything unless the ImageView has nothing to display.
has comment: http://stackoverflow.com/comment/44672096
downvote count: 0
has comment: http://stackoverflow.com/comment/44672435
has comment: http://stackoverflow.com/comment/46297908
has comment: http://stackoverflow.com/comment/44671864
has comment: http://stackoverflow.com/comment/44672622
type: Answer
has comment: http://stackoverflow.com/comment/66303148
score: 1

http://stackoverflow.com/a/26965145
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/42469827
answers question: http://stackoverflow.com/q/26965049
downvote count: 0
has body: Get rid of the Thread.sleep(). That's what the 1000 in Timer(1000, new ActionListener() does. It sets an interval for each timer event. Every time a timer event is fired, the actionPerformed is called. So you need to determine what needs to happen every "tick", and put that code in the actionPerformed. Maybe something like Timer timer = new Timer(1000, new ActionListener() { private int count = 5; @Override public void actionPerformed(ActionEvent e) { if (count &lt;= 0) { label.setText("OPEN"); ((Timer)e.getSource()).stop(); count = 5; } else { label.setText(Integer.toString(count); count--; } } }); You need to decide when to call timer.start(). For general information, see How to Use Swing Timers
type: Answer
has comment: http://stackoverflow.com/comment/42469877

http://stackoverflow.com/comment/42300324
has text: @LuiggiMendoza: The OP is not looking to *improve this code*, but to *improve upon this solution*. I think that's absolutely on-topic here. (If someone posted asking for a better sorting algorithm, and you see that they've successfully implemented bubblesort, would you send them to codereview.stackexchange.com to learn about mergesort?)
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/26870809

http://stackoverflow.com/comment/42367709
has text: I have now added the loadExercises() check above. But why is loadExercises() method returning null only in some cases only?
comment on: http://stackoverflow.com/a/26907793
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/42252267
type: Comment
has text: @biziclop - i don't think this is a bad interview question, as it checks if the candidate has some background knowledge on OO paradigms (one might compare Java to say Smalltalk or Scala)
type: QuestionComment
comment on: http://stackoverflow.com/q/26844413
score: 0

http://stackoverflow.com/a/52568749
answers question: http://stackoverflow.com/q/26957539
has body: public static void main(String[] args) { LinkedHashMap&lt;Character, Integer&gt; h = new LinkedHashMap&lt;&gt;(); String s = "abdsd$asda$asasdd$sadas"; for (char ch : s.toCharArray()) { if ((h.containsKey(ch))) { h.put(ch, h.get(ch) + 1); } else { h.put(ch, 1); } } for (char key : h.keySet()) { System.out.println(key + "-" + h.get(key)); } }
score: 0
type: Answer

http://stackoverflow.com/q/26842447
type: UnansweredQuestion
has title: Hibernate sort based on enum
type: Question
tagged with: enums
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/42253485
has answer: http://stackoverflow.com/a/26842724
has comment: http://stackoverflow.com/comment/42253351
has body: I have am working a project which uses enums as columns to a database public enum MyEnum{ a1(1,"act1"), a2(2,"act2"), a3(3,"act3"), b1(4,"bob1"), c1(10,"cake1"), c2(11,"cake2"), } @Entity public class MyEntity{ .. private Integer myEnumIntValue; ... } (NOTE: myEnumIntValue is not mapped as enum in the entity) I have a hibernate query to query MyEntity. The query orders the result based on the int value of the enum createCriteria(MyEntity.class).addOrder("myEnumIntValue"); This was all good until the enum was changed to Public enum MyEnum{ a1(1,"act1"), a2(2,"act2"), a3(3,"act3"), a4(7,"act4"), b1(4,"bob1"), c1(10,"cake1"), c2(11,"cake2") } It now becomes a problem because the order of the result is i am getting is (a1,a2,a3,**b1,a4**,c1,c2) but sorting of the Entities should be (a1,a2,a3,**a4,b1**,c1,c2) What is strategy can i use to resolve this?
has comment: http://stackoverflow.com/comment/42248769
upvote count: 1
answer count: 1
favorite count: 0
downvote count: 0

http://stackoverflow.com/q/26959770
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/26959883
type: Question
has answer: http://stackoverflow.com/a/26959841
tagged with: java
possible better answer: http://stackoverflow.com/a/26959841
answer count: 3
has answer: http://stackoverflow.com/a/26960000
upvote count: 1
has comment: http://stackoverflow.com/comment/42458075
has comment: http://stackoverflow.com/comment/42457995
has body: I am making basic java program to hold a secret word (mouse) and allow a user to guess letters. The program will end either when the user guesses all the letters in the word, or when they guess 7 wrong letters. Whenever I type any letter into the program, it will run through it without giving the user an option to enter another letter. What should I add so that it will only run the program once per letter entered? Also if it wasnt quite obvious I am new to coding. import java.util.Scanner; public class GuessWord { String Secretword="mouse"; String letter; int index; private int number; private int counter; private String guesses; Scanner scan = new Scanner(System.in); public GuessWord() { String Secretword=""; String letter = ""; String guesses = ""; int number = 0; int counter = 0; int index = 0; } public String getLetter(){ System.out.println("Please enter a letter"); letter = scan.next(); return letter; } public void calc(){ guesses=letter; while(number &lt;= 7 &amp;&amp; counter&lt;5) { if(Secretword.indexOf(letter) != -1) { index = Secretword.indexOf(letter); System.out.println("You entered a letter in the word"); counter++; } else { System.out.println("You entered an incorrect letter"); number++; } guesses=guesses+" " +letter; System.out.println("The letters you have guessed are:" + guesses); } String str; if(number == 7){ System.out.println("You lose"); }else { System.out.println("You win"); } } }//class public class GuessWordR { public static void main(String[]args) { GuessWord g1 = new GuessWord(); g1.getLetter(); g1.calc(); }//class }//main
has title: Java SecretWord Code
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/26960000
downvote count: 0

http://stackoverflow.com/a/63650486
has comment: http://stackoverflow.com/comment/125267325
answers question: http://stackoverflow.com/q/26964688
downvote count: 0
has comment: http://stackoverflow.com/comment/121205153
type: Answer
score: 14
has comment: http://stackoverflow.com/comment/117667442
upvote count: 14
has body: A correct file upload would like this: HTTP header: Content-Type: multipart/form-data; boundary=ABCDEFGHIJKLMNOPQ Http body: --ABCDEFGHIJKLMNOPQ Content-Disposition: form-data; name="file"; filename="my.txt" Content-Type: application/octet-stream Content-Length: ... <...file data in base 64...> --ABCDEFGHIJKLMNOPQ-- and code is like this: public void uploadFile(File file) { try { RestTemplate restTemplate = new RestTemplate(); String url = "http://localhost:8080/file/user/upload"; HttpMethod requestMethod = HttpMethod.POST; HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.MULTIPART_FORM_DATA); MultiValueMap<String, String> fileMap = new LinkedMultiValueMap<>(); ContentDisposition contentDisposition = ContentDisposition .builder("form-data") .name("file") .filename(file.getName()) .build(); fileMap.add(HttpHeaders.CONTENT_DISPOSITION, contentDisposition.toString()); HttpEntity<byte[]> fileEntity = new HttpEntity<>(Files.readAllBytes(file.toPath()), fileMap); MultiValueMap<String, Object> body = new LinkedMultiValueMap<>(); body.add("file", fileEntity); HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(body, headers); ResponseEntity<String> response = restTemplate.exchange(url, requestMethod, requestEntity, String.class); System.out.println("file upload status code: " + response.getStatusCode()); } catch (IOException e) { e.printStackTrace(); } }
has comment: http://stackoverflow.com/comment/133422389

http://stackoverflow.com/comment/42339721
comment on: http://stackoverflow.com/q/26892906
score: 0
has text: Do you have a getter for a param property?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/26908402
tagged with: mouseevent
type: Question
answer count: 1
has title: JAVA - Get mouse location when mouse is clicked
has comment: http://stackoverflow.com/comment/42366788
score: 0
type: UnansweredQuestion
has body: I need to get the absolute location of mouse after a click on the screen. I've already searched on the web but the only solution I have found uses this method: MouseInfo.getPointerInfo().getLocation() which gets the position independently from the click. Otherwise, i have to use an EventListener to check out when the mouse is clicked, but the problem is that listeners are related to a component, while i need the absolute location. How can i solve this?
has answer: http://stackoverflow.com/a/26908661
has comment: http://stackoverflow.com/comment/42367726
linked to: http://stackoverflow.com/q/20118196
tagged with: java
has comment: http://stackoverflow.com/comment/42366861

java-8
tags question: http://stackoverflow.com/q/26927155
tags question: http://stackoverflow.com/q/26934042
tags question: http://stackoverflow.com/q/26904146
tags question: http://stackoverflow.com/q/26874776
tags question: http://stackoverflow.com/q/26862874
tags question: http://stackoverflow.com/q/26875226
tags question: http://stackoverflow.com/q/26895632
tags question: http://stackoverflow.com/q/26980931
tags question: http://stackoverflow.com/q/26872827
tags question: http://stackoverflow.com/q/26920956
tags question: http://stackoverflow.com/q/26838183
tags question: http://stackoverflow.com/q/26921419
tags question: http://stackoverflow.com/q/26853644
tags question: http://stackoverflow.com/q/26940143
tags question: http://stackoverflow.com/q/26972192
tags question: http://stackoverflow.com/q/26942208
tags question: http://stackoverflow.com/q/26989933
tags question: http://stackoverflow.com/q/26839962
tags question: http://stackoverflow.com/q/26913957
tags question: http://stackoverflow.com/q/26905312
tags question: http://stackoverflow.com/q/26886703
tag name: java-8
tags question: http://stackoverflow.com/q/26873201
tags question: http://stackoverflow.com/q/26848606
tags question: http://stackoverflow.com/q/26920866
tags question: http://stackoverflow.com/q/26839129
tags question: http://stackoverflow.com/q/26913341
type: Tag
tags question: http://stackoverflow.com/q/26847747
tags question: http://stackoverflow.com/q/26961513
tags question: http://stackoverflow.com/q/26873475
tags question: http://stackoverflow.com/q/26895059

http://stackoverflow.com/a/36919009
has comment: http://stackoverflow.com/comment/76368627
has comment: http://stackoverflow.com/comment/79276098
has comment: http://stackoverflow.com/comment/91727708
answers question: http://stackoverflow.com/q/26856487
has comment: http://stackoverflow.com/comment/76641813
has comment: http://stackoverflow.com/comment/76370052
upvote count: 83
type: Answer
has comment: http://stackoverflow.com/comment/106806323
has comment: http://stackoverflow.com/comment/64983602
has comment: http://stackoverflow.com/comment/98579498
has body: Setting recyclerView parameters as below solved my stutter problem : recyclerView.setHasFixedSize(true); recyclerView.setItemViewCacheSize(20); recyclerView.setDrawingCacheEnabled(true); recyclerView.setDrawingCacheQuality(View.DRAWING_CACHE_QUALITY_HIGH); i hope it helps someone else too.
has comment: http://stackoverflow.com/comment/107188387
downvote count: 0
has comment: http://stackoverflow.com/comment/72237907
score: 83

http://stackoverflow.com/comment/42392076
type: QuestionComment
comment on: http://stackoverflow.com/q/26921774
has text: I think not deprecate case 3 and put `@deprecated` in Javadoc might be the last resort, if no better approach exists.
score: 0
type: Comment

http://stackoverflow.com/a/26843399
score: 1
upvote count: 1
has body: Use this code to play video from storage. Uri vidFile = Uri.parse( Environment.getExternalStorageDirectory().getAbsolutePath()+"/download/"+"xyz.mp4"); VideoView videoView = (VideoView) findViewById(R.id.videoView); videoView.setVideoURI(vidFile); videoView.setMediaController(new MediaController(MainActivity.this)); videoView.setVisibility(1); videoView.bringToFront(); videoView.requestFocus(); videoView.start();
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/26843375

http://stackoverflow.com/comment/42248472
comment on: http://stackoverflow.com/a/26842296
score: 0
type: AnswerComment
has text: You could do it post getting in list or while adding to list as well.
type: Comment

http://stackoverflow.com/q/26865345
favorite count: 0
has comment: http://stackoverflow.com/comment/42290079
has answer: http://stackoverflow.com/a/26865703
has title: How to store an object in to a variable
has comment: http://stackoverflow.com/comment/42290147
score: -3
upvote count: 1
has body: I am a beginner in JAVA and I could use some help. So I have 3 classes : Client,BankAccount and Test. I need to add into a Client object the details from a BankAccount. This is the code: public class Client { private String name; private String adress; private BankAccount accounts[]; public Client(String name,String adress,BankAccount accounts){ this.name=name; this.adress=adress; this.accounts=accounts; } public class BankAccount { private String numarCont; private float suma; public ContBancar(String accNumber,float sum){ this.accNumber=accNumber; this.sum=sum; } public class Test { public static void main(String[] args) { Bankaccount b=new Bankaccount("f211s1",200); Bankaccount b1=new Bankaccount("f23131EUR",5000); System.out.println(b); Client c=new Client("John","142VineYard",b); System.out.println(c); } } A client can have multiple accounts. The problem is that I don't know how can I add the details of object b into object c.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/42290037
tagged with: java
possible better answer: http://stackoverflow.com/a/26865703
type: Question
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/42290253
has answer: http://stackoverflow.com/a/26865610
accepted answer: http://stackoverflow.com/a/26865610

http://stackoverflow.com/comment/42500512
comment on: http://stackoverflow.com/a/26963875
type: AnswerComment
type: Comment
score: 0
has text: Added the ViewAccount class, the method is at the bottom!

http://stackoverflow.com/comment/101235584
comment on: http://stackoverflow.com/q/26890391
score: 0
has text: the dropwizard-elasticsearch repo seems to be unmaintained
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42444590
score: 1
comment on: http://stackoverflow.com/q/26951932
has text: if you really want a singleton, why not use an `enum`? The Java language does all the heavy lifting. Of course there's a lot of controversy over whether singletons are good. http://www.embeddedrelated.com/showarticle/691.php
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/69600484
has text: this works, but i kept the input as an int to make my algorithm work
type: AnswerComment
comment on: http://stackoverflow.com/a/41200608
type: Comment
score: 2

http://stackoverflow.com/comment/42450805
has text: Naturally I removed it from my model and only have it in my service. Thanks for your input.
type: AnswerComment
comment on: http://stackoverflow.com/a/26952343
score: 0
type: Comment

tabs
type: Tag
tags question: http://stackoverflow.com/q/26908536
tags question: http://stackoverflow.com/q/26946942
tags question: http://stackoverflow.com/q/26888824
tag name: tabs
tags question: http://stackoverflow.com/q/26871874

http://stackoverflow.com/comment/42439154
comment on: http://stackoverflow.com/a/26948641
score: 0
type: AnswerComment
type: Comment
has text: @user4254704 Glad it worked for you. Please accept the answer if indeed it helped and closet his question.

http://stackoverflow.com/a/26881967
has comment: http://stackoverflow.com/comment/42322753
accepted answer of: http://stackoverflow.com/q/26881828
has comment: http://stackoverflow.com/comment/42320190
has comment: http://stackoverflow.com/comment/42324427
type: Answer
has comment: http://stackoverflow.com/comment/42326907
has comment: http://stackoverflow.com/comment/42323718
upvote count: 1
answers question: http://stackoverflow.com/q/26881828
score: 1
has comment: http://stackoverflow.com/comment/42323780
has body: 1. Wrong JSF tags. Tag names are 1) case-sensitive and 2) tags that you use belong to another taglib with namespace prefix h: as set up in xmlns attribute of your html element. You should correct f:inputtext to h:inputText, f:inputSecret to h:inputSecret and f:commandbutton to h:commandButton. 2. Wrong bean properties definition. As @SJuan76 noted, to use property #{bean.property}, you should define public method public String getProperty(){} (case sensitive!) in your managed bean. In order to avoid such problems in future you'd better use some IDE (e.g. Netbeans IDE or Intellij IDEA). IDEs have great autocompletion and validation facilities, especially for JavaEE standard libraries. 3. You are mixing CDI and JSF dependency injection mechanisms. Use CDI's @javax.inject.Named with @javax.enterprise.context.SessionScoped or JSF's @javax.faces.bean.ManagedBean with @javax.faces.bean.SessionScoped. 4. Wrong h:CommandButton action attribute. JSF Specification (JSP tag documentation / h: / Tag commandButton) says of action attribute: The expression must evaluate to a public method that takes no parameters, and returns an Object (the toString() of which is called to derive the logical outcome) which is passed to the NavigationHandler for this application I.e. dologin() must not be void. It should return e.g. String outcome, for which navigation rule exists in WEB-INF/faces-config.xml or view name that should be navigated to. E.g. if dologin() returns "success" user will be navigated to success.xhtml; if dologin() returns "failure" then user will be navigated to failure.xhtml. Documentation for JSF is available at jcp.org: JSF 2.2 spec. If you want to show dialog instead of navigating to different view, you should use f:ajax tag with h:commandButton in your Login.xhtml to partially render view. You cannot use Swing's JOptionPane here, because client-side Swing is irrelevant to server-side JSF. PS I recommend to download JSF spec for reference and get, for example, "JavaServ…
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/26956164
has comment: http://stackoverflow.com/comment/42452067
score: 2
has comment: http://stackoverflow.com/comment/42451900
has comment: http://stackoverflow.com/comment/42451995
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/26956095
has body: You would need to crack the key in the same manner as anyone else who didn't know the key. You can do brute force, try every possible key. dictionary lookup, in case it's not a random key. Note: this assumes you have a way of recognising the data as decrypted when it has been. If the original data is random, and there is no way to know it has been decrypted, there is no way to crack it. What normally, happens when you lose a key to a lock, you have to break something. BTW Depending on the encryption, keys might not be unique. It is possible that multiple keys could unlock the data in which case, it's not possible to know the original key, only one or more key which can unlock the data. e.g. unix systems used to only use the first 8 letters of a password. This meant if your password was longer than 8, it was possible to crack the first 8 letters, but there was no way to know if the password was longer and which letters were discarded.
type: Answer
has comment: http://stackoverflow.com/comment/42452082

http://stackoverflow.com/comment/42492985
type: QuestionComment
comment on: http://stackoverflow.com/q/26979182
has text: There are also misplaced parentheses.
score: 0
type: Comment

joptionpane
tags question: http://stackoverflow.com/q/26932038
tags question: http://stackoverflow.com/q/26843438
tags question: http://stackoverflow.com/q/26913923
type: Tag
tags question: http://stackoverflow.com/q/26978150
tags question: http://stackoverflow.com/q/26902556
tags question: http://stackoverflow.com/q/26884461
tags question: http://stackoverflow.com/q/26915949
tag name: joptionpane
tags question: http://stackoverflow.com/q/26961587

http://stackoverflow.com/q/26946267
tagged with: swing
has body: at the moment I'm trying to build a little WebCam client that is using an IP Camera which can be controller by commands via http. Unfortunately the KeyListener I added with an own class does not respond to any keystroke. I think i added the KeyListener in the wrong way. import java.awt.BorderLayout; import java.awt.Container; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; public class MainFrame extends JFrame{ private static final long serialVersionUID = 1L; InterfaceVideo activeVideo; InterfaceMoving activeCamera; Image image; public MainFrame(){ initComponents(); } public void initComponents(){ Container container = this.getContentPane(); final CameraPanel cameraPanel = new CameraPanel(); final EventHandlerKeyListener keyListener = new EventHandlerKeyListener(); // create menubar JMenuBar menuBar = new JMenuBar(); // create menuitem JMenu Camera_Menu = new JMenu("Cameras"); JMenu Options_Menu = new JMenu("Options"); // create submenuitems JMenuItem AllnetCamera_MenuItem = new JMenuItem("Allnet Camera"); JMenuItem FosCamera_MenuItem = new JMenuItem("FosCam camera"); JMenuItem SevenLinkCamera_MenuItem = new JMenuItem("SevenLink Camera"); JMenuItem AddCamera_MenuItem = new JMenuItem("Add Camera..."); // add menuitems menuBar.add(Camera_Menu); menuBar.add(Options_Menu); // add submenuitems Camera_Menu.add(AllnetCamera_MenuItem); Camera_Menu.add(FosCamera_MenuItem); Camera_Menu.add(SevenLinkCamera_MenuItem); Options_Menu.add(AddCamera_MenuItem); add(menuBar, BorderLayout.NORTH); container.add(cameraPanel); setSize(1280, 720); setTitle("Webcam Client"); cameraPanel.setFocusable(true); cameraPanel.requestFocusInWindow(); cameraPanel.addKeyListener(keyListener); cameraPanel.setVisible(true); setVisible(true); AllnetCamera_MenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg…
has comment: http://stackoverflow.com/comment/42435228
tagged with: java
has title: KeyListener added as own class is not working
tagged with: jpanel
tagged with: keylistener
linked to: http://stackoverflow.com/q/7071757
has comment: http://stackoverflow.com/comment/42434987
duplicate of: http://stackoverflow.com/q/7071757
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42435259
type: Question
tagged with: jframe
score: 0

http://stackoverflow.com/q/26966118
tagged with: android
tagged with: runnable
score: 1
answer count: 0
upvote count: 1
has body: I'm very inexperienced in Android development but right now I'm trying to develop a game using Android's tools in Eclipse. It's a simple game. On the screen I have areas where the user touches to move a character. I used the Runnable/Handler to try to repeat the action of the character moving in the direction corresponding to the touch area. However, every time I touch the area, it only moves the character down a little. Here's my code. private final Handler handler = new Handler(); private final Runnable runnable = new Runnable() { public void run() { protagonist.moveDown(); } }; @Override public boolean onTouchEvent(MotionEvent event) { int touchX = (int)event.getX(); int touchY = (int)event.getY(); if(down.contains(touchX,touchY)) { boolean mBooleanIsPressed = true; if(event.getAction() == MotionEvent.ACTION_DOWN) { handler.postDelayed(runnable, 500); mBooleanIsPressed = true; } if(event.getAction() == MotionEvent.ACTION_UP) { if(mBooleanIsPressed) { mBooleanIsPressed = false; handler.removeCallbacks(runnable); } } } return false; } Down is the touch area that makes the character move down. What's wrong with my code or what can I do to fix it and make it better? Thank you.
tagged with: java
has title: Android Game Development: Handler/Runnable not repeating action
tagged with: eclipse
tagged with: handler
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question

http://stackoverflow.com/a/26939810
answers question: http://stackoverflow.com/q/26939420
has body: You should not put in the same code from onSave into onRestore. Copy the complete if-statement from your onCreate method into the onRestore method instead. And call super.onRestoreInstanceState as the first statement. Edit: sorry - was intended to be a comment
has comment: http://stackoverflow.com/comment/42424038
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/26939420
has comment: http://stackoverflow.com/comment/42423913
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/27754033
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/26866398
upvote count: 1
type: Answer
has body: This usually indicates that you somehow drag in outdated XML Parser interfaces, e.g. via some transient dependency to an old xml-api version or an outdated xerces jar, which is usually not needed any more at all as Java 6 provides all the XML parsing functionality out of the box. See this discusion for some more details.

freebase
tag name: freebase
tags question: http://stackoverflow.com/q/26913090
type: Tag